From a78060acf91e96715816cfa32f210c7b2a8d84b9 Mon Sep 17 00:00:00 2001 From: Rsl1122 Date: Sun, 4 Feb 2018 12:54:31 +0200 Subject: [PATCH] Fixed test flakiness caused by Settings finality. --- .../com/djrapitops/plan/system/BukkitSystemTest.java | 10 ++++++---- .../plan/system/BungeeBukkitConnectionTest.java | 3 ++- .../com/djrapitops/plan/system/BungeeSystemTest.java | 6 ++++++ 3 files changed, 14 insertions(+), 5 deletions(-) diff --git a/Plan/src/test/java/com/djrapitops/plan/system/BukkitSystemTest.java b/Plan/src/test/java/com/djrapitops/plan/system/BukkitSystemTest.java index 509bf6f25..bfa359cba 100644 --- a/Plan/src/test/java/com/djrapitops/plan/system/BukkitSystemTest.java +++ b/Plan/src/test/java/com/djrapitops/plan/system/BukkitSystemTest.java @@ -7,10 +7,7 @@ package com.djrapitops.plan.system; import com.djrapitops.plan.Plan; import com.djrapitops.plan.api.exceptions.EnableException; import com.djrapitops.plan.system.settings.Settings; -import org.junit.After; -import org.junit.BeforeClass; -import org.junit.ClassRule; -import org.junit.Test; +import org.junit.*; import org.junit.rules.TemporaryFolder; import org.junit.runner.RunWith; import org.mockito.junit.MockitoJUnitRunner; @@ -41,6 +38,11 @@ public class BukkitSystemTest { planMock = mockUtil.getPlanMock(); } + @Before + public void setUp() { + Teardown.resetSettingsTempValues(); + } + @After public void tearDown() { if (bukkitSystem != null) { diff --git a/Plan/src/test/java/com/djrapitops/plan/system/BungeeBukkitConnectionTest.java b/Plan/src/test/java/com/djrapitops/plan/system/BungeeBukkitConnectionTest.java index 1d95a57ec..8f5cc0e91 100644 --- a/Plan/src/test/java/com/djrapitops/plan/system/BungeeBukkitConnectionTest.java +++ b/Plan/src/test/java/com/djrapitops/plan/system/BungeeBukkitConnectionTest.java @@ -27,7 +27,7 @@ import java.util.UUID; /** * @author Rsl1122 */ -@RunWith(MockitoJUnitRunner.class) +@RunWith(MockitoJUnitRunner.Silent.class) public class BungeeBukkitConnectionTest { @ClassRule @@ -65,6 +65,7 @@ public class BungeeBukkitConnectionTest { @Before public void setUp() { + Teardown.resetSettingsTempValues(); Settings.DEBUG.setTemporaryValue("console"); Settings.DEV_MODE.setTemporaryValue(true); } diff --git a/Plan/src/test/java/com/djrapitops/plan/system/BungeeSystemTest.java b/Plan/src/test/java/com/djrapitops/plan/system/BungeeSystemTest.java index a7e1916dd..384802906 100644 --- a/Plan/src/test/java/com/djrapitops/plan/system/BungeeSystemTest.java +++ b/Plan/src/test/java/com/djrapitops/plan/system/BungeeSystemTest.java @@ -42,6 +42,12 @@ public class BungeeSystemTest { planMock = mockUtil.getPlanMock(); } + + @Before + public void setUp() { + Teardown.resetSettingsTempValues(); + } + @After public void tearDown() { if (bungeeSystem != null) {