### Question:
MapBackedSet extends AbstractSet<E> implements Serializable { @Override public boolean add(E o) { return map.put(o, Boolean.TRUE) == null; } 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 testAdd() { Map map = createStrictMock(Map.class); expect(map.put("key", true)).andReturn(null); expect(map.put("key", true)).andReturn(true); replay(map); assertTrue(new MapBackedSet(map).add("key")); assertFalse(new MapBackedSet(map).add("key")); verify(map); }