/** * Test method for {@link * org.apache.tiles.request.jsp.JspPrintWriterAdapter#print(java.lang.String)}. * * @throws IOException If something goes wrong. */ public void testPrintString() throws IOException { JspWriter writer = createMock(JspWriter.class); writer.print("this is a string"); JspPrintWriterAdapter adapter = new JspPrintWriterAdapter(writer); replay(writer); adapter.print("this is a string"); verify(writer); }
/** * Test method for {@link org.apache.tiles.request.jsp.JspPrintWriterAdapter#print(double)}. * * @throws IOException If something goes wrong. */ public void testPrintDouble() throws IOException { JspWriter writer = createMock(JspWriter.class); writer.print(1d); JspPrintWriterAdapter adapter = new JspPrintWriterAdapter(writer); replay(writer); adapter.print(1d); verify(writer); }
/** * Test method for {@link * org.apache.tiles.request.jsp.JspPrintWriterAdapter#print(java.lang.Object)}. * * @throws IOException If something goes wrong. */ public void testPrintObject() throws IOException { JspWriter writer = createMock(JspWriter.class); Object obj = createMock(Object.class); writer.print(obj); JspPrintWriterAdapter adapter = new JspPrintWriterAdapter(writer); replay(writer); adapter.print(obj); verify(writer); }
/** * Test method for {@link org.apache.tiles.request.jsp.JspPrintWriterAdapter#print(char[])}. * * @throws IOException If something goes wrong. */ public void testPrintCharArray() throws IOException { JspWriter writer = createMock(JspWriter.class); String result = "this is a test"; writer.print(aryEq(result.toCharArray())); JspPrintWriterAdapter adapter = new JspPrintWriterAdapter(writer); replay(writer); adapter.print(result.toCharArray()); verify(writer); }
/** * Test method for {@link * org.apache.tiles.request.jsp.JspPrintWriterAdapter#print(java.lang.String)}. * * @throws IOException If something goes wrong. */ public void testPrintStringEx() throws IOException { JspWriter writer = createMock(JspWriter.class); writer.print("this is a string"); expectLastCall().andThrow(new IOException()); writer.flush(); JspPrintWriterAdapter adapter = new JspPrintWriterAdapter(writer); replay(writer); adapter.print("this is a string"); assertTrue(adapter.checkError()); verify(writer); }
/** * Test method for {@link org.apache.tiles.request.jsp.JspPrintWriterAdapter#print(char[])}. * * @throws IOException If something goes wrong. */ public void testPrintCharArrayEx() throws IOException { JspWriter writer = createMock(JspWriter.class); String result = "this is a test"; writer.print(aryEq(result.toCharArray())); expectLastCall().andThrow(new IOException()); writer.flush(); JspPrintWriterAdapter adapter = new JspPrintWriterAdapter(writer); replay(writer); adapter.print(result.toCharArray()); assertTrue(adapter.checkError()); verify(writer); }