コード例 #1
0
  @Test
  public void testUnicodeCharacters() throws Exception {
    response.add("\uba80\uba81\uba82\uba83");
    response.closeAll();

    assertSubString("\uba80\uba81\uba82\uba83", buffer.toString());
  }
コード例 #2
0
 @Test
 public void testCantAddZeroLengthBytes() throws Exception {
   int originalLength = buffer.length();
   response.add("");
   assertEquals(originalLength, buffer.length());
   response.closeAll();
 }
コード例 #3
0
  @Test
  public void testOneChunk() throws Exception {
    buffer = new StringBuffer();
    response.add("some more text");

    String text = buffer.toString();
    assertEquals("e\r\nsome more text\r\n", text);
  }
コード例 #4
0
  @Test
  public void testTwoChunks() throws Exception {
    buffer = new StringBuffer();
    response.add("one");
    response.add("two");

    String text = buffer.toString();
    assertEquals("3\r\none\r\n3\r\ntwo\r\n", text);
  }
コード例 #5
0
 @Test
 public void testNoNullPointerException() throws Exception {
   String s = null;
   try {
     response.add(s);
   } catch (Exception e) {
     fail("should not throw exception");
   }
 }
コード例 #6
0
 @Test
 public void testContentSize() throws Exception {
   response.add("12345");
   response.closeAll();
   assertEquals(5, response.getContentSize());
 }