Service { void fromProviderNamesList(String input) { if (input == null) { throw new NullPointerException("input"); } String[] lines = input.split("\\n"); for (String line : lines) { String[] content = line.split("#"); if (content.length > 0) { String trimmed = content[0].trim(); if (trimmed.length() > 0) { addProvider(trimmed); } } } } Service(Logger logger, String name); @Override String toString();  }
@Test(expected=NullPointerException.class) public void testFromProviderNameListNull() { new Service(logger, "service1").fromProviderNamesList(null); }