### Question:
VelocityRequest extends AbstractViewRequest { @Override public Writer getWriter() { if (writer == null) { throw new IllegalStateException( "A writer-less Tiles request has been created, cannot return a PrintWriter"); } return writer; } VelocityRequest(
            DispatchRequest enclosedRequest, Context ctx, Writer writer); static VelocityRequest createVelocityRequest(
            ApplicationContext applicationContext, HttpServletRequest request,
            HttpServletResponse response, Context velocityContext, Writer writer); @Override List<String> getAvailableScopes(); @Override PrintWriter getPrintWriter(); @Override Writer getWriter(); Map<String, Object> getPageScope(); @Override Map<String, Object> getContext(String scope);  }### Answer:
@Test public void testGetWriter() { DispatchRequest enclosedRequest = createMock(DispatchRequest.class); expect(enclosedRequest.getAvailableScopes()).andReturn(Collections.singletonList("parent")); replay(velocityContext, enclosedRequest); context = new VelocityRequest(enclosedRequest, velocityContext, writer); assertEquals(writer, context.getWriter()); verify(velocityContext, enclosedRequest); }