/** * Test method for {@link org.apache.tiles.request.jsp.JspPrintWriterAdapter#close()}. * * @throws IOException If something goes wrong. */ public void testClose() throws IOException { JspWriter writer = createMock(JspWriter.class); writer.close(); JspPrintWriterAdapter adapter = new JspPrintWriterAdapter(writer); replay(writer); adapter.close(); verify(writer); }
/** * Test method for {@link org.apache.tiles.request.jsp.JspPrintWriterAdapter#close()}. * * @throws IOException If something goes wrong. */ public void testCloseEx() throws IOException { JspWriter writer = createMock(JspWriter.class); writer.close(); expectLastCall().andThrow(new IOException()); writer.flush(); JspPrintWriterAdapter adapter = new JspPrintWriterAdapter(writer); replay(writer); adapter.close(); assertTrue(adapter.checkError()); verify(writer); }