@Override
    public void write(int b) {
        ensureAvailable(1);
        buffer[pos++] = (byte) (b);
    }
@Test(expected = NullPointerException.class)
    public void testWrite_whenBufferIsNull() {
        out.write(null, 0, 0);
    }