diff --git a/src/main/java/net/silthus/template/TemplatePlugin.java b/src/main/java/net/silthus/template/TemplatePlugin.java index 48843c4..0e8cebd 100644 --- a/src/main/java/net/silthus/template/TemplatePlugin.java +++ b/src/main/java/net/silthus/template/TemplatePlugin.java @@ -31,7 +31,6 @@ public TemplatePlugin( @Override public void onEnable() { - saveDefaultConfig(); getServer().getPluginManager().registerEvents(this, this); diff --git a/src/main/resources/config.yml b/src/main/resources/config.yml index c8f1922..293cbf8 100644 --- a/src/main/resources/config.yml +++ b/src/main/resources/config.yml @@ -1 +1 @@ -# add your default configuration properties here \ No newline at end of file +# add your configuration properties here \ No newline at end of file diff --git a/src/test/java/net/silthus/template/TemplatePluginTests.java b/src/test/java/net/silthus/template/TemplatePluginTests.java index 693d5e4..faf64d1 100644 --- a/src/test/java/net/silthus/template/TemplatePluginTests.java +++ b/src/test/java/net/silthus/template/TemplatePluginTests.java @@ -1,32 +1,14 @@ package net.silthus.template; -import be.seeseemelk.mockbukkit.MockBukkit; -import be.seeseemelk.mockbukkit.ServerMock; import org.bukkit.event.player.PlayerJoinEvent; -import org.junit.jupiter.api.AfterEach; -import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Test; -public class TemplatePluginTests { - - private ServerMock server; - - @BeforeEach - public void setUp() { - server = MockBukkit.mock(); - MockBukkit.load(TemplatePlugin.class); - } +public class TemplatePluginTests extends TestBase { @Test public void shouldFirePlayerJoinEvent() { - server.addPlayer(); server.getPluginManager().assertEventFired(PlayerJoinEvent.class); } - - @AfterEach - public void tearDown() { - MockBukkit.unmock(); - } } diff --git a/src/test/java/net/silthus/template/TestBase.java b/src/test/java/net/silthus/template/TestBase.java new file mode 100644 index 0000000..73e9b19 --- /dev/null +++ b/src/test/java/net/silthus/template/TestBase.java @@ -0,0 +1,23 @@ +package net.silthus.template; + +import be.seeseemelk.mockbukkit.MockBukkit; +import be.seeseemelk.mockbukkit.ServerMock; +import org.junit.jupiter.api.AfterEach; +import org.junit.jupiter.api.BeforeEach; + +public abstract class TestBase { + + protected ServerMock server; + protected TemplatePlugin plugin; + + @BeforeEach + public void setUp() { + server = MockBukkit.mock(); + plugin = MockBukkit.load(TemplatePlugin.class); + } + + @AfterEach + public void tearDown() { + MockBukkit.unmock(); + } +}