IOUtils { public static void closeQuietly(final InputStream inputStream){ try{ if (inputStream != null){ inputStream.close(); } }catch (Exception e){ } }  static String inputStreamAsString(final InputStream inputStream, String charEncoding); static void closeQuietly(final InputStream inputStream); static final String SYSTEM_CHAR_SET; }
@Test public void testCloseQuietly() throws Exception { InputStream inputStream = mock(InputStream.class); Mockito.doThrow(new IOException("An IO Exception")).when(inputStream).close(); IOUtils.closeQuietly(inputStream); verify(inputStream).close(); }