RemovableKeySet extends KeySet { @SuppressWarnings("unchecked") @Override public boolean removeAll(Collection<?> c) { Collection<String> realCollection = (Collection<String>) c; boolean retValue = false; for (String entry : realCollection) { retValue |= remove(entry); } return retValue; } 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 testRemoveAll() { expect(extractor.getValue("one")).andReturn(1); expect(extractor.getValue("two")).andReturn(2); extractor.removeValue("one"); extractor.removeValue("two"); replay(extractor); List<String> coll = new ArrayList<String>(); coll.add("one"); coll.add("two"); assertTrue(entrySet.removeAll(coll)); verify(extractor); }