@Test
    public void testApplyWithWildcards() {
        IPWhitelistPolicy policy = new IPWhitelistPolicy();
        String json = "{" +
                "  \"ipList\" : [" +
                "    \"10.0.*.*\"" +
                "  ]" +
                "}";
        Object config = policy.parseConfiguration(json);
        ApiRequest request = new ApiRequest();
        request.setType("GET");
        request.setApiKey("12345");
        request.setDestination("/");
        IPolicyContext context = Mockito.mock(IPolicyContext.class);
        IPolicyChain<ApiRequest> chain = Mockito.mock(IPolicyChain.class);

        // Success
        request.setRemoteAddr("10.0.87.33");
        policy.apply(request, context, config, chain);
        Mockito.verify(chain).doApply(request);

        request.setRemoteAddr("10.0.12.19");
        chain = Mockito.mock(IPolicyChain.class);
        policy.apply(request, context, config, chain);
        Mockito.verify(chain).doApply(request);

        // Failure
        final PolicyFailure failure = new PolicyFailure();
        Mockito.when(context.getComponent(IPolicyFailureFactoryComponent.class)).thenReturn(new IPolicyFailureFactoryComponent() {
            @Override
            public PolicyFailure createFailure(PolicyFailureType type, int failureCode, String message) {
                return failure;
            }
        });
        chain = Mockito.mock(IPolicyChain.class);
        request.setRemoteAddr("9.8.7.6");
        policy.apply(request, context, config, chain);
        Mockito.verify(chain).doFailure(failure);
    }
Test method for {@link io.apiman.gateway.engine.policies.IPWhitelistPolicy#parseConfiguration(java.lang.String)}.
gateway/engine/policies/src/test/java/io/apiman/gateway/engine/policies/IPWhitelistPolicyTest.java