@Test public void closeQuietly_autoCloseableThrows_doNotPropagate() throws Exception { AutoCloseable closeable = mock(AutoCloseable.class); doThrow(IllegalStateException.class).when(closeable).close(); catchException(() -> AutoCloseables.closeQuietly(closeable)); assertThat("Expected no exception to be thrown", caughtException(), nullValue()); }
public static <T> void closeQuietly(@Nullable final Iterable<T> iterable) { if (iterable != null) { iterable.forEach(AutoCloseables::closeQuietly); } }
AutoCloseables { public static <T> void closeQuietly(@Nullable final Iterable<T> iterable) { if (iterable != null) { iterable.forEach(AutoCloseables::closeQuietly); } } }
AutoCloseables { public static <T> void closeQuietly(@Nullable final Iterable<T> iterable) { if (iterable != null) { iterable.forEach(AutoCloseables::closeQuietly); } } private  AutoCloseables(); }
AutoCloseables { public static <T> void closeQuietly(@Nullable final Iterable<T> iterable) { if (iterable != null) { iterable.forEach(AutoCloseables::closeQuietly); } } private  AutoCloseables(); static void closeQuietly(@Nullable final Iterable<T> iterable); static void closeQuietly(@Nullable final Object object); static void closeQuietly(@Nullable final AutoCloseable closeable); }
AutoCloseables { public static <T> void closeQuietly(@Nullable final Iterable<T> iterable) { if (iterable != null) { iterable.forEach(AutoCloseables::closeQuietly); } } private  AutoCloseables(); static void closeQuietly(@Nullable final Iterable<T> iterable); static void closeQuietly(@Nullable final Object object); static void closeQuietly(@Nullable final AutoCloseable closeable);  }