mirror of
https://github.com/BentoBoxWorld/BentoBox.git
synced 2025-01-08 09:27:38 +01:00
Fixed AdminPurgeCommand test class.
Added mock for island.isOwned() and island.isUnowned() methods.
This commit is contained in:
parent
eb06b39b4a
commit
a42da35174
@ -1,6 +1,3 @@
|
||||
/**
|
||||
*
|
||||
*/
|
||||
package world.bentobox.bentobox.api.commands.admin.purge;
|
||||
|
||||
import static org.junit.Assert.assertEquals;
|
||||
@ -91,11 +88,13 @@ public class AdminPurgeCommandTest {
|
||||
when(im.getIslands()).thenReturn(Collections.emptyList());
|
||||
|
||||
// IWM
|
||||
|
||||
IslandWorldManager iwm = mock(IslandWorldManager.class);
|
||||
when(iwm.getFriendlyName(any())).thenReturn("BSkyBlock");
|
||||
when(plugin.getIWM()).thenReturn(iwm);
|
||||
|
||||
// Island
|
||||
when(island.isOwned()).thenReturn(true); // Default owned
|
||||
|
||||
// Command
|
||||
apc = new AdminPurgeCommand(ac);
|
||||
}
|
||||
@ -206,6 +205,8 @@ public class AdminPurgeCommandTest {
|
||||
when(island.getPurgeProtected()).thenReturn(false);
|
||||
when(island.getWorld()).thenReturn(world);
|
||||
when(island.getOwner()).thenReturn(null);
|
||||
when(island.isUnowned()).thenReturn(true);
|
||||
when(island.isOwned()).thenReturn(false);
|
||||
when(im.getIslands()).thenReturn(Collections.singleton(island));
|
||||
assertTrue(apc.execute(user, "protect", Collections.singletonList("10")));
|
||||
verify(user).sendMessage(eq("commands.admin.purge.purgable-islands"), eq("[number]"), eq("0"));
|
||||
@ -256,6 +257,7 @@ public class AdminPurgeCommandTest {
|
||||
when(island.getPurgeProtected()).thenReturn(false);
|
||||
when(island.getWorld()).thenReturn(world);
|
||||
when(island.getOwner()).thenReturn(UUID.randomUUID());
|
||||
when(island.isOwned()).thenReturn(true);
|
||||
Map<UUID, Integer> team = new HashMap<>();
|
||||
team.put(UUID.randomUUID(), RanksManager.OWNER_RANK);
|
||||
when(island.getMembers()).thenReturn(team);
|
||||
|
Loading…
Reference in New Issue
Block a user