@Test
    public void testValidateCredentialsBadCredentials() {
        val basicAuthClient = getBasicAuthClient();
        val context = MockWebContext.create();
        try {
            basicAuthClient.validateCredentials(new CallContext(context, new MockSessionStore()),
                new UsernamePasswordCredentials(USERNAME, PASSWORD));
            fail("should throw HttpAction");
        } catch (final HttpAction e) {
            assertEquals(401, e.getCode());
            assertEquals("Basic realm=\"authentication required\"",
                context.getResponseHeaders().get(HttpConstants.AUTHENTICATE_HEADER));
        }
    }
This class tests the {@link IndirectBasicAuthClient} class.

@author Jerome Leleu
@since 1.4.0
pac4j-http/src/test/java/org/pac4j/http/client/indirect/IndirectBasicAuthClientTests.java