@Override
    protected void writeErrorPage(HttpServletRequest request, Writer writer, int code, String message, boolean showStacks) throws IOException {

        String defaultErrorMessage = HttpStatus.getMessage(code);
        String errorPage = replaceHtml(code, defaultErrorMessage);
        writer.write(errorPage);
    }
@Test
    public void shouldNotUseErrorMessageFromResponse() throws Exception {
        errorHandler.writeErrorPage(request, writer, 500, "this message should not be rendered", false);

        verify(writer).write(captor.capture());
        String fileContents = captor.getValue();

        assertThat(fileContents, not(containsString("this message should not be rendered")));
    }