wagon-provider-test/src/main/java/org/apache/maven/wagon/http/HttpWagonTestCase.java [1920:1980]:
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
            switch (forStatusCode) {
                case HttpServletResponse.SC_NOT_FOUND:
                    // TODO: add test for 410: Gone?
                    assertTrue(
                            "404 not found response should throw ResourceDoesNotExistException",
                            e instanceof ResourceDoesNotExistException);
                    reasonPhrase = (forReasonPhrase == null || forReasonPhrase.isEmpty())
                            ? " Not Found"
                            : (" " + forReasonPhrase);
                    assertEquals(
                            assertMessageForBadMessage,
                            "resource missing at " + forUrl + ", status: 404" + reasonPhrase,
                            e.getMessage());
                    break;

                case HttpServletResponse.SC_UNAUTHORIZED:
                    // FIXME assumes Wagon.get()/put() returning 401 instead of Wagon.connect()
                    assertTrue(
                            "401 Unauthorized should throw AuthorizationException since "
                                    + " AuthenticationException is not explicitly declared as thrown from wagon "
                                    + "methods",
                            e instanceof AuthorizationException);
                    reasonPhrase = (forReasonPhrase == null || forReasonPhrase.isEmpty())
                            ? " Unauthorized"
                            : (" " + forReasonPhrase);
                    assertEquals(
                            assertMessageForBadMessage,
                            "authentication failed for " + forUrl + ", status: 401" + reasonPhrase,
                            e.getMessage());
                    break;

                case HttpServletResponse.SC_PROXY_AUTHENTICATION_REQUIRED:
                    assertTrue(
                            "407 Proxy authentication required should throw AuthorizationException",
                            e instanceof AuthorizationException);
                    reasonPhrase = (forReasonPhrase == null || forReasonPhrase.isEmpty())
                            ? " Proxy Authentication Required"
                            : (" " + forReasonPhrase);
                    assertEquals(
                            assertMessageForBadMessage,
                            "proxy authentication failed for " + forUrl + ", status: 407" + reasonPhrase,
                            e.getMessage());
                    break;

                case HttpServletResponse.SC_FORBIDDEN:
                    assertTrue(
                            "403 Forbidden should throw AuthorizationException", e instanceof AuthorizationException);
                    reasonPhrase = (forReasonPhrase == null || forReasonPhrase.isEmpty())
                            ? " Forbidden"
                            : (" " + forReasonPhrase);
                    assertEquals(
                            assertMessageForBadMessage,
                            "authorization failed for " + forUrl + ", status: 403" + reasonPhrase,
                            e.getMessage());
                    break;

                default:
                    assertTrue(
                            "transfer failures should at least be wrapped in a TransferFailedException",
                            e instanceof TransferFailedException);
                    assertTrue(
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -



wagon-tcks/wagon-tck-http/src/main/java/org/apache/maven/wagon/tck/http/Assertions.java [106:169]:
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
            switch (forStatusCode) {
                case HttpServletResponse.SC_NOT_FOUND:
                    // TODO: add test for 410: Gone?
                    assertTrue(
                            "404 not found response should throw ResourceDoesNotExistException",
                            e instanceof ResourceDoesNotExistException);
                    reasonPhrase = (forReasonPhrase == null || forReasonPhrase.isEmpty())
                            ? " Not Found"
                            : (" " + forReasonPhrase);
                    assertEquals(
                            assertMessageForBadMessage,
                            "resource missing at " + forUrl + ", status: 404" + reasonPhrase,
                            e.getMessage());
                    break;

                case HttpServletResponse.SC_UNAUTHORIZED:
                    // FIXME assumes Wagon.get()/put() returning 401 instead of Wagon.connect()
                    assertTrue(
                            "401 Unauthorized should throw AuthorizationException since "
                                    + " AuthenticationException is not explicitly declared as thrown from wagon "
                                    + "methods",
                            e instanceof AuthorizationException);
                    reasonPhrase = (forReasonPhrase == null || forReasonPhrase.isEmpty())
                            ? " Unauthorized"
                            : (" " + forReasonPhrase);
                    assertEquals(
                            assertMessageForBadMessage,
                            "authentication failed for " + forUrl + ", status: 401" + reasonPhrase,
                            e.getMessage());
                    break;

                case HttpServletResponse.SC_PROXY_AUTHENTICATION_REQUIRED:
                    assertTrue(
                            "407 Proxy authentication required should throw AuthorizationException",
                            e instanceof AuthorizationException);
                    reasonPhrase = (forReasonPhrase == null || forReasonPhrase.isEmpty())
                            ? " Proxy Authentication Required"
                            : (" " + forReasonPhrase);
                    assertEquals(
                            assertMessageForBadMessage,
                            "proxy authentication failed for " + forUrl + ", status: 407" + reasonPhrase,
                            e.getMessage());
                    break;

                case HttpServletResponse.SC_FORBIDDEN:
                    assertTrue(
                            "403 Forbidden should throw AuthorizationException", e instanceof AuthorizationException);
                    reasonPhrase = (forReasonPhrase == null || forReasonPhrase.isEmpty())
                            ? " Forbidden"
                            : (" " + forReasonPhrase);
                    assertEquals(
                            assertMessageForBadMessage,
                            "authorization failed for " + forUrl + ", status: 403" + reasonPhrase,
                            e.getMessage());
                    break;

                default:
                    assertTrue(
                            "transfer failures should at least be wrapped in a TransferFailedException",
                            e instanceof TransferFailedException);

                    // the status code and reason phrase cannot always be learned due to implementation limitations
                    // so the message may not include them, but the implementation should use a consistent format
                    assertTrue(
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -



