@Test
    public void testMuchData() throws java.io.IOException {
        final int SINGLE_BUFFER = 500;
        final int APPENDS = 500;
        assertTrue("Code has been changed making constants in this test meaningless, review test.",
                BufferChain.BUFFERSIZE * BufferChain.MAXBUFFERS < SINGLE_BUFFER * APPENDS);
        assertTrue("Code has been changed making constants in this test meaningless, review test.",
                BufferChain.WATERMARK > SINGLE_BUFFER);
        stream.reset();
        byte[] c = new byte[SINGLE_BUFFER];
        Arrays.fill(c, (byte) 'a');
        ByteWriter bw = new ByteWriter(stream, encoder);
        for (int i = APPENDS; i > 0; --i) {
            bw.append(c);
        }
        bw.close();
        byte[] res = stream.toByteArray();
        assertEquals("BufferChain has duplicated or lost a buffer.", SINGLE_BUFFER * APPENDS, res.length);
        byte[] completeData = new byte[SINGLE_BUFFER * APPENDS];
        Arrays.fill(completeData, (byte) 'a');
        assertTrue("ByteWriter seems to have introduced data errors.", Arrays.equals(completeData, res));
    }
A stream which does nothing, but complains if it is called and asked to
do nothing.
vespajlib/src/test/java/com/yahoo/io/ByteWriterTestCase.java