@Test public void endWithCrLfAndFlush_withoutNewline_shouldAddNewline() throws Exception { subject.write("The end".getBytes()); subject.endWithCrLfAndFlush(); assertEquals("The end\r\n", out.toString()); }
@Test public void testFilterWithCRLF() throws Exception { subject.write("Filter\r\nNext Line".getBytes()); subject.flush(); assertEquals("Filter\r\nNext Line", out.toString()); }
@Test public void testFilterWithLF() throws Exception { subject.write("Filter\nNext Line".getBytes()); subject.flush(); assertEquals("Filter\r\nNext Line", out.toString()); }
@Test public void endWithCrLfAndFlush_endingWithCr_shouldCompleteNewline() throws Exception { subject.write("The end\r".getBytes()); subject.endWithCrLfAndFlush(); assertEquals("The end\r\n", out.toString()); }
@Test public void testFilterWithoutCRorLF() throws Exception { subject.write("Unchanged".getBytes()); subject.flush(); assertEquals("Unchanged", out.toString()); }
@Test public void testFilterWithJustCR() throws Exception { subject.write("\n\n\n".getBytes()); subject.flush(); assertEquals("\r\n\r\n\r\n", out.toString()); }
@Test public void testFilterWithCR() throws Exception { subject.write("Filter\rNext Line".getBytes()); subject.flush(); assertEquals("Filter\r\nNext Line", out.toString()); }
@Test public void endWithCrLfAndFlush_endingWithNewline_shouldNotAddAdditionalNewline() throws Exception { subject.write("The end\r\n".getBytes()); subject.endWithCrLfAndFlush(); assertEquals("The end\r\n", out.toString()); }
@Test public void endWithCrLfAndFlush_endingWithLf_shouldCompleteNewline() throws Exception { subject.write("The end\n".getBytes()); subject.endWithCrLfAndFlush(); assertEquals("The end\r\n", out.toString()); } }