Clean up databbase_backup after tests.

This commit is contained in:
tastybento 2021-03-07 11:00:39 -08:00
parent edc7f5f9a6
commit c26b27afa1
2 changed files with 11 additions and 5 deletions

View File

@ -219,7 +219,7 @@ public class ChallengesAddonTest {
new File("config.yml").delete(); new File("config.yml").delete();
deleteAll(new File("addons")); deleteAll(new File("addons"));
deleteAll(new File("database")); deleteAll(new File("database"));
deleteAll(new File("database_backup"));
} }
private void deleteAll(File file) throws IOException { private void deleteAll(File file) throws IOException {

View File

@ -196,10 +196,16 @@ public class ChallengesManagerTest {
*/ */
@After @After
public void tearDown() throws Exception { public void tearDown() throws Exception {
// Clean up JSON database new File("addon.jar").delete();
// Clean up file system new File("config.yml").delete();
if (database.exists()) { deleteAll(new File("addons"));
Files.walk(database.toPath()) deleteAll(new File("database"));
deleteAll(new File("database_backup"));
}
private void deleteAll(File file) throws IOException {
if (file.exists()) {
Files.walk(file.toPath())
.sorted(Comparator.reverseOrder()) .sorted(Comparator.reverseOrder())
.map(Path::toFile) .map(Path::toFile)
.forEach(File::delete); .forEach(File::delete);