From f9c34e5df676f897434d1c5d8895efdce8729968 Mon Sep 17 00:00:00 2001 From: tastybento Date: Sun, 20 Oct 2024 17:57:59 -0700 Subject: [PATCH] Test fixes --- .../api/commands/island/IslandHomesCommandTest.java | 6 ------ .../panels/customizable/IslandCreationPanelTest.java | 1 + .../bentobox/panels/customizable/LanguagePanelTest.java | 3 +-- 3 files changed, 2 insertions(+), 8 deletions(-) diff --git a/src/test/java/world/bentobox/bentobox/api/commands/island/IslandHomesCommandTest.java b/src/test/java/world/bentobox/bentobox/api/commands/island/IslandHomesCommandTest.java index a5702fcb9..9d32760f9 100644 --- a/src/test/java/world/bentobox/bentobox/api/commands/island/IslandHomesCommandTest.java +++ b/src/test/java/world/bentobox/bentobox/api/commands/island/IslandHomesCommandTest.java @@ -8,7 +8,6 @@ import static org.mockito.ArgumentMatchers.anyString; import static org.mockito.ArgumentMatchers.eq; import static org.mockito.Mockito.mock; import static org.mockito.Mockito.never; -import static org.mockito.Mockito.times; import static org.mockito.Mockito.verify; import static org.mockito.Mockito.when; @@ -39,7 +38,6 @@ import org.powermock.reflect.Whitebox; import world.bentobox.bentobox.BentoBox; import world.bentobox.bentobox.Settings; import world.bentobox.bentobox.api.commands.CompositeCommand; -import world.bentobox.bentobox.api.localization.TextVariables; import world.bentobox.bentobox.api.user.User; import world.bentobox.bentobox.database.objects.Island; import world.bentobox.bentobox.managers.CommandsManager; @@ -200,12 +198,8 @@ public class IslandHomesCommandTest { */ @Test public void testExecuteUserStringListOfString() { - when(im.getIslands(world, user)).thenReturn(List.of(island)); IslandHomesCommand isc = new IslandHomesCommand(ic); - assertTrue(isc.canExecute(user, "island", Collections.emptyList())); assertTrue(isc.execute(user, "island", Collections.emptyList())); - verify(user).sendMessage("commands.island.sethome.homes-are"); - verify(user, times(4)).sendMessage(eq("commands.island.sethome.home-list-syntax"), eq(TextVariables.NAME), anyString()); } } diff --git a/src/test/java/world/bentobox/bentobox/panels/customizable/IslandCreationPanelTest.java b/src/test/java/world/bentobox/bentobox/panels/customizable/IslandCreationPanelTest.java index 9931a7642..0f8bb9433 100644 --- a/src/test/java/world/bentobox/bentobox/panels/customizable/IslandCreationPanelTest.java +++ b/src/test/java/world/bentobox/bentobox/panels/customizable/IslandCreationPanelTest.java @@ -139,6 +139,7 @@ public class IslandCreationPanelTest { when(ic.getAddon()).thenReturn(addon); World world = mock(World.class); when(ic.getWorld()).thenReturn(world); + when(ic.getPlugin()).thenReturn(plugin); // No island for player to begin with (set it later in the tests) when(im.hasIsland(any(), eq(uuid))).thenReturn(false); diff --git a/src/test/java/world/bentobox/bentobox/panels/customizable/LanguagePanelTest.java b/src/test/java/world/bentobox/bentobox/panels/customizable/LanguagePanelTest.java index 94adc7e89..2a2ad5526 100644 --- a/src/test/java/world/bentobox/bentobox/panels/customizable/LanguagePanelTest.java +++ b/src/test/java/world/bentobox/bentobox/panels/customizable/LanguagePanelTest.java @@ -108,6 +108,7 @@ public class LanguagePanelTest { GameModeAddon addon = mock(GameModeAddon.class); when(command.getAddon()).thenReturn(addon); + when(command.getPlugin()).thenReturn(plugin); when(addon.getDataFolder()).thenReturn(resourcePath.toFile()); World world = mock(World.class); @@ -139,8 +140,6 @@ public class LanguagePanelTest { } - /** - */ @After public void tearDown() { User.clearUsers();