SilentIteration extends IterationWrapper<T, E> { @Override public boolean hasNext() throws E { try { return super.hasNext(); } catch (Exception e) { if (logger.isTraceEnabled()) { logger.trace("Suppressed error in SILENT iteration: " + e.getMessage(), e); } } return false; } SilentIteration(CloseableIteration<T, E> iter); @Override boolean hasNext(); @Override T next();  }
@Test public void hasNextSwallowsException() throws Exception { when(delegate.hasNext()).thenThrow(new RuntimeException()); assertThat(subject.hasNext()).isFalse(); }