### Question:
ServiceLocator { protected List<String> readServiceClassNames(URL url) { try (InputStream stream = url.openStream()) { return readServiceClassNames(stream); } catch (IOException e) { logReadServiceClassNamesFailure(e); } return Collections.emptyList(); } protected  ServiceLocator(ClassLoader classLoader); static ServiceLocator getInstance(ClassLoader classLoader); static ServiceLocator getInstance(); MarkupLanguage getMarkupLanguage(final String languageName); Set<MarkupLanguage> getAllMarkupLanguages(); static void setImplementation(Class<? extends ServiceLocator> implementationClass);  }### Answer:
@Test public void readServicesFileNone() { List<String> names = locator.readServiceClassNames(createInput("")); assertNotNull(names); assertTrue(names.isEmpty()); }
@Test public void readServicesFileCommentsAndEmptyLinesOnly() { List<String> names = locator.readServiceClassNames(createInput("#" + Object.class.getName() + "\n\n\n\n#last")); assertNotNull(names); assertTrue(names.isEmpty()); }
@Test public void readServicesFile() { List<String> names = locator.readServiceClassNames( createInput(Object.class.getName() + "\n" + String.class.getName() + " # trailing comment")); assertNotNull(names); assertEquals(2, names.size()); assertEquals(Object.class.getName(), names.get(0)); assertEquals(String.class.getName(), names.get(1)); }