### Question:
SmallSet extends AbstractSet<T> { @Override public Iterator<T> iterator() { return new IteratorImpl<>(element1, element2); } SmallSet();   SmallSet(final T element); private  SmallSet(final T element1, final T element2); @Override Iterator<T> iterator(); @Override int size();  }### Answer:
@Test public void testIterator_next_firstElement() { Iterator<Object> iterator = newSmallSet(ELEMENT1, ELEMENT2).iterator(); Object element = iterator.next(); assertEquals(ELEMENT1, element); assertTrue(iterator.hasNext()); }
@Test public void testIterator_next_secondElement() { Iterator<Object> iterator = newSmallSet(ELEMENT1, ELEMENT2).iterator(); iterator.next(); Object element = iterator.next(); assertEquals(ELEMENT2, element); assertFalse(iterator.hasNext()); }
@Test public void testIterator_next_noSuchElement() { Iterator<Object> iterator = newSmallSet(ELEMENT1, ELEMENT2).iterator(); iterator.next(); iterator.next(); Executable next = () -> iterator.next(); assertThrows(NoSuchElementException.class, next); }
@Test public void testIterator_remove() { Iterator<Object> iterator = newSmallSet(ELEMENT1, ELEMENT2).iterator(); iterator.next(); assertThrows(UnsupportedOperationException.class, () -> iterator.remove()); }