### Question:
MapBackedSet extends AbstractSet<E> implements Serializable { @Override public Iterator<E> iterator() { return map.keySet().iterator(); } MapBackedSet(Map<E, Boolean> map); @Override int size(); @Override boolean contains(Object o); @Override boolean add(E o); @Override boolean remove(Object o); @Override void clear(); @Override Iterator<E> iterator();  }### Answer:
@Test @SuppressWarnings({ "unchecked", "rawtypes" }) public void testIterator() { Map map = createStrictMock(Map.class); Set keySet = createStrictMock(Set.class); Iterator keySetIterator = createStrictMock(Iterator.class); expect(map.keySet()).andReturn(keySet); expect(keySet.iterator()).andReturn(keySetIterator); replay(map); replay(keySet); replay(keySetIterator); assertSame(keySetIterator, new MapBackedSet(map).iterator()); verify(map); verify(keySet); verify(keySetIterator); }