Hw to mock the following specially the listfiles()
method?
File folder = new File(folderPath);
for (File fileEntry : folder.listFiles()) {
try {
if (StringUtils.isBlank(fileEntry.toString())) {
throw new ConfigurationException("Sfile must be set");
}
String json = resourceReader.readResource(fileEntry.toString());
try {
config.add(parser.parseJson(json));
} catch (Exception e) {
LOG.error("Error in parsing json");
}
} catch (Exception e) {
throw new ServiceException("Could not parse sfrom the file: " +
fileEntry.getName(), e);
}
}