@Test public void testInitializeWithInvalidClassListShouldThrowClassFormatException() throws IOException { List<String> list = new ArrayList<>(); list.add(FOLDER_NAME); Collection<File> filesInFolder = new ArrayList<>(); File invalidClass = new File("InvalidClass.class"); filesInFolder.add(invalidClass); given(fileUtils.listFiles(FOLDER)).willReturn(filesInFolder); given(javaClassFactory.createJavaClass(invalidClass)).willThrow(new ClassFormatException()); Whitebox.setInternalState(underTest, "logger", logger); underTest.initialize(list); verify(logger).info(Mockito.anyString(), Mockito.any(ClassFormatException.class)); }
public void initialize(final List<String> everyPathAsString) { for (String resourcePath : everyPathAsString) { addClassNamesFromFolder(resourcePath); } }
ClassNameMapper { public void initialize(final List<String> everyPathAsString) { for (String resourcePath : everyPathAsString) { addClassNamesFromFolder(resourcePath); } } }
ClassNameMapper { public void initialize(final List<String> everyPathAsString) { for (String resourcePath : everyPathAsString) { addClassNamesFromFolder(resourcePath); } } ClassNameMapper(); }
ClassNameMapper { public void initialize(final List<String> everyPathAsString) { for (String resourcePath : everyPathAsString) { addClassNamesFromFolder(resourcePath); } } ClassNameMapper(); void initialize(final List<String> everyPathAsString); void put(final String simpleClassName, final String fullClassName); String get(final String simpleClassName); }
ClassNameMapper { public void initialize(final List<String> everyPathAsString) { for (String resourcePath : everyPathAsString) { addClassNamesFromFolder(resourcePath); } } ClassNameMapper(); void initialize(final List<String> everyPathAsString); void put(final String simpleClassName, final String fullClassName); String get(final String simpleClassName);  }