From 5de5ea25a88ac52391f1663005ad28cc0c126324 Mon Sep 17 00:00:00 2001 From: Fuzzlemann Date: Tue, 22 Aug 2017 20:27:01 +0200 Subject: [PATCH] Fix Test Suite --- .../java/com/djrapitops/plan/database/DatabaseTest.java | 6 +++++- Plan/test/test/java/utils/DBTestSuite.java | 5 +++-- 2 files changed, 8 insertions(+), 3 deletions(-) diff --git a/Plan/test/test/java/main/java/com/djrapitops/plan/database/DatabaseTest.java b/Plan/test/test/java/main/java/com/djrapitops/plan/database/DatabaseTest.java index d45ad9b5b..9efafb711 100644 --- a/Plan/test/test/java/main/java/com/djrapitops/plan/database/DatabaseTest.java +++ b/Plan/test/test/java/main/java/com/djrapitops/plan/database/DatabaseTest.java @@ -213,7 +213,6 @@ public class DatabaseTest { public void testTPSSaving() throws SQLException { db.init(); TPSTable tpsTable = db.getTpsTable(); - List expected = new ArrayList<>(); Random r = new Random(); OperatingSystemMXBean operatingSystemMXBean = ManagementFactory.getOperatingSystemMXBean(); @@ -224,12 +223,17 @@ public class DatabaseTest { final int entityCount = 6123; final int chunksLoaded = 2134; + List expected = new ArrayList<>(); + expected.add(new TPS(r.nextLong(), r.nextDouble(), r.nextInt(100000000), averageCPUUsage, usedMemory, entityCount, chunksLoaded)); expected.add(new TPS(r.nextLong(), r.nextDouble(), r.nextInt(100000000), averageCPUUsage, usedMemory, entityCount, chunksLoaded)); expected.add(new TPS(r.nextLong(), r.nextDouble(), r.nextInt(100000000), averageCPUUsage, usedMemory, entityCount, chunksLoaded)); expected.add(new TPS(r.nextLong(), r.nextDouble(), r.nextInt(100000000), averageCPUUsage, usedMemory, entityCount, chunksLoaded)); + List tpsDataOld = tpsTable.getTPSData(); tpsTable.saveTPSData(expected); + + expected.addAll(0, tpsDataOld); assertEquals(expected, tpsTable.getTPSData()); } } diff --git a/Plan/test/test/java/utils/DBTestSuite.java b/Plan/test/test/java/utils/DBTestSuite.java index 1fb12b1c6..a8fc5e31e 100644 --- a/Plan/test/test/java/utils/DBTestSuite.java +++ b/Plan/test/test/java/utils/DBTestSuite.java @@ -4,6 +4,7 @@ */ package test.java.utils; +import org.junit.AfterClass; import org.junit.BeforeClass; import org.junit.runner.RunWith; import org.junit.runners.Suite; @@ -24,7 +25,7 @@ public class DBTestSuite { clean(true); } - @BeforeClass + @AfterClass public static void tearDown() throws IOException { clean(false); } @@ -37,7 +38,7 @@ public class DBTestSuite { } for (File f : testFolder.listFiles()) { - if (dbOnly && !f.getName().endsWith(".db")) { + if (dbOnly && !f.getName().contains(".db")) { continue; }