FreemarkerRequest extends AbstractViewRequest { @Override public PrintWriter getPrintWriter() { Writer writer = env.getOut(); if (writer instanceof PrintWriter) { return (PrintWriter) writer; } return new PrintWriter(writer); } FreemarkerRequest(DispatchRequest enclosedRequest,
            Environment env); static FreemarkerRequest createServletFreemarkerRequest(
            ApplicationContext applicationContext, Environment env); Environment getEnvironment(); @Override Locale getRequestLocale(); Map<String, Object> getPageScope(); @Override List<String> getAvailableScopes(); @Override PrintWriter getPrintWriter(); @Override Writer getWriter(); @Override Map<String, Object> getContext(String scope);  }
@Test public void testGetPrintWriter() { DispatchRequest enclosedRequest = createMock(DispatchRequest.class); expect(enclosedRequest.getAvailableScopes()).andReturn(Collections.singletonList("parent")); replay(enclosedRequest); context = new FreemarkerRequest(enclosedRequest, env); assertEquals(env, context.getEnvironment()); assertNotNull(context.getPrintWriter()); verify(enclosedRequest); }