KeySet implements Set<String> { @SuppressWarnings("unchecked") @Override public boolean containsAll(Collection<?> c) { Collection<String> realCollection = (Collection<String>) c; for (String key : realCollection) { if (request.getValue(key(key)) == null) { return false; } } return true; } KeySet(HasKeys<?> request); @Override boolean add(String e); @Override boolean addAll(Collection<? extends String> c); @Override void clear(); @Override boolean contains(Object o); @SuppressWarnings("unchecked") @Override boolean containsAll(Collection<?> c); @Override boolean isEmpty(); @Override Iterator<String> iterator(); @Override boolean remove(Object o); @Override boolean removeAll(Collection<?> c); @Override boolean retainAll(Collection<?> c); @Override int size(); @Override Object[] toArray(); @Override T[] toArray(T[] a);  }
@Test public void testContainsAll() { expect(extractor.getValue("one")).andReturn(1); expect(extractor.getValue("two")).andReturn(1); replay(extractor); List<String> coll = new ArrayList<String>(); coll.add("one"); coll.add("two"); assertTrue(entrySet.containsAll(coll)); verify(extractor); }