mirror of
https://github.com/BentoBoxWorld/Challenges.git
synced 2025-02-06 15:32:04 +01:00
Clean up databbase_backup after tests.
This commit is contained in:
parent
edc7f5f9a6
commit
c26b27afa1
@ -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 {
|
||||||
|
@ -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);
|
||||||
|
Loading…
Reference in New Issue
Block a user