I have a method in my utilities:
public void createDirectories(final Path root, final Scaffolding scaffolding) throws FileAlreadyExistsException {
if (Files.exists(root)) {
throw new FileAlreadyExistsException("Root directory " + root.toString() + " already exists.");
} else {
Files.createDirectories(root);
// Create directories from the scaffolding object
}
}
I want to mock Files so I can test to make sure Files.createDirectories with the expected fields are called or not.
Can I do this with Mockito? Or do I need to actually create the directories and check for their existence in some tmp folder?