Ejemplo n.º 1
0
 @Test
 public void serializingEmptyStringShouldBeCorrect() throws IOException {
   ByteArrayOutputStream byteArrayOutputStream = new ByteArrayOutputStream(100);
   BencodeString bencodeString = new BencodeString("");
   bencodeString.serialize(byteArrayOutputStream);
   String s = byteArrayOutputStream.toString();
   Assert.assertEquals("0:", s);
 }
Ejemplo n.º 2
0
 @Test
 public void serializingStringShouldCorrespondSpecification() throws IOException {
   ByteArrayOutputStream byteArrayOutputStream = new ByteArrayOutputStream(100);
   BencodeString bencodeString = new BencodeString("Hello");
   bencodeString.serialize(byteArrayOutputStream);
   String s = byteArrayOutputStream.toString();
   Assert.assertEquals("5:Hello", s);
 }