### Question:
ReadableBuffers { public static InputStream openStream(ReadableBuffer buffer, boolean owner) { return new BufferInputStream(owner ? buffer : ignoreClose(buffer)); } private  ReadableBuffers(); static ReadableBuffer empty(); static ReadableBuffer wrap(byte[] bytes); static ReadableBuffer wrap(byte[] bytes, int offset, int length); static ReadableBuffer wrap(ByteBuffer bytes); static byte[] readArray(ReadableBuffer buffer); static String readAsString(ReadableBuffer buffer, Charset charset); static String readAsStringUtf8(ReadableBuffer buffer); static InputStream openStream(ReadableBuffer buffer, boolean owner); static ReadableBuffer ignoreClose(ReadableBuffer buffer);  }### Answer:
@Test public void openStream_ignoresClose() throws Exception { ReadableBuffer buffer = mock(ReadableBuffer.class); InputStream stream = ReadableBuffers.openStream(buffer, false); stream.close(); verify(buffer, never()).close(); }
@Test public void bufferInputStream_close_closesBuffer() throws Exception { ReadableBuffer buffer = mock(ReadableBuffer.class); InputStream inputStream = ReadableBuffers.openStream(buffer, true); inputStream.close(); verify(buffer, times(1)).close(); }