Test fixes

This commit is contained in:
tastybento 2024-10-20 17:57:59 -07:00
parent e0a3f48aed
commit f9c34e5df6
3 changed files with 2 additions and 8 deletions

View File

@ -8,7 +8,6 @@ import static org.mockito.ArgumentMatchers.anyString;
import static org.mockito.ArgumentMatchers.eq; import static org.mockito.ArgumentMatchers.eq;
import static org.mockito.Mockito.mock; import static org.mockito.Mockito.mock;
import static org.mockito.Mockito.never; import static org.mockito.Mockito.never;
import static org.mockito.Mockito.times;
import static org.mockito.Mockito.verify; import static org.mockito.Mockito.verify;
import static org.mockito.Mockito.when; import static org.mockito.Mockito.when;
@ -39,7 +38,6 @@ import org.powermock.reflect.Whitebox;
import world.bentobox.bentobox.BentoBox; import world.bentobox.bentobox.BentoBox;
import world.bentobox.bentobox.Settings; import world.bentobox.bentobox.Settings;
import world.bentobox.bentobox.api.commands.CompositeCommand; 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.api.user.User;
import world.bentobox.bentobox.database.objects.Island; import world.bentobox.bentobox.database.objects.Island;
import world.bentobox.bentobox.managers.CommandsManager; import world.bentobox.bentobox.managers.CommandsManager;
@ -200,12 +198,8 @@ public class IslandHomesCommandTest {
*/ */
@Test @Test
public void testExecuteUserStringListOfString() { public void testExecuteUserStringListOfString() {
when(im.getIslands(world, user)).thenReturn(List.of(island));
IslandHomesCommand isc = new IslandHomesCommand(ic); IslandHomesCommand isc = new IslandHomesCommand(ic);
assertTrue(isc.canExecute(user, "island", Collections.emptyList()));
assertTrue(isc.execute(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());
} }
} }

View File

@ -139,6 +139,7 @@ public class IslandCreationPanelTest {
when(ic.getAddon()).thenReturn(addon); when(ic.getAddon()).thenReturn(addon);
World world = mock(World.class); World world = mock(World.class);
when(ic.getWorld()).thenReturn(world); when(ic.getWorld()).thenReturn(world);
when(ic.getPlugin()).thenReturn(plugin);
// No island for player to begin with (set it later in the tests) // No island for player to begin with (set it later in the tests)
when(im.hasIsland(any(), eq(uuid))).thenReturn(false); when(im.hasIsland(any(), eq(uuid))).thenReturn(false);

View File

@ -108,6 +108,7 @@ public class LanguagePanelTest {
GameModeAddon addon = mock(GameModeAddon.class); GameModeAddon addon = mock(GameModeAddon.class);
when(command.getAddon()).thenReturn(addon); when(command.getAddon()).thenReturn(addon);
when(command.getPlugin()).thenReturn(plugin);
when(addon.getDataFolder()).thenReturn(resourcePath.toFile()); when(addon.getDataFolder()).thenReturn(resourcePath.toFile());
World world = mock(World.class); World world = mock(World.class);
@ -139,8 +140,6 @@ public class LanguagePanelTest {
} }
/**
*/
@After @After
public void tearDown() { public void tearDown() {
User.clearUsers(); User.clearUsers();