From 3b157b67c3fb56d26ad800fe3da38386c88db276 Mon Sep 17 00:00:00 2001 From: Kenzie Togami Date: Mon, 15 Jul 2019 16:10:50 -0700 Subject: [PATCH] Move Bukkit to JUnit 5 --- .../sk89q/wepif/DinnerPermsResolverTest.java | 30 +++++++++---------- .../worldedit/bukkit/BukkitWorldTest.java | 7 +++-- 2 files changed, 19 insertions(+), 18 deletions(-) diff --git a/worldedit-bukkit/src/test/java/com/sk89q/wepif/DinnerPermsResolverTest.java b/worldedit-bukkit/src/test/java/com/sk89q/wepif/DinnerPermsResolverTest.java index e207e7b8d..37deab330 100644 --- a/worldedit-bukkit/src/test/java/com/sk89q/wepif/DinnerPermsResolverTest.java +++ b/worldedit-bukkit/src/test/java/com/sk89q/wepif/DinnerPermsResolverTest.java @@ -19,26 +19,26 @@ package com.sk89q.wepif; -import static org.junit.Assert.assertFalse; -import static org.junit.Assert.assertTrue; -import static org.mockito.Mockito.mock; -import static org.mockito.Mockito.when; - import org.bukkit.Server; import org.bukkit.plugin.PluginManager; -import org.junit.Before; -import org.junit.Test; +import org.junit.jupiter.api.BeforeEach; +import org.junit.jupiter.api.Test; + +import static org.junit.jupiter.api.Assertions.assertFalse; +import static org.junit.jupiter.api.Assertions.assertTrue; +import static org.mockito.Mockito.mock; +import static org.mockito.Mockito.when; public class DinnerPermsResolverTest { private DinnerPermsResolver resolver; - @Before + @BeforeEach public void setUp() { Server server = mock(Server.class); when(server.getPluginManager()).thenReturn(mock(PluginManager.class)); resolver = new DinnerPermsResolver(server); } - + @Test public void testBasicResolving() { final TestOfflinePermissible permissible = new TestOfflinePermissible(); @@ -49,7 +49,7 @@ public class DinnerPermsResolverTest { assertFalse(resolver.hasPermission(permissible, "completely.unrelated")); permissible.clearPermissions(); } - + @Test public void testBasicWildcardResolution() { final TestOfflinePermissible permissible = new TestOfflinePermissible(); @@ -59,7 +59,7 @@ public class DinnerPermsResolverTest { assertTrue(resolver.hasPermission(permissible, "commandbook.spawnmob.spider.skeleton")); permissible.clearPermissions(); } - + @Test public void testNegatingNodes() { final TestOfflinePermissible permissible = new TestOfflinePermissible(); @@ -67,16 +67,16 @@ public class DinnerPermsResolverTest { permissible.setPermission("commandbook.cuteasianboys", false); permissible.setPermission("commandbook.warp.*", false); permissible.setPermission("commandbook.warp.create", true); - + assertTrue(resolver.hasPermission(permissible, "commandbook.motd")); assertFalse(resolver.hasPermission(permissible, "commandbook.cuteasianboys")); assertFalse(resolver.hasPermission(permissible, "commandbook.warp.remove")); assertTrue(resolver.hasPermission(permissible, "commandbook.warp.create")); - + permissible.clearPermissions(); } - - + + @Test public void testInGroup() { final TestOfflinePermissible permissible = new TestOfflinePermissible(); diff --git a/worldedit-bukkit/src/test/java/com/sk89q/worldedit/bukkit/BukkitWorldTest.java b/worldedit-bukkit/src/test/java/com/sk89q/worldedit/bukkit/BukkitWorldTest.java index e6776cf8c..8851fb926 100644 --- a/worldedit-bukkit/src/test/java/com/sk89q/worldedit/bukkit/BukkitWorldTest.java +++ b/worldedit-bukkit/src/test/java/com/sk89q/worldedit/bukkit/BukkitWorldTest.java @@ -20,15 +20,16 @@ package com.sk89q.worldedit.bukkit; import com.sk89q.worldedit.util.TreeGenerator; -import org.junit.Assert; -import org.junit.Test; +import org.junit.jupiter.api.Test; + +import static org.junit.jupiter.api.Assertions.assertNotNull; public class BukkitWorldTest { @Test public void testTreeTypeMapping() { for (TreeGenerator.TreeType type : TreeGenerator.TreeType.values()) { - Assert.assertNotNull("No mapping for: " + type, BukkitWorld.toBukkitTreeType(type)); + assertNotNull(BukkitWorld.toBukkitTreeType(type), "No mapping for: " + type); } }