/** * 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#append(char)}. * * @throws IOException If something goes wrong. */ public void testAppendChar() throws IOException { JspWriter writer = createMock(JspWriter.class); expect(writer.append('c')).andReturn(writer); JspPrintWriterAdapter adapter = new JspPrintWriterAdapter(writer); replay(writer); assertEquals(adapter, adapter.append('c')); verify(writer); }
/** * Test method for {@link org.apache.tiles.request.jsp.JspPrintWriterAdapter#flush()}. * * @throws IOException If something goes wrong. */ public void testFlush() throws IOException { JspWriter writer = createMock(JspWriter.class); writer.flush(); JspPrintWriterAdapter adapter = new JspPrintWriterAdapter(writer); replay(writer); adapter.flush(); verify(writer); }
/** * Test method for {@link org.apache.tiles.request.jsp.JspPrintWriterAdapter#print(boolean)}. * * @throws IOException If something goes wrong. */ public void testPrintBoolean() throws IOException { JspWriter writer = createMock(JspWriter.class); writer.print(true); JspPrintWriterAdapter adapter = new JspPrintWriterAdapter(writer); replay(writer); adapter.print(true); 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#append(java.lang.CharSequence, int, int)}. * * @throws IOException If something goes wrong. */ public void testAppendCharSequenceIntInt() throws IOException { JspWriter writer = createMock(JspWriter.class); CharSequence sequence = createMock(CharSequence.class); expect(writer.append(sequence, 0, STRING_LENGTH)).andReturn(writer); JspPrintWriterAdapter adapter = new JspPrintWriterAdapter(writer); replay(writer); assertEquals(adapter, adapter.append(sequence, 0, STRING_LENGTH)); 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#write(char[], int, * int)}. * * @throws IOException If something goes wrong. */ public void testWriteCharArrayIntInt() throws IOException { JspWriter writer = createMock(JspWriter.class); String result = "this is a test"; writer.write(aryEq(result.toCharArray()), eq(0), eq(STRING_LENGTH)); JspPrintWriterAdapter adapter = new JspPrintWriterAdapter(writer); replay(writer); adapter.write(result.toCharArray(), 0, STRING_LENGTH); verify(writer); }
/** * Test method for {@link * org.apache.tiles.request.jsp.JspPrintWriterAdapter#write(java.lang.String)}. * * @throws IOException If something goes wrong. */ public void testWriteString() throws IOException { JspWriter writer = createMock(JspWriter.class); String result = "this is a test"; writer.write(result); JspPrintWriterAdapter adapter = new JspPrintWriterAdapter(writer); replay(writer); adapter.write(result); verify(writer); }
/** * Test method for {@link org.apache.tiles.request.jsp.JspPrintWriterAdapter#append(char)}. * * @throws IOException If something goes wrong. */ public void testAppendCharEx() throws IOException { JspWriter writer = createMock(JspWriter.class); expect(writer.append('c')).andThrow(new IOException()); writer.flush(); JspPrintWriterAdapter adapter = new JspPrintWriterAdapter(writer); replay(writer); assertEquals(adapter, adapter.append('c')); assertTrue(adapter.checkError()); 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#append(java.lang.CharSequence, int, int)}. * * @throws IOException If something goes wrong. */ public void testAppendCharSequenceIntIntEx() throws IOException { JspWriter writer = createMock(JspWriter.class); CharSequence sequence = createMock(CharSequence.class); expect(writer.append(sequence, 0, STRING_LENGTH)).andThrow(new IOException()); writer.flush(); JspPrintWriterAdapter adapter = new JspPrintWriterAdapter(writer); replay(writer); assertEquals(adapter, adapter.append(sequence, 0, STRING_LENGTH)); assertTrue(adapter.checkError()); verify(writer); }
/** * Test method for {@link * org.apache.tiles.request.jsp.JspPrintWriterAdapter#write(java.lang.String, int, int)}. * * @throws IOException If something goes wrong. */ public void testWriteStringIntIntEx() throws IOException { JspWriter writer = createMock(JspWriter.class); String result = "this is a test"; writer.write(result, 0, STRING_LENGTH); expectLastCall().andThrow(new IOException()); writer.flush(); JspPrintWriterAdapter adapter = new JspPrintWriterAdapter(writer); replay(writer); adapter.write(result, 0, STRING_LENGTH); assertTrue(adapter.checkError()); verify(writer); }
/** * Test method for {@link * org.apache.tiles.request.jsp.JspPrintWriterAdapter#print(java.lang.Object)}. * * @throws IOException If something goes wrong. */ public void testPrintObjectEx() throws IOException { JspWriter writer = createMock(JspWriter.class); Object obj = createMock(Object.class); writer.print(obj); expectLastCall().andThrow(new IOException()); writer.flush(); JspPrintWriterAdapter adapter = new JspPrintWriterAdapter(writer); replay(writer); adapter.print(obj); 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); }
/** Test method for {@link org.apache.tiles.request.jsp.JspPrintWriterAdapter#getJspWriter()}. */ public void testGetJspWriter() { JspWriter writer = createMock(JspWriter.class); JspPrintWriterAdapter adapter = new JspPrintWriterAdapter(writer); assertEquals(writer, adapter.getJspWriter()); }