### Question:
UncloseableInputStream extends InputStream { @Override public int available() throws IOException { return myWrappedStream.available(); } 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:
@SuppressWarnings("resource") @Test public void testAvailable() throws IOException { final boolean[] called = new boolean[1]; InputStream wrapped = new ByteArrayInputStream(new byte[0]) { @Override public synchronized int available() { called[0] = true; return super.available(); } }; new UncloseableInputStream(wrapped).available(); Assert.assertTrue(called[0]); }