@Test
    @Configuration("{\r\n" +
            "    \"realm\" : \"TestRealm\",\r\n" +
            "    \"requireBasicAuth\" : false,\r\n" +
            "    \"staticIdentity\" : {\r\n" +
            "      \"identities\" : [\r\n" +
            "        { \"username\" : \"ckent\", \"password\" : \"ckent123!\" },\r\n" +
            "        { \"username\" : \"bwayne\", \"password\" : \"bwayne123!\" },\r\n" +
            "        { \"username\" : \"dprince\", \"password\" : \"dprince123!\" }\r\n" +
            "      ]\r\n" +
            "    }\r\n" +
            "}")
    public void testBasicAuthNotRequired() throws Throwable {
        PolicyTestRequest request = PolicyTestRequest.build(PolicyTestRequestType.GET, "/some/resource");

        PolicyTestResponse response = send(request);
        EchoResponse echo = response.entity(EchoResponse.class);
        Assert.assertNotNull(echo);
        String header = echo.getHeaders().get("X-Authenticated-Identity");
        Assert.assertNull(header);
    }
Unit test.

@author eric.wittmann@redhat.com
gateway/engine/policies/src/test/java/io/apiman/gateway/engine/policies/BasicAuthenticationPolicyTest.java