### Question:
FilteredIterator implements Iterator<T> { public void remove() { if (canRemove) { canRemove = false; iterator.remove(); } else { throw new IllegalStateException(); } } FilteredIterator(Iterator<? extends T> iterator, Predicate<? super T> predicate); boolean hasNext(); T next(); void remove(); @Override boolean equals(Object obj); @Override int hashCode(); @Override String toString(); @SuppressWarnings("unchecked") static Iterator<T> filter(Iterator<? extends T> iter, Predicate<? super T> pred);  }### Answer:
@Test(expected = IllegalStateException.class) public void testRemoveBeforeNext() { Iterator<Integer> testing = new FilteredIterator<Integer>(list.iterator(), isEven); testing.remove(); }