AbstractIterator implements Iterator<T> { @Override public void remove() { throw new UnsupportedOperationException("removal not supported"); }  @Override boolean hasNext(); @Override T next(); @Override void remove(); T peek();  }
@Test public void testRemove() { final ListIterator<Object> iter = new ListIterator<Object>(Collections.emptyList()); assertThatThrownBy(iter::remove) .isInstanceOf(UnsupportedOperationException.class) .hasMessage("removal not supported"); }