SequenceCleaner { public void cleanTheExpiredSequences(final Map<String, SequenceDescriptor> descriptors) { for (SequenceDescriptor descriptor : descriptors.values()) { cleanSequences(descriptor); } }  void cleanTheExpiredSequences(final Map<String, SequenceDescriptor> descriptors);  }
@Test public void testCleanTheExpiredSequences() { descriptors.put("TestKey1", descriptor); List<WilmaSequence> sequences = new ArrayList<>(); sequences.add(firstSequence); sequences.add(secondSequence); given(descriptor.getSequencesInCollection()).willReturn(sequences); given(firstSequence.isExpired(new Timestamp(1000L))).willReturn(false); given(secondSequence.isExpired(new Timestamp(1000L))).willReturn(true); underTest.cleanTheExpiredSequences(descriptors); Assert.assertEquals(sequences.size(), 1); }