RemovableKeySet extends KeySet { @Override public boolean remove(Object o) { String skey = key(o); Object previous = request.getValue(skey); if (previous != null) { request.removeValue(skey); return true; } return false; } RemovableKeySet(HasRemovableKeys<?> request); @Override boolean remove(Object o); @SuppressWarnings("unchecked") @Override boolean removeAll(Collection<?> c); @SuppressWarnings("unchecked") @Override boolean retainAll(Collection<?> c);  }
@Test public void testRemove() { expect(extractor.getValue("one")).andReturn(1); extractor.removeValue("one"); replay(extractor); assertTrue(entrySet.remove("one")); verify(extractor); }
@Test public void testRemoveNoEffect() { expect(extractor.getValue("one")).andReturn(null); replay(extractor); assertFalse(entrySet.remove("one")); verify(extractor); }