bentobox/src/test/java/world/bentobox/bentobox/api/commands/island/IslandDeletehomeCommandTest...

243 lines
9.3 KiB
Java
Raw Normal View History

package world.bentobox.bentobox.api.commands.island;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertFalse;
import static org.junit.Assert.assertTrue;
import static org.mockito.ArgumentMatchers.any;
import static org.mockito.ArgumentMatchers.anyString;
import static org.mockito.ArgumentMatchers.eq;
import static org.mockito.Mockito.mock;
import static org.mockito.Mockito.verify;
import static org.mockito.Mockito.when;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.Optional;
import java.util.UUID;
import org.bukkit.Bukkit;
import org.bukkit.Location;
import org.bukkit.World;
import org.bukkit.entity.Player;
2 0 0 multi island (#2185) * Multi world WIP - stashing * Initial work on supporting multiple islands per player The default allowed number is 5 for now, but will be set to 1 by default. Lots more work to do on this! * More work on multi island. Fixed tests so clean compile. * Remove unused imports * Updated island go and homes command to multi island Updated tests. * Do not reload addons anymore. * Add island name when entering or leaving own island * Remove unused import * Adds island names to /island go command. * Enables more homes to be set if player has more than one island * Switch to using a set for islands and explicit primary boolean in Island * WIP * Fix bugs with the go command. * Be able to delete multiple islands, e.g. when joining a team This is not fully tested. * Do not remove all islands when a player does reset. Players can reset just the island they are on. * More fixes for go command * Fix tests * Fix @NonNull annotation * Fix home syntax listing reference for IslandDeleteHome * Fixed deletehome for multiple islands. * Fix /island command teleport to current island default home. * Remove deprecated code. * Fix tag for concurrent island setting in config.yml * Improve error when trying to make additional islands over limit * Update config.yml * Correctly assign invites for islands. * Switch to canExecute API in prep for multi-island handling * Prevent players from obtaining more concurrent islands by owner transfer * Handle leaving and disbanding of teams * Fix tests * Fix minor bugs or code smells. * Restore the quarantine code from deprecation. This code can stay. It checks if islands can load, and if not puts them in a trash. It does no harm. * Remove unneeded eq()'s * Fix tests
2023-09-17 00:55:52 +02:00
import org.eclipse.jdt.annotation.NonNull;
import org.jetbrains.annotations.NotNull;
import org.junit.Before;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.mockito.Mock;
import org.mockito.Mockito;
import org.powermock.api.mockito.PowerMockito;
import org.powermock.core.classloader.annotations.PrepareForTest;
import org.powermock.modules.junit4.PowerMockRunner;
import world.bentobox.bentobox.BentoBox;
import world.bentobox.bentobox.Settings;
import world.bentobox.bentobox.api.addons.GameModeAddon;
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;
import world.bentobox.bentobox.managers.IslandWorldManager;
import world.bentobox.bentobox.managers.IslandsManager;
import world.bentobox.bentobox.managers.PlayersManager;
import world.bentobox.bentobox.managers.RanksManager;
import world.bentobox.bentobox.managers.RanksManagerBeforeClassTest;
/**
* @author tastybento
*
*/
@RunWith(PowerMockRunner.class)
@PrepareForTest({Bukkit.class, BentoBox.class, User.class })
public class IslandDeletehomeCommandTest extends RanksManagerBeforeClassTest {
@Mock
private CompositeCommand ic;
private UUID uuid;
@Mock
private User user;
@Mock
private IslandsManager im;
@Mock
private PlayersManager pm;
@Mock
private Island island;
private IslandDeletehomeCommand idh;
@Mock
private IslandWorldManager iwm;
2 0 0 multi island (#2185) * Multi world WIP - stashing * Initial work on supporting multiple islands per player The default allowed number is 5 for now, but will be set to 1 by default. Lots more work to do on this! * More work on multi island. Fixed tests so clean compile. * Remove unused imports * Updated island go and homes command to multi island Updated tests. * Do not reload addons anymore. * Add island name when entering or leaving own island * Remove unused import * Adds island names to /island go command. * Enables more homes to be set if player has more than one island * Switch to using a set for islands and explicit primary boolean in Island * WIP * Fix bugs with the go command. * Be able to delete multiple islands, e.g. when joining a team This is not fully tested. * Do not remove all islands when a player does reset. Players can reset just the island they are on. * More fixes for go command * Fix tests * Fix @NonNull annotation * Fix home syntax listing reference for IslandDeleteHome * Fixed deletehome for multiple islands. * Fix /island command teleport to current island default home. * Remove deprecated code. * Fix tag for concurrent island setting in config.yml * Improve error when trying to make additional islands over limit * Update config.yml * Correctly assign invites for islands. * Switch to canExecute API in prep for multi-island handling * Prevent players from obtaining more concurrent islands by owner transfer * Handle leaving and disbanding of teams * Fix tests * Fix minor bugs or code smells. * Restore the quarantine code from deprecation. This code can stay. It checks if islands can load, and if not puts them in a trash. It does no harm. * Remove unneeded eq()'s * Fix tests
2023-09-17 00:55:52 +02:00
@Mock
private @NonNull World world;
@Mock
private Location location;
/**
* @throws java.lang.Exception
*/
@Before
public void setUp() throws Exception {
super.setUp();
// Command manager
CommandsManager cm = mock(CommandsManager.class);
when(plugin.getCommandsManager()).thenReturn(cm);
// Addon
GameModeAddon addon = mock(GameModeAddon.class);
// Settings
Settings settings = new Settings();
when(plugin.getSettings()).thenReturn(settings);
// Parent command has no aliases
when(ic.getSubCommandAliases()).thenReturn(new HashMap<>());
when(ic.getParameters()).thenReturn("parameters");
when(ic.getDescription()).thenReturn("description");
when(ic.getPermissionPrefix()).thenReturn("permission.");
when(ic.getUsage()).thenReturn("");
when(ic.getSubCommand(Mockito.anyString())).thenReturn(Optional.empty());
when(ic.getAddon()).thenReturn(addon);
2 0 0 multi island (#2185) * Multi world WIP - stashing * Initial work on supporting multiple islands per player The default allowed number is 5 for now, but will be set to 1 by default. Lots more work to do on this! * More work on multi island. Fixed tests so clean compile. * Remove unused imports * Updated island go and homes command to multi island Updated tests. * Do not reload addons anymore. * Add island name when entering or leaving own island * Remove unused import * Adds island names to /island go command. * Enables more homes to be set if player has more than one island * Switch to using a set for islands and explicit primary boolean in Island * WIP * Fix bugs with the go command. * Be able to delete multiple islands, e.g. when joining a team This is not fully tested. * Do not remove all islands when a player does reset. Players can reset just the island they are on. * More fixes for go command * Fix tests * Fix @NonNull annotation * Fix home syntax listing reference for IslandDeleteHome * Fixed deletehome for multiple islands. * Fix /island command teleport to current island default home. * Remove deprecated code. * Fix tag for concurrent island setting in config.yml * Improve error when trying to make additional islands over limit * Update config.yml * Correctly assign invites for islands. * Switch to canExecute API in prep for multi-island handling * Prevent players from obtaining more concurrent islands by owner transfer * Handle leaving and disbanding of teams * Fix tests * Fix minor bugs or code smells. * Restore the quarantine code from deprecation. This code can stay. It checks if islands can load, and if not puts them in a trash. It does no harm. * Remove unneeded eq()'s * Fix tests
2023-09-17 00:55:52 +02:00
when(ic.getWorld()).thenReturn(world);
when(plugin.getIslands()).thenReturn(im);
// Player
Player player = mock(Player.class);
when(user.isOp()).thenReturn(false);
uuid = UUID.randomUUID();
when(user.getUniqueId()).thenReturn(uuid);
when(user.getPlayer()).thenReturn(player);
when(user.getName()).thenReturn("tastybento");
2 0 0 multi island (#2185) * Multi world WIP - stashing * Initial work on supporting multiple islands per player The default allowed number is 5 for now, but will be set to 1 by default. Lots more work to do on this! * More work on multi island. Fixed tests so clean compile. * Remove unused imports * Updated island go and homes command to multi island Updated tests. * Do not reload addons anymore. * Add island name when entering or leaving own island * Remove unused import * Adds island names to /island go command. * Enables more homes to be set if player has more than one island * Switch to using a set for islands and explicit primary boolean in Island * WIP * Fix bugs with the go command. * Be able to delete multiple islands, e.g. when joining a team This is not fully tested. * Do not remove all islands when a player does reset. Players can reset just the island they are on. * More fixes for go command * Fix tests * Fix @NonNull annotation * Fix home syntax listing reference for IslandDeleteHome * Fixed deletehome for multiple islands. * Fix /island command teleport to current island default home. * Remove deprecated code. * Fix tag for concurrent island setting in config.yml * Improve error when trying to make additional islands over limit * Update config.yml * Correctly assign invites for islands. * Switch to canExecute API in prep for multi-island handling * Prevent players from obtaining more concurrent islands by owner transfer * Handle leaving and disbanding of teams * Fix tests * Fix minor bugs or code smells. * Restore the quarantine code from deprecation. This code can stay. It checks if islands can load, and if not puts them in a trash. It does no harm. * Remove unneeded eq()'s * Fix tests
2023-09-17 00:55:52 +02:00
when(user.getWorld()).thenReturn(world);
when(user.getTranslation(anyString())).thenAnswer(i -> i.getArgument(0, String.class));
// Island
when(island.getOwner()).thenReturn(uuid);
when(island.onIsland(any())).thenReturn(true);
2 0 0 multi island (#2185) * Multi world WIP - stashing * Initial work on supporting multiple islands per player The default allowed number is 5 for now, but will be set to 1 by default. Lots more work to do on this! * More work on multi island. Fixed tests so clean compile. * Remove unused imports * Updated island go and homes command to multi island Updated tests. * Do not reload addons anymore. * Add island name when entering or leaving own island * Remove unused import * Adds island names to /island go command. * Enables more homes to be set if player has more than one island * Switch to using a set for islands and explicit primary boolean in Island * WIP * Fix bugs with the go command. * Be able to delete multiple islands, e.g. when joining a team This is not fully tested. * Do not remove all islands when a player does reset. Players can reset just the island they are on. * More fixes for go command * Fix tests * Fix @NonNull annotation * Fix home syntax listing reference for IslandDeleteHome * Fixed deletehome for multiple islands. * Fix /island command teleport to current island default home. * Remove deprecated code. * Fix tag for concurrent island setting in config.yml * Improve error when trying to make additional islands over limit * Update config.yml * Correctly assign invites for islands. * Switch to canExecute API in prep for multi-island handling * Prevent players from obtaining more concurrent islands by owner transfer * Handle leaving and disbanding of teams * Fix tests * Fix minor bugs or code smells. * Restore the quarantine code from deprecation. This code can stay. It checks if islands can load, and if not puts them in a trash. It does no harm. * Remove unneeded eq()'s * Fix tests
2023-09-17 00:55:52 +02:00
when(im.getIsland(world, uuid)).thenReturn(island);
when(im.getIsland(world, user)).thenReturn(island);
when(im.getIslands(world, uuid)).thenReturn(List.of(island));
@NotNull
Map<String, Location> homeMap = new HashMap<>();
homeMap.put("Home", null);
homeMap.put("Home2", null);
homeMap.put("Home3", null);
homeMap.put("Home4", null);
when(island.getHomes()).thenReturn(homeMap);
// IWM friendly name
when(iwm.getFriendlyName(any())).thenReturn("BSkyBlock");
// Not in nether
when(iwm.isNether(any())).thenReturn(false);
// Not in end
when(iwm.isEnd(any())).thenReturn(false);
// Number of homes default
when(iwm.getMaxHomes(any())).thenReturn(3);
when(plugin.getIWM()).thenReturn(iwm);
// Bukkit
PowerMockito.mockStatic(Bukkit.class, Mockito.RETURNS_MOCKS);
idh = new IslandDeletehomeCommand(ic);
}
/**
* Test method for {@link world.bentobox.bentobox.api.commands.island.IslandDeletehomeCommand#IslandDeletehomeCommand(world.bentobox.bentobox.api.commands.CompositeCommand)}.
*/
@Test
public void testIslandDeletehomeCommand() {
assertEquals("deletehome", idh.getLabel());
}
/**
* Test method for {@link world.bentobox.bentobox.api.commands.island.IslandDeletehomeCommand#setup()}.
*/
@Test
public void testSetup() {
assertTrue(idh.isOnlyPlayer());
assertEquals("commands.island.deletehome.parameters", idh.getParameters());
assertEquals("commands.island.deletehome.description", idh.getDescription());
assertEquals("permission.island.deletehome", idh.getPermission());
}
/**
* Test method for {@link world.bentobox.bentobox.api.commands.island.IslandDeletehomeCommand#canExecute(world.bentobox.bentobox.api.user.User, java.lang.String, java.util.List)}.
*/
@Test
public void testCanExecuteHelp() {
idh.canExecute(user, "label", List.of());
2 0 0 multi island (#2185) * Multi world WIP - stashing * Initial work on supporting multiple islands per player The default allowed number is 5 for now, but will be set to 1 by default. Lots more work to do on this! * More work on multi island. Fixed tests so clean compile. * Remove unused imports * Updated island go and homes command to multi island Updated tests. * Do not reload addons anymore. * Add island name when entering or leaving own island * Remove unused import * Adds island names to /island go command. * Enables more homes to be set if player has more than one island * Switch to using a set for islands and explicit primary boolean in Island * WIP * Fix bugs with the go command. * Be able to delete multiple islands, e.g. when joining a team This is not fully tested. * Do not remove all islands when a player does reset. Players can reset just the island they are on. * More fixes for go command * Fix tests * Fix @NonNull annotation * Fix home syntax listing reference for IslandDeleteHome * Fixed deletehome for multiple islands. * Fix /island command teleport to current island default home. * Remove deprecated code. * Fix tag for concurrent island setting in config.yml * Improve error when trying to make additional islands over limit * Update config.yml * Correctly assign invites for islands. * Switch to canExecute API in prep for multi-island handling * Prevent players from obtaining more concurrent islands by owner transfer * Handle leaving and disbanding of teams * Fix tests * Fix minor bugs or code smells. * Restore the quarantine code from deprecation. This code can stay. It checks if islands can load, and if not puts them in a trash. It does no harm. * Remove unneeded eq()'s * Fix tests
2023-09-17 00:55:52 +02:00
verify(user).sendMessage("commands.help.header","[label]","BSkyBlock");
}
/**
* Test method for {@link world.bentobox.bentobox.api.commands.island.IslandDeletehomeCommand#canExecute(world.bentobox.bentobox.api.user.User, java.lang.String, java.util.List)}.
*/
@Test
public void testCanExecuteNoIsland() {
when(im.getIsland(any(), eq(user))).thenReturn(null);
assertFalse(idh.canExecute(user, "label", List.of("something")));
verify(user).sendMessage("general.errors.no-island");
}
/**
* Test method for {@link world.bentobox.bentobox.api.commands.island.IslandDeletehomeCommand#canExecute(world.bentobox.bentobox.api.user.User, java.lang.String, java.util.List)}.
*/
@Test
public void testCanExecuteLowRank() {
when(island.getRank(user)).thenReturn(RanksManager.COOP_RANK);
when(island.getRankCommand(anyString())).thenReturn(RanksManager.OWNER_RANK);
assertFalse(idh.canExecute(user, "label", List.of("something")));
verify(user).sendMessage("general.errors.insufficient-rank", TextVariables.RANK, "");
}
/**
2 0 0 multi island (#2185) * Multi world WIP - stashing * Initial work on supporting multiple islands per player The default allowed number is 5 for now, but will be set to 1 by default. Lots more work to do on this! * More work on multi island. Fixed tests so clean compile. * Remove unused imports * Updated island go and homes command to multi island Updated tests. * Do not reload addons anymore. * Add island name when entering or leaving own island * Remove unused import * Adds island names to /island go command. * Enables more homes to be set if player has more than one island * Switch to using a set for islands and explicit primary boolean in Island * WIP * Fix bugs with the go command. * Be able to delete multiple islands, e.g. when joining a team This is not fully tested. * Do not remove all islands when a player does reset. Players can reset just the island they are on. * More fixes for go command * Fix tests * Fix @NonNull annotation * Fix home syntax listing reference for IslandDeleteHome * Fixed deletehome for multiple islands. * Fix /island command teleport to current island default home. * Remove deprecated code. * Fix tag for concurrent island setting in config.yml * Improve error when trying to make additional islands over limit * Update config.yml * Correctly assign invites for islands. * Switch to canExecute API in prep for multi-island handling * Prevent players from obtaining more concurrent islands by owner transfer * Handle leaving and disbanding of teams * Fix tests * Fix minor bugs or code smells. * Restore the quarantine code from deprecation. This code can stay. It checks if islands can load, and if not puts them in a trash. It does no harm. * Remove unneeded eq()'s * Fix tests
2023-09-17 00:55:52 +02:00
* Test method for {@link world.bentobox.bentobox.api.commands.island.IslandDeletehomeCommand#execute(world.bentobox.bentobox.api.user.User, java.lang.String, java.util.List)}.
*/
@Test
2 0 0 multi island (#2185) * Multi world WIP - stashing * Initial work on supporting multiple islands per player The default allowed number is 5 for now, but will be set to 1 by default. Lots more work to do on this! * More work on multi island. Fixed tests so clean compile. * Remove unused imports * Updated island go and homes command to multi island Updated tests. * Do not reload addons anymore. * Add island name when entering or leaving own island * Remove unused import * Adds island names to /island go command. * Enables more homes to be set if player has more than one island * Switch to using a set for islands and explicit primary boolean in Island * WIP * Fix bugs with the go command. * Be able to delete multiple islands, e.g. when joining a team This is not fully tested. * Do not remove all islands when a player does reset. Players can reset just the island they are on. * More fixes for go command * Fix tests * Fix @NonNull annotation * Fix home syntax listing reference for IslandDeleteHome * Fixed deletehome for multiple islands. * Fix /island command teleport to current island default home. * Remove deprecated code. * Fix tag for concurrent island setting in config.yml * Improve error when trying to make additional islands over limit * Update config.yml * Correctly assign invites for islands. * Switch to canExecute API in prep for multi-island handling * Prevent players from obtaining more concurrent islands by owner transfer * Handle leaving and disbanding of teams * Fix tests * Fix minor bugs or code smells. * Restore the quarantine code from deprecation. This code can stay. It checks if islands can load, and if not puts them in a trash. It does no harm. * Remove unneeded eq()'s * Fix tests
2023-09-17 00:55:52 +02:00
public void testExecuteUnknownHome() {
when(island.getHomes()).thenReturn(Map.of("home", location));
when(im.isHomeLocation(eq(island), anyString())).thenReturn(false);
2 0 0 multi island (#2185) * Multi world WIP - stashing * Initial work on supporting multiple islands per player The default allowed number is 5 for now, but will be set to 1 by default. Lots more work to do on this! * More work on multi island. Fixed tests so clean compile. * Remove unused imports * Updated island go and homes command to multi island Updated tests. * Do not reload addons anymore. * Add island name when entering or leaving own island * Remove unused import * Adds island names to /island go command. * Enables more homes to be set if player has more than one island * Switch to using a set for islands and explicit primary boolean in Island * WIP * Fix bugs with the go command. * Be able to delete multiple islands, e.g. when joining a team This is not fully tested. * Do not remove all islands when a player does reset. Players can reset just the island they are on. * More fixes for go command * Fix tests * Fix @NonNull annotation * Fix home syntax listing reference for IslandDeleteHome * Fixed deletehome for multiple islands. * Fix /island command teleport to current island default home. * Remove deprecated code. * Fix tag for concurrent island setting in config.yml * Improve error when trying to make additional islands over limit * Update config.yml * Correctly assign invites for islands. * Switch to canExecute API in prep for multi-island handling * Prevent players from obtaining more concurrent islands by owner transfer * Handle leaving and disbanding of teams * Fix tests * Fix minor bugs or code smells. * Restore the quarantine code from deprecation. This code can stay. It checks if islands can load, and if not puts them in a trash. It does no harm. * Remove unneeded eq()'s * Fix tests
2023-09-17 00:55:52 +02:00
assertFalse(idh.execute(user, "label", List.of("something")));
verify(user).sendMessage("commands.island.go.unknown-home");
verify(user).sendMessage("commands.island.sethome.homes-are");
2023-09-04 23:58:23 +02:00
verify(user).sendMessage("commands.island.sethome.home-list-syntax", TextVariables.NAME, "home");
}
/**
* Test method for {@link world.bentobox.bentobox.api.commands.island.IslandDeletehomeCommand#execute(world.bentobox.bentobox.api.user.User, java.lang.String, java.util.List)}.
*/
@Test
public void testExecuteUserStringListOfString() {
2 0 0 multi island (#2185) * Multi world WIP - stashing * Initial work on supporting multiple islands per player The default allowed number is 5 for now, but will be set to 1 by default. Lots more work to do on this! * More work on multi island. Fixed tests so clean compile. * Remove unused imports * Updated island go and homes command to multi island Updated tests. * Do not reload addons anymore. * Add island name when entering or leaving own island * Remove unused import * Adds island names to /island go command. * Enables more homes to be set if player has more than one island * Switch to using a set for islands and explicit primary boolean in Island * WIP * Fix bugs with the go command. * Be able to delete multiple islands, e.g. when joining a team This is not fully tested. * Do not remove all islands when a player does reset. Players can reset just the island they are on. * More fixes for go command * Fix tests * Fix @NonNull annotation * Fix home syntax listing reference for IslandDeleteHome * Fixed deletehome for multiple islands. * Fix /island command teleport to current island default home. * Remove deprecated code. * Fix tag for concurrent island setting in config.yml * Improve error when trying to make additional islands over limit * Update config.yml * Correctly assign invites for islands. * Switch to canExecute API in prep for multi-island handling * Prevent players from obtaining more concurrent islands by owner transfer * Handle leaving and disbanding of teams * Fix tests * Fix minor bugs or code smells. * Restore the quarantine code from deprecation. This code can stay. It checks if islands can load, and if not puts them in a trash. It does no harm. * Remove unneeded eq()'s * Fix tests
2023-09-17 00:55:52 +02:00
when(island.getHomes()).thenReturn(Map.of("home", location));
when(im.isHomeLocation(eq(island), anyString())).thenReturn(true);
assertTrue(idh.execute(user, "label", List.of("home")));
verify(user).sendMessage("commands.confirmation.confirm", "[seconds]", "10");
}
/**
* Test method for {@link world.bentobox.bentobox.api.commands.island.IslandDeletehomeCommand#tabComplete(world.bentobox.bentobox.api.user.User, java.lang.String, java.util.List)}.
*/
@Test
public void testTabCompleteUserStringListOfString() {
2 0 0 multi island (#2185) * Multi world WIP - stashing * Initial work on supporting multiple islands per player The default allowed number is 5 for now, but will be set to 1 by default. Lots more work to do on this! * More work on multi island. Fixed tests so clean compile. * Remove unused imports * Updated island go and homes command to multi island Updated tests. * Do not reload addons anymore. * Add island name when entering or leaving own island * Remove unused import * Adds island names to /island go command. * Enables more homes to be set if player has more than one island * Switch to using a set for islands and explicit primary boolean in Island * WIP * Fix bugs with the go command. * Be able to delete multiple islands, e.g. when joining a team This is not fully tested. * Do not remove all islands when a player does reset. Players can reset just the island they are on. * More fixes for go command * Fix tests * Fix @NonNull annotation * Fix home syntax listing reference for IslandDeleteHome * Fixed deletehome for multiple islands. * Fix /island command teleport to current island default home. * Remove deprecated code. * Fix tag for concurrent island setting in config.yml * Improve error when trying to make additional islands over limit * Update config.yml * Correctly assign invites for islands. * Switch to canExecute API in prep for multi-island handling * Prevent players from obtaining more concurrent islands by owner transfer * Handle leaving and disbanding of teams * Fix tests * Fix minor bugs or code smells. * Restore the quarantine code from deprecation. This code can stay. It checks if islands can load, and if not puts them in a trash. It does no harm. * Remove unneeded eq()'s * Fix tests
2023-09-17 00:55:52 +02:00
when(island.getHomes()).thenReturn(Map.of("home", location));
Optional<List<String>> list = idh.tabComplete(user, "label", List.of("hom"));
assertTrue(list.isPresent());
assertEquals("home", list.get().get(0));
}
/**
* Test method for {@link world.bentobox.bentobox.api.commands.island.IslandDeletehomeCommand#tabComplete(world.bentobox.bentobox.api.user.User, java.lang.String, java.util.List)}.
*/
@Test
public void testTabCompleteUserStringListOfStringNothing() {
2 0 0 multi island (#2185) * Multi world WIP - stashing * Initial work on supporting multiple islands per player The default allowed number is 5 for now, but will be set to 1 by default. Lots more work to do on this! * More work on multi island. Fixed tests so clean compile. * Remove unused imports * Updated island go and homes command to multi island Updated tests. * Do not reload addons anymore. * Add island name when entering or leaving own island * Remove unused import * Adds island names to /island go command. * Enables more homes to be set if player has more than one island * Switch to using a set for islands and explicit primary boolean in Island * WIP * Fix bugs with the go command. * Be able to delete multiple islands, e.g. when joining a team This is not fully tested. * Do not remove all islands when a player does reset. Players can reset just the island they are on. * More fixes for go command * Fix tests * Fix @NonNull annotation * Fix home syntax listing reference for IslandDeleteHome * Fixed deletehome for multiple islands. * Fix /island command teleport to current island default home. * Remove deprecated code. * Fix tag for concurrent island setting in config.yml * Improve error when trying to make additional islands over limit * Update config.yml * Correctly assign invites for islands. * Switch to canExecute API in prep for multi-island handling * Prevent players from obtaining more concurrent islands by owner transfer * Handle leaving and disbanding of teams * Fix tests * Fix minor bugs or code smells. * Restore the quarantine code from deprecation. This code can stay. It checks if islands can load, and if not puts them in a trash. It does no harm. * Remove unneeded eq()'s * Fix tests
2023-09-17 00:55:52 +02:00
when(island.getHomes()).thenReturn(Map.of("home", location));
Optional<List<String>> list = idh.tabComplete(user, "label", List.of("f"));
assertTrue(list.isPresent());
assertTrue(list.get().isEmpty());
}
}