I just want to write a JUnit test case that will just test whether my below code has successfully copied the directory to new directory.
File origPath = new File("/sourceDir/");
File newPath = new File("/destDir/");
try {
FileUtils.copyDirectory(origPath, newPath);
} catch (Throwable e) {
}
Please suggest, how I can write a JUnit test or mock to test the above code.
You need the TemporaryFolder Rule.
Then you create a new folder:
Then you call the copyDirectory-method:
And then you can check, whether the folder exists: