@Test public void testClose_01() throws IOException { byte[] data = "Random String".getBytes(); InputStream input = new ByteArrayInputStream(data); InputStream inputStream = Mockito.spy(input);; IOUtil.close(inputStream); Mockito.verify(inputStream, times(1)).close(); }
public static void close(Closeable... closeables) { for (Closeable c : closeables) { if (c != null) { try { c.close(); } catch (IOException e) { throw new RuntimeException(e); } } } }
IOUtil { public static void close(Closeable... closeables) { for (Closeable c : closeables) { if (c != null) { try { c.close(); } catch (IOException e) { throw new RuntimeException(e); } } } } }
IOUtil { public static void close(Closeable... closeables) { for (Closeable c : closeables) { if (c != null) { try { c.close(); } catch (IOException e) { throw new RuntimeException(e); } } } }  }
IOUtil { public static void close(Closeable... closeables) { for (Closeable c : closeables) { if (c != null) { try { c.close(); } catch (IOException e) { throw new RuntimeException(e); } } } }  static void close(Closeable... closeables); static void pipe(InputStream is, OutputStream out, int bufsize); static byte[] readAllBytes(InputStream is); static byte[] readAllBytes(InputStream is, int bufsize); }
IOUtil { public static void close(Closeable... closeables) { for (Closeable c : closeables) { if (c != null) { try { c.close(); } catch (IOException e) { throw new RuntimeException(e); } } } }  static void close(Closeable... closeables); static void pipe(InputStream is, OutputStream out, int bufsize); static byte[] readAllBytes(InputStream is); static byte[] readAllBytes(InputStream is, int bufsize);  }