KeySet implements Set<String> { @Override public boolean isEmpty() { return !request.getKeys().hasMoreElements(); } 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);  }
@SuppressWarnings("unchecked") @Test public void testIsEmpty() { Enumeration<String> keys = createMock(Enumeration.class); expect(extractor.getKeys()).andReturn(keys); expect(keys.hasMoreElements()).andReturn(true); replay(extractor, keys); assertFalse(entrySet.isEmpty()); verify(extractor, keys); }
@SuppressWarnings("unchecked") @Test public void testIsEmptyTrue() { Enumeration<String> keys = createMock(Enumeration.class); expect(extractor.getKeys()).andReturn(keys); expect(keys.hasMoreElements()).andReturn(false); replay(extractor, keys); assertTrue(entrySet.isEmpty()); verify(extractor, keys); }