Fixes tests for IslandTeamCommand

This commit is contained in:
tastybento 2019-10-27 13:26:22 -07:00
parent 6d3e5914a9
commit a27f54a6f7
2 changed files with 14 additions and 2 deletions

View File

@ -88,8 +88,12 @@ public class IslandTeamCommand extends CompositeCommand {
private void showMembers(Island island, User user) { private void showMembers(Island island, User user) {
// Gather online members // Gather online members
List<UUID> onlineMembers = island.getMemberSet(RanksManager.MEMBER_RANK).stream() List<UUID> onlineMembers = island
.filter(uuid -> Bukkit.getOfflinePlayer(uuid).isOnline()).collect(Collectors.toList()); .getMemberSet(RanksManager.MEMBER_RANK)
.stream()
.filter(uuid -> Bukkit.getOfflinePlayer(uuid)
.isOnline())
.collect(Collectors.toList());
// List of ranks that we will loop through // List of ranks that we will loop through
Integer[] ranks = new Integer[]{RanksManager.OWNER_RANK, RanksManager.SUB_OWNER_RANK, RanksManager.MEMBER_RANK, RanksManager.TRUSTED_RANK, RanksManager.COOP_RANK}; Integer[] ranks = new Integer[]{RanksManager.OWNER_RANK, RanksManager.SUB_OWNER_RANK, RanksManager.MEMBER_RANK, RanksManager.TRUSTED_RANK, RanksManager.COOP_RANK};

View File

@ -28,6 +28,8 @@ import org.powermock.core.classloader.annotations.PrepareForTest;
import org.powermock.modules.junit4.PowerMockRunner; import org.powermock.modules.junit4.PowerMockRunner;
import org.powermock.reflect.Whitebox; import org.powermock.reflect.Whitebox;
import com.google.common.collect.ImmutableSet;
import world.bentobox.bentobox.BentoBox; import world.bentobox.bentobox.BentoBox;
import world.bentobox.bentobox.api.commands.CompositeCommand; import world.bentobox.bentobox.api.commands.CompositeCommand;
import world.bentobox.bentobox.api.commands.island.team.Invite.Type; import world.bentobox.bentobox.api.commands.island.team.Invite.Type;
@ -103,6 +105,12 @@ public class IslandTeamCommandTest {
when(im.getOwner(any(), any())).thenReturn(uuid); when(im.getOwner(any(), any())).thenReturn(uuid);
// No team members // No team members
when(im.getMembers(any(), any(UUID.class))).thenReturn(Collections.emptySet()); when(im.getMembers(any(), any(UUID.class))).thenReturn(Collections.emptySet());
// Add members
ImmutableSet<UUID> set = new ImmutableSet.Builder<UUID>().build();
// No members
when(island.getMemberSet(anyInt(), any(Boolean.class))).thenReturn(set);
when(island.getMemberSet(anyInt())).thenReturn(set);
when(island.getMemberSet()).thenReturn(set);
// island // island
when(im.getIsland(any(), eq(uuid))).thenReturn(island); when(im.getIsland(any(), eq(uuid))).thenReturn(island);