Skip to content

Commit

Permalink
Clean up databbase_backup after tests.
Browse files Browse the repository at this point in the history
  • Loading branch information
tastybento committed Mar 7, 2021
1 parent edc7f5f commit c26b27a
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -219,7 +219,7 @@ public void tearDown() throws Exception {
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 {
Expand Down
14 changes: 10 additions & 4 deletions src/test/java/world/bentobox/challenges/ChallengesManagerTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -196,10 +196,16 @@ public void setUp() throws Exception {
*/
@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);
Expand Down

0 comments on commit c26b27a

Please sign in to comment.