Collector { void removeProvider(String provider) { if (provider == null) { throw new NullPointerException("provider"); } logger.note(LogLocation.LOG_FILE, "Removing " + provider); removed.add(provider); for (Service service : services.values()) { service.removeProvider(provider); } } Collector(Initializer initializer, Logger logger); @Override String toString();  }
@Test(expected=NullPointerException.class) public void testRemoveProviderNull() { collector.removeProvider(null); }
@Test public void testRemoveProviderWhenEmpty() { collector.removeProvider("provider1"); Assert.assertEquals(1, logger.records().size()); Assert.assertEquals("Removing provider1\n", logger.getFileContent()); }