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();
deleteAll(new File("addons"));
deleteAll(new File("database"));
deleteAll(new File("database_backup"));
}
private void deleteAll(File file) throws IOException {

View File

@ -196,10 +196,16 @@ public class ChallengesManagerTest {
*/
@After
public void tearDown() throws Exception {
// Clean up JSON database
// Clean up file system
if (database.exists()) {
Files.walk(database.toPath())
new File("addon.jar").delete();
new File("config.yml").delete();
deleteAll(new File("addons"));
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())
.map(Path::toFile)
.forEach(File::delete);