### Question:
ZipEntryInputStream extends InputStream { @Override public void close() throws IOException { zipInputStream.closeEntry(); } ZipEntryInputStream(ZipInputStream zipInputStream); @Override int available(); @Override void close(); @Override 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 void reset(); @Override long skip(long n);  }### Answer:
@Test public void closeShouldDelegateToZipInputStreamCloseEntry() throws IOException { zipEntryInputStream.close(); Mockito.verify(zipInputStream, Mockito.times(1)).closeEntry(); Mockito.verifyNoMoreInteractions(zipInputStream); }
@Test public void closeShouldPassOnExceptionThrownByZipInputStreamAvailable() throws IOException { IOException ioException = new IOException("Some ZipInputStream exception"); Mockito.doThrow(ioException).when(zipInputStream).closeEntry(); try { zipEntryInputStream.close(); Assert.fail("Should not reach here"); } catch (IOException exception) { Assert.assertEquals(ioException.getMessage(), exception.getMessage()); } Mockito.verify(zipInputStream, Mockito.times(1)).closeEntry(); Mockito.verifyNoMoreInteractions(zipInputStream); }