### Question:
UncloseableInputStream extends InputStream { @Override public int read() throws IOException { return myWrappedStream.read(); } UncloseableInputStream(@NonNull InputStream wrappedStream); @Override int available(); InputStream getWrappedStream(); @Override synchronized void mark(int readlimit); @Override boolean markSupported(); @Override int read(); @Override int read(byte[] b); @Override int read(byte[] b, int off, int len); @Override synchronized void reset(); @Override long skip(long n);  }### Answer:
@Test public void testRead() throws IOException { final boolean[] called = new boolean[1]; InputStream wrapped = new ByteArrayInputStream(new byte[0]) { @Override public synchronized int read() { called[0] = true; return super.read(); } }; new UncloseableInputStream(wrapped).read(); Assert.assertTrue(called[0]); }
@Test public void testReadByteArray() throws IOException { final boolean[] called = new boolean[1]; InputStream wrapped = new ByteArrayInputStream(new byte[0]) { @Override public int read(byte[] b) throws IOException { called[0] = true; return super.read(b); } }; new UncloseableInputStream(wrapped).read(new byte[0]); Assert.assertTrue(called[0]); }
@Test public void testReadByteArrayIntInt() throws IOException { final boolean[] called = new boolean[1]; InputStream wrapped = new ByteArrayInputStream(new byte[0]) { @Override public synchronized int read(byte[] b, int off, int len) { called[0] = true; return super.read(b, off, len); } }; new UncloseableInputStream(wrapped).read(new byte[0], 0, 0); Assert.assertTrue(called[0]); }