Exemplo n.º 1
0
 @Test
 public void testOBBig1() {
   BasicOutputBuffer a = new BasicOutputBuffer();
   StringBuilder b = new StringBuilder();
   for (String x : _data) {
     a.write(x.getBytes());
     b.append(x);
   }
   assertEquals(a.asString(), b.toString());
 }
Exemplo n.º 2
0
  @Test
  public void testOB1() {
    BasicOutputBuffer buf = new BasicOutputBuffer();
    buf.write("eliot".getBytes());
    assertEquals(5, buf.getPosition());
    assertEquals(5, buf.size());

    assertEquals("eliot", buf.asString());

    buf.setPosition(2);
    buf.write("z".getBytes());
    assertEquals("elzot", buf.asString());

    buf.seekEnd();
    buf.write("foo".getBytes());
    assertEquals("elzotfoo", buf.asString());

    buf.seekStart();
    buf.write("bar".getBytes());
    assertEquals("barotfoo", buf.asString());
  }