public static void assertHttpStatusCodeErrorCodeAndMessage(
            HttpResponse response,
            int statusCode,
            HttpErrorResponse.ErrorCode errorCode,
            String contentType,
            String message) throws IOException {
        assertNotNull(response);
        String renderedString = SessionHandlerTest.getRenderedString(response);
        if (renderedString == null) {
            renderedString = "assert failed";
        }
        assertEquals(renderedString, statusCode, response.getStatus());
        if (errorCode != null) {
            assertTrue(renderedString.contains(errorCode.name()));
        }
        if (contentType != null) {
            assertEquals(renderedString, contentType, response.getContentType());
        }
        assertTrue("\n" + renderedString + "\n should contain \n" + message, renderedString.contains(message));
    }
Base class for handler tests

@author hmusum
configserver/src/test/java/com/yahoo/vespa/config/server/http/HandlerTest.java