Hello StackOverflow Community,
I have this JUnit Tests that need to run a Server with the command mvn exec:java, and I need to delete the contents of a directory before the tests are executed. Otherwise, the JUnit test will fail. Is there any way I can include these steps into my source code?
Ejay
You should use JUnit’s @BeforeClass notation which will be called before the first test starts to clean up the target directory. You should also use the commons-io library avoid unnecessary coding.