diff --git a/wrappers/bukkit/src/test/java/it/fulminazzo/yagl/WrappersAdapterTest.java b/wrappers/bukkit/src/test/java/it/fulminazzo/yagl/WrappersAdapterTest.java index 1261793d..f6baba7d 100644 --- a/wrappers/bukkit/src/test/java/it/fulminazzo/yagl/WrappersAdapterTest.java +++ b/wrappers/bukkit/src/test/java/it/fulminazzo/yagl/WrappersAdapterTest.java @@ -47,6 +47,8 @@ protected void setUp() { super.setUp(); setupServer(); setupEnchantments(); + when(Bukkit.getServer().createBlockData(any(Material.class), any(String.class))) + .thenReturn(mock(org.bukkit.block.data.BlockData.class)); } private static Particle[] getTestLegacyParticles() { @@ -157,9 +159,6 @@ void testWorldSpawnParticle(Particle particle) { } private void testSpawnParticle(Class targetClass, Particle particle) { - // Initialize Bukkit variables - initializeBlockData(); - T target = mock(targetClass); final @NotNull Consumer[]> captorsValidator; @@ -431,7 +430,6 @@ void testInvalidOptionForMaterialData() { @ParameterizedTest @EnumSource(Material.class) void testAllBlockData(Material material) { - initializeBlockData(); Executable executable = () -> WrappersAdapter.convertOption(org.bukkit.block.data.BlockData.class, material.name()); if (material.isBlock()) assertDoesNotThrow(executable); else assertThrowsExactly(IllegalArgumentException.class, executable); @@ -452,12 +450,6 @@ void testItemModuleNotProvided() { } } - private static void initializeBlockData() { - Server server = mock(Server.class); - when(server.createBlockData(any(Material.class), any(String.class))).thenReturn(mock(org.bukkit.block.data.BlockData.class)); - new Refl<>(Bukkit.class).setFieldObject("server", server); - } - @SuppressWarnings("unused") private static class MockDataType {