@Test
    public void testNoRecycling() throws 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);
        byte[] c = new byte[SINGLE_BUFFER];
        Arrays.fill(c, (byte) 'a');
        OnlyUniqueBuffers b = new OnlyUniqueBuffers();
        try {
            for (int i = APPENDS; i > 0; --i) {
                b.insert(ByteBuffer.wrap(c));
            }
            b.flush();
        } catch (IOException e) {
            if (e.getMessage() == OnlyUniqueBuffers.RECYCLED_BYTE_BUFFER) {
                fail(OnlyUniqueBuffers.RECYCLED_BYTE_BUFFER);
            } else {
                throw e;
            }
        }
    }
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