Every encoded object should include its identifying tag.

This commit is contained in:
akwizgran
2011-07-19 14:21:07 +01:00
parent ff984c69fb
commit a9e7cbd05c
6 changed files with 22 additions and 9 deletions

View File

@@ -70,4 +70,16 @@ public class ConsumersTest extends TestCase {
assertTrue(false);
} catch(FormatException expected) {}
}
@Test
public void testCopyingConsumer() throws Exception {
byte[] data = new byte[1234];
new Random().nextBytes(data);
// Check that a CopyingConsumer creates a faithful copy
CopyingConsumer cc = new CopyingConsumer();
cc.write(data[0]);
cc.write(data, 1, data.length - 2);
cc.write(data[data.length - 1]);
assertTrue(Arrays.equals(data, cc.getCopy()));
}
}