### Question:
TempbanManager implements SettingsDependent, HasCleanup { @Override public void performCleanup() { for (TimedCounter<String> countsByIp : ipLoginFailureCounts.values()) { countsByIp.removeExpiredEntries(); } ipLoginFailureCounts.entrySet().removeIf(e -> e.getValue().isEmpty()); } @Inject  TempbanManager(BukkitService bukkitService, Messages messages, Settings settings); void increaseCount(String address, String name); void resetCount(String address, String name); boolean shouldTempban(String address); void tempbanPlayer(final Player player); @Override void reload(Settings settings); @Override void performCleanup();  }### Answer:
@Test public void shouldPerformCleanup() { Map<String, TimedCounter<String>> counts = new HashMap<>(); TimedCounter<String> counter1 = mockCounter(); given(counter1.isEmpty()).willReturn(true); counts.put("11.11.11.11", counter1); TimedCounter<String> counter2 = mockCounter(); given(counter2.isEmpty()).willReturn(false); counts.put("33.33.33.33", counter2); TempbanManager manager = new TempbanManager(bukkitService, messages, mockSettings(3, 10, "")); ReflectionTestUtils.setField(TempbanManager.class, manager, "ipLoginFailureCounts", counts); manager.performCleanup(); verify(counter1).removeExpiredEntries(); verify(counter2).removeExpiredEntries(); assertThat(counts.keySet(), contains("33.33.33.33")); }