diff --git a/Plan/plugin/src/test/java/com/djrapitops/plan/system/database/databases/sql/PatchRegression452Test.java b/Plan/plugin/src/test/java/com/djrapitops/plan/system/database/databases/sql/PatchRegression452Test.java index 575b187a9..dd2e590ec 100644 --- a/Plan/plugin/src/test/java/com/djrapitops/plan/system/database/databases/sql/PatchRegression452Test.java +++ b/Plan/plugin/src/test/java/com/djrapitops/plan/system/database/databases/sql/PatchRegression452Test.java @@ -1,7 +1,10 @@ package com.djrapitops.plan.system.database.databases.sql; +import com.djrapitops.plan.system.database.databases.sql.patches.Patch; import utilities.TestConstants; +import static org.junit.Assert.assertTrue; + public abstract class PatchRegression452Test { String insertServer = "INSERT INTO plan_servers (uuid) VALUES ('" + TestConstants.SERVER_UUID + "')"; @@ -28,4 +31,10 @@ public abstract class PatchRegression452Test { underTest.execute(insertWorld); underTest.execute(insertWorldTimes); } + + protected void assertPatchesHaveBeenApplied(SQLDB underTest) { + for (Patch patch : underTest.patches()) { + assertTrue("Patch " + patch.getClass().getSimpleName() + " was not applied properly.", patch.hasBeenApplied()); + } + } } diff --git a/Plan/plugin/src/test/java/com/djrapitops/plan/system/database/databases/sql/PatchRegressionH2452Test.java b/Plan/plugin/src/test/java/com/djrapitops/plan/system/database/databases/sql/PatchRegressionH2452Test.java index 149350676..81d7c37bf 100644 --- a/Plan/plugin/src/test/java/com/djrapitops/plan/system/database/databases/sql/PatchRegressionH2452Test.java +++ b/Plan/plugin/src/test/java/com/djrapitops/plan/system/database/databases/sql/PatchRegressionH2452Test.java @@ -100,8 +100,13 @@ public class PatchRegressionH2452Test extends PatchRegression452Test { // Patching might fail due to exception. patchTask.run(); + assertPatchesHaveBeenApplied(underTest); + // Make sure that a fetch works. ServerContainer server = underTest.fetch().getServerContainer(TestConstants.SERVER_UUID); OptionalAssert.equals(1, server.getValue(ServerKeys.PLAYER_KILL_COUNT)); + + // Make sure no foreign key checks fail on removal + underTest.remove().everything(); } } diff --git a/Plan/plugin/src/test/java/com/djrapitops/plan/system/database/databases/sql/PatchRegressionMySQL452Test.java b/Plan/plugin/src/test/java/com/djrapitops/plan/system/database/databases/sql/PatchRegressionMySQL452Test.java index ab9e20180..ec893f5bb 100644 --- a/Plan/plugin/src/test/java/com/djrapitops/plan/system/database/databases/sql/PatchRegressionMySQL452Test.java +++ b/Plan/plugin/src/test/java/com/djrapitops/plan/system/database/databases/sql/PatchRegressionMySQL452Test.java @@ -124,8 +124,13 @@ public class PatchRegressionMySQL452Test extends PatchRegression452Test { // Patching might fail due to exception. patchTask.run(); + assertPatchesHaveBeenApplied(underTest); + // Make sure that a fetch works. ServerContainer server = underTest.fetch().getServerContainer(TestConstants.SERVER_UUID); OptionalAssert.equals(1, server.getValue(ServerKeys.PLAYER_KILL_COUNT)); + + // Make sure no foreign key checks fail on removal + underTest.remove().everything(); } } diff --git a/Plan/plugin/src/test/java/com/djrapitops/plan/system/database/databases/sql/PatchRegressionSQLite452Test.java b/Plan/plugin/src/test/java/com/djrapitops/plan/system/database/databases/sql/PatchRegressionSQLite452Test.java index e058173ba..5ce75a140 100644 --- a/Plan/plugin/src/test/java/com/djrapitops/plan/system/database/databases/sql/PatchRegressionSQLite452Test.java +++ b/Plan/plugin/src/test/java/com/djrapitops/plan/system/database/databases/sql/PatchRegressionSQLite452Test.java @@ -93,8 +93,13 @@ public class PatchRegressionSQLite452Test extends PatchRegression452Test { // Patching might fail due to exception. patchTask.run(); + assertPatchesHaveBeenApplied(underTest); + // Make sure that a fetch works. ServerContainer server = underTest.fetch().getServerContainer(TestConstants.SERVER_UUID); OptionalAssert.equals(1, server.getValue(ServerKeys.PLAYER_KILL_COUNT)); + + // Make sure no foreign key checks fail on removal + underTest.remove().everything(); } }