@Test
    @Configuration("{" +
            "  \"fromRegex\" : \"http://localhost:8080/path/to/api\",\n" +
            "  \"toReplacement\" : \"http://example.org:8888/my-api/api-path\",\n" +
            "  \"processResponseBody\" : true,\n" +
            "  \"processResponseHeaders\" : true,\n" +
            "  \"processRequestHeaders\" : false,\n" +
            "  \"processRequestUrl\" : false\n" +
            "}")
    @BackEndApi(URLRewritingTestBackend.class)
    public void testFullRewriting() throws Throwable {
        final PolicyTestRequest request = PolicyTestRequest.build(PolicyTestRequestType.GET, "/some/path/to/resource");

        final PolicyTestResponse response = send(request);
        Assert.assertEquals("http://example.org:8888/my-api/api-path/specific-resource/action", response.headers().get("Location"));
        Assert.assertEquals("application/json", response.headers().get("Content-Type"));
        Assert.assertEquals("no-cache", response.headers().get("Cache"));
        Assert.assertEquals("http://example.org:8888/my-api/api-path/alt-resource/alt-action", response.headers().get("X-Alt-Location"));
        Assert.assertEquals("http://localhost:8080/path-12948792147", response.headers().get("ETag"));
        final String responseBody = response.body();
        Assert.assertNotNull(responseBody);
        Assert.assertEquals("\r\n" +
                "{\r\n" +
                "  \"property-1\" : \"value-1\",\r\n" +
                "  \"property-2\" : \"value-2\",\r\n" +
                "  \"property-3\" : \"value-3\",\r\n" +
                "  \"api-location\" : \"http://example.org:8888/my-api/api-path/other-action/here\",\r\n" +
                "  \"property-4\" : \"value-4\",\r\n" +
                "  \"api-alt\" : \"http://example.org:8888/my-api/api-path/alt-action/there\"\r\n" +
                "}", responseBody);
    }
Unit test.

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