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