Adjust test to use latest API

This commit is contained in:
tastybento 2024-01-08 20:52:10 +09:00
parent 198cc66319
commit 466fafddea

View File

@ -60,13 +60,14 @@ import world.bentobox.bentobox.managers.CommandsManager;
import world.bentobox.bentobox.managers.FlagsManager; import world.bentobox.bentobox.managers.FlagsManager;
import world.bentobox.bentobox.managers.IslandWorldManager; import world.bentobox.bentobox.managers.IslandWorldManager;
import world.bentobox.bentobox.managers.IslandsManager; import world.bentobox.bentobox.managers.IslandsManager;
import world.bentobox.bentobox.managers.RanksManager;
/** /**
* @author tastybento * @author tastybento
* *
*/ */
@RunWith(PowerMockRunner.class) @RunWith(PowerMockRunner.class)
@PrepareForTest({ Bukkit.class, BentoBox.class, User.class, Config.class, DatabaseSetup.class }) @PrepareForTest({ Bukkit.class, BentoBox.class, User.class, Config.class, DatabaseSetup.class, RanksManager.class })
public class AcidIslandTest { public class AcidIslandTest {
/** /**
@ -86,6 +87,8 @@ public class AcidIslandTest {
private FlagsManager fm; private FlagsManager fm;
@Mock @Mock
private Settings settings; private Settings settings;
@Mock
private RanksManager rm;
private static AbstractDatabaseHandler<Object> h; private static AbstractDatabaseHandler<Object> h;
@ -130,6 +133,8 @@ public class AcidIslandTest {
// Set up plugin // Set up plugin
Whitebox.setInternalState(BentoBox.class, "instance", plugin); Whitebox.setInternalState(BentoBox.class, "instance", plugin);
when(plugin.getLogger()).thenReturn(Logger.getAnonymousLogger()); when(plugin.getLogger()).thenReturn(Logger.getAnonymousLogger());
Whitebox.setInternalState(RanksManager.class, "instance", rm);
// Command manager // Command manager
CommandsManager cm = mock(CommandsManager.class); CommandsManager cm = mock(CommandsManager.class);
when(plugin.getCommandsManager()).thenReturn(cm); when(plugin.getCommandsManager()).thenReturn(cm);
@ -201,6 +206,7 @@ public class AcidIslandTest {
// Settings // Settings
when(plugin.getSettings()).thenReturn(settings); when(plugin.getSettings()).thenReturn(settings);
} }
/** /**