@Test public void testRemoveAllProducers() throws Exception { Responsible base = RESPONSIBLE_FACTORY.getNext(); Responsible second = RESPONSIBLE_FACTORY.getNext(); Responsible third = RESPONSIBLE_FACTORY.getNext(); Collection<Responsible> toAdd = new HashSet<>(); toAdd.add(base); toAdd.add(second); toAdd.add(third); Collection<Responsible> toRemove = new HashSet<>(); toRemove.add(second); toRemove.add(third); producers.addAll(toAdd); entity.addAllProducers(toAdd); producers.removeAll(toRemove); entity.removeAllProducers(toRemove); assertEquals(producers, entity.getProducers()); }