private void runTest()

in src/main/java/org/apache/sling/launchpad/webapp/integrationtest/servlets/post/PostServletOutputContentTypeTest.java [33:56]


    private void runTest(String acceptHeaderValue, boolean useHttpEquiv, String expectedContentType) throws Exception {
        final String info = (useHttpEquiv ? "Using http-equiv parameter" : "Using Accept header") + ": ";
        final String url = HTTP_BASE_URL + MY_TEST_PATH;
        final PostMethod post = new PostMethod(url);
        post.setFollowRedirects(false);

        if (acceptHeaderValue != null) {
            if (useHttpEquiv) {
                post.addParameter(":http-equiv-accept", acceptHeaderValue);
            } else {
                post.addRequestHeader("Accept", acceptHeaderValue);
            }
        }

        final int status = httpClient.executeMethod(post) / 100;
        assertEquals(info + "Expected status 20x for POST at " + url, 2, status);
        final Header h = post.getResponseHeader("Content-Type");
        assertNotNull(info + "Expected Content-Type header", h);
        final String ct = h.getValue();
        assertTrue(
                info + "Expected Content-Type '" + expectedContentType + "' for Accept header=" + acceptHeaderValue
                        + " but got '" + ct + "'",
                ct.startsWith(expectedContentType));
    }