CacheCleaner { public void cleanCache() { getCacheFolderPath(); List<String> filePaths = pathProvider.getConfigPathsFromCache(cacheFolderPath); for (String filePath : filePaths) { File actualFile = fileFactory.createFile(filePath); actualFile.delete(); } }  void cleanCache();  }
@Test public void testCleanCache() { List<String> filePaths = new ArrayList<>(); filePaths.add("first"); filePaths.add("second"); given(pathProvider.getConfigPathsFromCache("test/path")).willReturn(filePaths); given(fileFactory.createFile("first")).willReturn(file); given(fileFactory.createFile("second")).willReturn(file); underTest.cleanCache(); verify(configurationAccess).setProperties(); verify(fileFactory).createFile("first"); verify(fileFactory).createFile("second"); }