mirror of
https://github.com/BentoBoxWorld/BentoBox.git
synced 2025-01-09 01:48:24 +01:00
Merge branch 'develop' of https://github.com/BentoBoxWorld/BentoBox.git into develop
This commit is contained in:
commit
e1d4fbec46
@ -98,7 +98,6 @@ public class IslandsManagerTest {
|
|||||||
private Player player;
|
private Player player;
|
||||||
@Mock
|
@Mock
|
||||||
private World world;
|
private World world;
|
||||||
private IslandsManager manager;
|
|
||||||
@Mock
|
@Mock
|
||||||
private Block space1;
|
private Block space1;
|
||||||
@Mock
|
@Mock
|
||||||
@ -113,7 +112,7 @@ public class IslandsManagerTest {
|
|||||||
private IslandCache islandCache;
|
private IslandCache islandCache;
|
||||||
private Optional<Island> optionalIsland;
|
private Optional<Island> optionalIsland;
|
||||||
@Mock
|
@Mock
|
||||||
private Island is;
|
private Island island;
|
||||||
@Mock
|
@Mock
|
||||||
private PluginManager pim;
|
private PluginManager pim;
|
||||||
// Database
|
// Database
|
||||||
@ -138,6 +137,8 @@ public class IslandsManagerTest {
|
|||||||
|
|
||||||
private Environment env;
|
private Environment env;
|
||||||
|
|
||||||
|
// Class under test
|
||||||
|
IslandsManager im;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @throws java.lang.Exception
|
* @throws java.lang.Exception
|
||||||
@ -200,7 +201,6 @@ public class IslandsManagerTest {
|
|||||||
when(Bukkit.getVersion()).thenReturn("Paper version git-Paper-225 (MC: 1.14.4) (Implementing API version 1.14.4-R0.1-SNAPSHOT)");
|
when(Bukkit.getVersion()).thenReturn("Paper version git-Paper-225 (MC: 1.14.4) (Implementing API version 1.14.4-R0.1-SNAPSHOT)");
|
||||||
|
|
||||||
// Standard location
|
// Standard location
|
||||||
manager = new IslandsManager(plugin);
|
|
||||||
when(location.getWorld()).thenReturn(world);
|
when(location.getWorld()).thenReturn(world);
|
||||||
when(location.getBlock()).thenReturn(space1);
|
when(location.getBlock()).thenReturn(space1);
|
||||||
when(location.getWorld()).thenReturn(world);
|
when(location.getWorld()).thenReturn(world);
|
||||||
@ -233,9 +233,15 @@ public class IslandsManagerTest {
|
|||||||
PowerMockito.mockStatic(Util.class);
|
PowerMockito.mockStatic(Util.class);
|
||||||
when(Util.getWorld(any())).thenReturn(world);
|
when(Util.getWorld(any())).thenReturn(world);
|
||||||
|
|
||||||
|
// Island
|
||||||
|
when(island.getOwner()).thenReturn(uuid);
|
||||||
|
when(island.getWorld()).thenReturn(world);
|
||||||
|
when(island.getMaxMembers()).thenReturn(null); // default
|
||||||
|
when(island.getMaxMembers(Mockito.anyInt())).thenReturn(null); // default
|
||||||
|
|
||||||
// Mock island cache
|
// Mock island cache
|
||||||
when(islandCache.getIslandAt(any(Location.class))).thenReturn(is);
|
when(islandCache.getIslandAt(any(Location.class))).thenReturn(island);
|
||||||
optionalIsland = Optional.ofNullable(is);
|
optionalIsland = Optional.ofNullable(island);
|
||||||
|
|
||||||
// User location
|
// User location
|
||||||
when(user.getLocation()).thenReturn(location);
|
when(user.getLocation()).thenReturn(location);
|
||||||
@ -318,6 +324,11 @@ public class IslandsManagerTest {
|
|||||||
|
|
||||||
// Util strip spaces
|
// Util strip spaces
|
||||||
when(Util.stripSpaceAfterColorCodes(anyString())).thenCallRealMethod();
|
when(Util.stripSpaceAfterColorCodes(anyString())).thenCallRealMethod();
|
||||||
|
|
||||||
|
// Class under test
|
||||||
|
im = new IslandsManager(plugin);
|
||||||
|
// Set cache
|
||||||
|
//im.setIslandCache(islandCache);
|
||||||
}
|
}
|
||||||
|
|
||||||
@After
|
@After
|
||||||
@ -339,8 +350,7 @@ public class IslandsManagerTest {
|
|||||||
*/
|
*/
|
||||||
@Test
|
@Test
|
||||||
public void testIsSafeLocationSafe() {
|
public void testIsSafeLocationSafe() {
|
||||||
IslandsManager manager = new IslandsManager(plugin);
|
assertTrue(im.isSafeLocation(location));
|
||||||
assertTrue(manager.isSafeLocation(location));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -349,8 +359,7 @@ public class IslandsManagerTest {
|
|||||||
@Test
|
@Test
|
||||||
public void testIsSafeLocationNullWorld() {
|
public void testIsSafeLocationNullWorld() {
|
||||||
when(location.getWorld()).thenReturn(null);
|
when(location.getWorld()).thenReturn(null);
|
||||||
IslandsManager manager = new IslandsManager(plugin);
|
assertFalse(im.isSafeLocation(location));
|
||||||
assertFalse(manager.isSafeLocation(location));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -359,7 +368,7 @@ public class IslandsManagerTest {
|
|||||||
@Test
|
@Test
|
||||||
public void testIsSafeLocationNonSolidGround() {
|
public void testIsSafeLocationNonSolidGround() {
|
||||||
when(ground.getType()).thenReturn(Material.WATER);
|
when(ground.getType()).thenReturn(Material.WATER);
|
||||||
assertFalse(manager.isSafeLocation(location));
|
assertFalse(im.isSafeLocation(location));
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -370,7 +379,7 @@ public class IslandsManagerTest {
|
|||||||
when(ground.getType()).thenReturn(Material.STONE);
|
when(ground.getType()).thenReturn(Material.STONE);
|
||||||
when(space1.getType()).thenReturn(Material.WATER);
|
when(space1.getType()).thenReturn(Material.WATER);
|
||||||
when(space2.getType()).thenReturn(Material.WATER);
|
when(space2.getType()).thenReturn(Material.WATER);
|
||||||
assertFalse(manager.isSafeLocation(location));
|
assertFalse(im.isSafeLocation(location));
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
@ -379,7 +388,7 @@ public class IslandsManagerTest {
|
|||||||
if (d.name().contains("DOOR")) {
|
if (d.name().contains("DOOR")) {
|
||||||
for (Material s : Material.values()) {
|
for (Material s : Material.values()) {
|
||||||
if (s.name().contains("_SIGN")) {
|
if (s.name().contains("_SIGN")) {
|
||||||
assertFalse("Fail " + d.name() + " " + s.name(), manager.checkIfSafe(world, d, s, Material.AIR));
|
assertFalse("Fail " + d.name() + " " + s.name(), im.checkIfSafe(world, d, s, Material.AIR));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -394,27 +403,27 @@ public class IslandsManagerTest {
|
|||||||
when(ground.getType()).thenReturn(Material.STONE);
|
when(ground.getType()).thenReturn(Material.STONE);
|
||||||
when(space1.getType()).thenReturn(Material.AIR);
|
when(space1.getType()).thenReturn(Material.AIR);
|
||||||
when(space2.getType()).thenReturn(Material.NETHER_PORTAL);
|
when(space2.getType()).thenReturn(Material.NETHER_PORTAL);
|
||||||
assertTrue(manager.isSafeLocation(location));
|
assertTrue(im.isSafeLocation(location));
|
||||||
when(ground.getType()).thenReturn(Material.STONE);
|
when(ground.getType()).thenReturn(Material.STONE);
|
||||||
when(space1.getType()).thenReturn(Material.AIR);
|
when(space1.getType()).thenReturn(Material.AIR);
|
||||||
when(space2.getType()).thenReturn(Material.END_PORTAL);
|
when(space2.getType()).thenReturn(Material.END_PORTAL);
|
||||||
assertTrue(manager.isSafeLocation(location));
|
assertTrue(im.isSafeLocation(location));
|
||||||
when(ground.getType()).thenReturn(Material.STONE);
|
when(ground.getType()).thenReturn(Material.STONE);
|
||||||
when(space1.getType()).thenReturn(Material.NETHER_PORTAL);
|
when(space1.getType()).thenReturn(Material.NETHER_PORTAL);
|
||||||
when(space2.getType()).thenReturn(Material.AIR);
|
when(space2.getType()).thenReturn(Material.AIR);
|
||||||
assertTrue(manager.isSafeLocation(location));
|
assertTrue(im.isSafeLocation(location));
|
||||||
when(ground.getType()).thenReturn(Material.STONE);
|
when(ground.getType()).thenReturn(Material.STONE);
|
||||||
when(space1.getType()).thenReturn(Material.END_PORTAL);
|
when(space1.getType()).thenReturn(Material.END_PORTAL);
|
||||||
when(space2.getType()).thenReturn(Material.AIR);
|
when(space2.getType()).thenReturn(Material.AIR);
|
||||||
assertTrue(manager.isSafeLocation(location));
|
assertTrue(im.isSafeLocation(location));
|
||||||
when(ground.getType()).thenReturn(Material.NETHER_PORTAL);
|
when(ground.getType()).thenReturn(Material.NETHER_PORTAL);
|
||||||
when(space1.getType()).thenReturn(Material.AIR);
|
when(space1.getType()).thenReturn(Material.AIR);
|
||||||
when(space2.getType()).thenReturn(Material.AIR);
|
when(space2.getType()).thenReturn(Material.AIR);
|
||||||
assertFalse(manager.isSafeLocation(location));
|
assertFalse(im.isSafeLocation(location));
|
||||||
when(ground.getType()).thenReturn(Material.END_PORTAL);
|
when(ground.getType()).thenReturn(Material.END_PORTAL);
|
||||||
when(space1.getType()).thenReturn(Material.AIR);
|
when(space1.getType()).thenReturn(Material.AIR);
|
||||||
when(space2.getType()).thenReturn(Material.AIR);
|
when(space2.getType()).thenReturn(Material.AIR);
|
||||||
assertFalse(manager.isSafeLocation(location));
|
assertFalse(im.isSafeLocation(location));
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -425,15 +434,15 @@ public class IslandsManagerTest {
|
|||||||
when(ground.getType()).thenReturn(Material.LAVA);
|
when(ground.getType()).thenReturn(Material.LAVA);
|
||||||
when(space1.getType()).thenReturn(Material.AIR);
|
when(space1.getType()).thenReturn(Material.AIR);
|
||||||
when(space2.getType()).thenReturn(Material.AIR);
|
when(space2.getType()).thenReturn(Material.AIR);
|
||||||
assertFalse("In lava", manager.isSafeLocation(location));
|
assertFalse("In lava", im.isSafeLocation(location));
|
||||||
when(ground.getType()).thenReturn(Material.AIR);
|
when(ground.getType()).thenReturn(Material.AIR);
|
||||||
when(space1.getType()).thenReturn(Material.LAVA);
|
when(space1.getType()).thenReturn(Material.LAVA);
|
||||||
when(space2.getType()).thenReturn(Material.AIR);
|
when(space2.getType()).thenReturn(Material.AIR);
|
||||||
assertFalse("In lava", manager.isSafeLocation(location));
|
assertFalse("In lava", im.isSafeLocation(location));
|
||||||
when(ground.getType()).thenReturn(Material.AIR);
|
when(ground.getType()).thenReturn(Material.AIR);
|
||||||
when(space1.getType()).thenReturn(Material.AIR);
|
when(space1.getType()).thenReturn(Material.AIR);
|
||||||
when(space2.getType()).thenReturn(Material.LAVA);
|
when(space2.getType()).thenReturn(Material.LAVA);
|
||||||
assertFalse("In lava", manager.isSafeLocation(location));
|
assertFalse("In lava", im.isSafeLocation(location));
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -442,9 +451,9 @@ public class IslandsManagerTest {
|
|||||||
@Test
|
@Test
|
||||||
public void testTrapDoor() {
|
public void testTrapDoor() {
|
||||||
when(ground.getType()).thenReturn(Material.OAK_TRAPDOOR);
|
when(ground.getType()).thenReturn(Material.OAK_TRAPDOOR);
|
||||||
assertFalse("Open trapdoor", manager.isSafeLocation(location));
|
assertFalse("Open trapdoor", im.isSafeLocation(location));
|
||||||
when(ground.getType()).thenReturn(Material.IRON_TRAPDOOR);
|
when(ground.getType()).thenReturn(Material.IRON_TRAPDOOR);
|
||||||
assertFalse("Open iron trapdoor", manager.isSafeLocation(location));
|
assertFalse("Open iron trapdoor", im.isSafeLocation(location));
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -455,18 +464,18 @@ public class IslandsManagerTest {
|
|||||||
// Fences
|
// Fences
|
||||||
Arrays.stream(Material.values()).filter(m -> m.toString().contains("FENCE")).forEach(m -> {
|
Arrays.stream(Material.values()).filter(m -> m.toString().contains("FENCE")).forEach(m -> {
|
||||||
when(ground.getType()).thenReturn(m);
|
when(ground.getType()).thenReturn(m);
|
||||||
assertFalse("Fence :" + m.toString(), manager.isSafeLocation(location));
|
assertFalse("Fence :" + m.toString(), im.isSafeLocation(location));
|
||||||
});
|
});
|
||||||
// Signs
|
// Signs
|
||||||
when(ground.getType()).thenReturn(sign);
|
when(ground.getType()).thenReturn(sign);
|
||||||
assertFalse("Sign", manager.isSafeLocation(location));
|
assertFalse("Sign", im.isSafeLocation(location));
|
||||||
when(ground.getType()).thenReturn(wallSign);
|
when(ground.getType()).thenReturn(wallSign);
|
||||||
assertFalse("Sign", manager.isSafeLocation(location));
|
assertFalse("Sign", im.isSafeLocation(location));
|
||||||
// Bad Blocks
|
// Bad Blocks
|
||||||
Material[] badMats = {Material.CACTUS, Material.OAK_BOAT};
|
Material[] badMats = {Material.CACTUS, Material.OAK_BOAT};
|
||||||
Arrays.asList(badMats).forEach(m -> {
|
Arrays.asList(badMats).forEach(m -> {
|
||||||
when(ground.getType()).thenReturn(m);
|
when(ground.getType()).thenReturn(m);
|
||||||
assertFalse("Bad mat :" + m.toString(), manager.isSafeLocation(location));
|
assertFalse("Bad mat :" + m.toString(), im.isSafeLocation(location));
|
||||||
});
|
});
|
||||||
|
|
||||||
}
|
}
|
||||||
@ -477,27 +486,27 @@ public class IslandsManagerTest {
|
|||||||
@Test
|
@Test
|
||||||
public void testSolidBlocks() {
|
public void testSolidBlocks() {
|
||||||
when(space1.getType()).thenReturn(Material.STONE);
|
when(space1.getType()).thenReturn(Material.STONE);
|
||||||
assertFalse("Solid", manager.isSafeLocation(location));
|
assertFalse("Solid", im.isSafeLocation(location));
|
||||||
|
|
||||||
when(space1.getType()).thenReturn(Material.AIR);
|
when(space1.getType()).thenReturn(Material.AIR);
|
||||||
when(space2.getType()).thenReturn(Material.STONE);
|
when(space2.getType()).thenReturn(Material.STONE);
|
||||||
assertFalse("Solid", manager.isSafeLocation(location));
|
assertFalse("Solid", im.isSafeLocation(location));
|
||||||
|
|
||||||
when(space1.getType()).thenReturn(wallSign);
|
when(space1.getType()).thenReturn(wallSign);
|
||||||
when(space2.getType()).thenReturn(Material.AIR);
|
when(space2.getType()).thenReturn(Material.AIR);
|
||||||
assertTrue("Wall sign 1", manager.isSafeLocation(location));
|
assertTrue("Wall sign 1", im.isSafeLocation(location));
|
||||||
|
|
||||||
when(space1.getType()).thenReturn(Material.AIR);
|
when(space1.getType()).thenReturn(Material.AIR);
|
||||||
when(space2.getType()).thenReturn(wallSign);
|
when(space2.getType()).thenReturn(wallSign);
|
||||||
assertTrue("Wall sign 2", manager.isSafeLocation(location));
|
assertTrue("Wall sign 2", im.isSafeLocation(location));
|
||||||
|
|
||||||
when(space1.getType()).thenReturn(sign);
|
when(space1.getType()).thenReturn(sign);
|
||||||
when(space2.getType()).thenReturn(Material.AIR);
|
when(space2.getType()).thenReturn(Material.AIR);
|
||||||
assertTrue("Wall sign 1", manager.isSafeLocation(location));
|
assertTrue("Wall sign 1", im.isSafeLocation(location));
|
||||||
|
|
||||||
when(space1.getType()).thenReturn(Material.AIR);
|
when(space1.getType()).thenReturn(Material.AIR);
|
||||||
when(space2.getType()).thenReturn(sign);
|
when(space2.getType()).thenReturn(sign);
|
||||||
assertTrue("Wall sign 2", manager.isSafeLocation(location));
|
assertTrue("Wall sign 2", im.isSafeLocation(location));
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -505,32 +514,9 @@ public class IslandsManagerTest {
|
|||||||
*/
|
*/
|
||||||
@Test
|
@Test
|
||||||
public void testBigScan() {
|
public void testBigScan() {
|
||||||
IslandsManager manager = new IslandsManager(plugin);
|
|
||||||
|
|
||||||
Location location = mock(Location.class);
|
|
||||||
when(location.getWorld()).thenReturn(world);
|
|
||||||
when(location.getBlockX()).thenReturn(0);
|
|
||||||
when(location.getBlockY()).thenReturn(0);
|
|
||||||
when(location.getBlockZ()).thenReturn(0);
|
|
||||||
|
|
||||||
Block space1 = mock(Block.class);
|
|
||||||
Block ground = mock(Block.class);
|
|
||||||
Block space2 = mock(Block.class);
|
|
||||||
|
|
||||||
when(location.getBlock()).thenReturn(space1);
|
|
||||||
|
|
||||||
when(ground.getType()).thenReturn(Material.GRASS);
|
|
||||||
when(space1.getType()).thenReturn(Material.AIR);
|
|
||||||
when(space2.getType()).thenReturn(Material.AIR);
|
|
||||||
when(space1.getRelative(BlockFace.DOWN)).thenReturn(ground);
|
|
||||||
when(space1.getRelative(BlockFace.UP)).thenReturn(space2);
|
|
||||||
|
|
||||||
BlockState blockState = mock(BlockState.class);
|
|
||||||
when(ground.getState()).thenReturn(blockState);
|
|
||||||
|
|
||||||
// Negative value = full island scan
|
// Negative value = full island scan
|
||||||
// No island here yet
|
// No island here yet
|
||||||
assertNull(manager.bigScan(location, -1));
|
assertNull(im.bigScan(location, -1));
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -538,7 +524,6 @@ public class IslandsManagerTest {
|
|||||||
*/
|
*/
|
||||||
@Test
|
@Test
|
||||||
public void testCreateIslandLocation() {
|
public void testCreateIslandLocation() {
|
||||||
IslandsManager im = new IslandsManager(plugin);
|
|
||||||
Island island = im.createIsland(location);
|
Island island = im.createIsland(location);
|
||||||
assertNotNull(island);
|
assertNotNull(island);
|
||||||
assertEquals(island.getCenter().getWorld(), location.getWorld());
|
assertEquals(island.getCenter().getWorld(), location.getWorld());
|
||||||
@ -550,7 +535,6 @@ public class IslandsManagerTest {
|
|||||||
@Test
|
@Test
|
||||||
public void testCreateIslandLocationUUID() {
|
public void testCreateIslandLocationUUID() {
|
||||||
UUID owner = UUID.randomUUID();
|
UUID owner = UUID.randomUUID();
|
||||||
IslandsManager im = new IslandsManager(plugin);
|
|
||||||
Island island = im.createIsland(location, owner);
|
Island island = im.createIsland(location, owner);
|
||||||
assertNotNull(island);
|
assertNotNull(island);
|
||||||
assertEquals(island.getCenter().getWorld(), location.getWorld());
|
assertEquals(island.getCenter().getWorld(), location.getWorld());
|
||||||
@ -562,7 +546,6 @@ public class IslandsManagerTest {
|
|||||||
*/
|
*/
|
||||||
@Test
|
@Test
|
||||||
public void testDeleteIslandIslandBooleanNoBlockRemoval() {
|
public void testDeleteIslandIslandBooleanNoBlockRemoval() {
|
||||||
IslandsManager im = new IslandsManager(plugin);
|
|
||||||
UUID owner = UUID.randomUUID();
|
UUID owner = UUID.randomUUID();
|
||||||
Island island = im.createIsland(location, owner);
|
Island island = im.createIsland(location, owner);
|
||||||
im.deleteIsland(island, false, owner);
|
im.deleteIsland(island, false, owner);
|
||||||
@ -576,7 +559,6 @@ public class IslandsManagerTest {
|
|||||||
@Test
|
@Test
|
||||||
public void testDeleteIslandIslandBooleanRemoveBlocks() {
|
public void testDeleteIslandIslandBooleanRemoveBlocks() {
|
||||||
verify(pim, never()).callEvent(any());
|
verify(pim, never()).callEvent(any());
|
||||||
IslandsManager im = new IslandsManager(plugin);
|
|
||||||
UUID owner = UUID.randomUUID();
|
UUID owner = UUID.randomUUID();
|
||||||
Island island = im.createIsland(location, owner);
|
Island island = im.createIsland(location, owner);
|
||||||
im.deleteIsland(island, true, owner);
|
im.deleteIsland(island, true, owner);
|
||||||
@ -589,7 +571,6 @@ public class IslandsManagerTest {
|
|||||||
*/
|
*/
|
||||||
@Test
|
@Test
|
||||||
public void testGetCount() {
|
public void testGetCount() {
|
||||||
IslandsManager im = new IslandsManager(plugin);
|
|
||||||
assertEquals(0, im.getIslandCount());
|
assertEquals(0, im.getIslandCount());
|
||||||
im.createIsland(location, UUID.randomUUID());
|
im.createIsland(location, UUID.randomUUID());
|
||||||
assertEquals(1, im.getIslandCount());
|
assertEquals(1, im.getIslandCount());
|
||||||
@ -600,7 +581,6 @@ public class IslandsManagerTest {
|
|||||||
*/
|
*/
|
||||||
@Test
|
@Test
|
||||||
public void testGetIslandWorldUser() {
|
public void testGetIslandWorldUser() {
|
||||||
IslandsManager im = new IslandsManager(plugin);
|
|
||||||
Island island = im.createIsland(location, user.getUniqueId());
|
Island island = im.createIsland(location, user.getUniqueId());
|
||||||
assertEquals(island, im.getIsland(world, user));
|
assertEquals(island, im.getIsland(world, user));
|
||||||
assertNull(im.getIsland(world, (User)null));
|
assertNull(im.getIsland(world, (User)null));
|
||||||
@ -612,7 +592,6 @@ public class IslandsManagerTest {
|
|||||||
@Test
|
@Test
|
||||||
public void testGetIsland() {
|
public void testGetIsland() {
|
||||||
UUID owner = UUID.randomUUID();
|
UUID owner = UUID.randomUUID();
|
||||||
IslandsManager im = new IslandsManager(plugin);
|
|
||||||
Island island = im.createIsland(location, owner);
|
Island island = im.createIsland(location, owner);
|
||||||
assertEquals(island, im.getIsland(world, owner));
|
assertEquals(island, im.getIsland(world, owner));
|
||||||
assertNull(im.getIsland(world, UUID.randomUUID()));
|
assertNull(im.getIsland(world, UUID.randomUUID()));
|
||||||
@ -624,9 +603,7 @@ public class IslandsManagerTest {
|
|||||||
*/
|
*/
|
||||||
@Test
|
@Test
|
||||||
public void testGetIslandAtLocation() throws Exception {
|
public void testGetIslandAtLocation() throws Exception {
|
||||||
IslandsManager im = new IslandsManager(plugin);
|
|
||||||
im.setIslandCache(islandCache);
|
im.setIslandCache(islandCache);
|
||||||
|
|
||||||
// In world, correct island
|
// In world, correct island
|
||||||
assertEquals(optionalIsland, im.getIslandAt(location));
|
assertEquals(optionalIsland, im.getIslandAt(location));
|
||||||
|
|
||||||
@ -646,7 +623,6 @@ public class IslandsManagerTest {
|
|||||||
*/
|
*/
|
||||||
@Test
|
@Test
|
||||||
public void testGetIslandLocation() {
|
public void testGetIslandLocation() {
|
||||||
IslandsManager im = new IslandsManager(plugin);
|
|
||||||
im.createIsland(location, uuid);
|
im.createIsland(location, uuid);
|
||||||
assertEquals(world, im.getIslandLocation(world, uuid).getWorld());
|
assertEquals(world, im.getIslandLocation(world, uuid).getWorld());
|
||||||
assertNull(im.getIslandLocation(world, UUID.randomUUID()));
|
assertNull(im.getIslandLocation(world, UUID.randomUUID()));
|
||||||
@ -657,7 +633,6 @@ public class IslandsManagerTest {
|
|||||||
*/
|
*/
|
||||||
@Test
|
@Test
|
||||||
public void testGetLast() {
|
public void testGetLast() {
|
||||||
IslandsManager im = new IslandsManager(plugin);
|
|
||||||
im.setLast(location);
|
im.setLast(location);
|
||||||
assertEquals(location, im.getLast(world));
|
assertEquals(location, im.getLast(world));
|
||||||
assertNull(im.getLast(null));
|
assertNull(im.getLast(null));
|
||||||
@ -674,7 +649,6 @@ public class IslandsManagerTest {
|
|||||||
members.add(UUID.randomUUID());
|
members.add(UUID.randomUUID());
|
||||||
members.add(UUID.randomUUID());
|
members.add(UUID.randomUUID());
|
||||||
when(islandCache.getMembers(any(), any(), Mockito.anyInt())).thenReturn(members);
|
when(islandCache.getMembers(any(), any(), Mockito.anyInt())).thenReturn(members);
|
||||||
IslandsManager im = new IslandsManager(plugin);
|
|
||||||
im.setIslandCache(islandCache);
|
im.setIslandCache(islandCache);
|
||||||
assertEquals(members, im.getMembers(world, UUID.randomUUID()));
|
assertEquals(members, im.getMembers(world, UUID.randomUUID()));
|
||||||
}
|
}
|
||||||
@ -690,7 +664,7 @@ public class IslandsManagerTest {
|
|||||||
when(islandCache.getIslandAt(any(Location.class))).thenReturn(is);
|
when(islandCache.getIslandAt(any(Location.class))).thenReturn(is);
|
||||||
|
|
||||||
// In world
|
// In world
|
||||||
IslandsManager im = new IslandsManager(plugin);
|
|
||||||
im.setIslandCache(islandCache);
|
im.setIslandCache(islandCache);
|
||||||
|
|
||||||
Optional<Island> optionalIsland = Optional.ofNullable(is);
|
Optional<Island> optionalIsland = Optional.ofNullable(is);
|
||||||
@ -717,7 +691,6 @@ public class IslandsManagerTest {
|
|||||||
*/
|
*/
|
||||||
@Test
|
@Test
|
||||||
public void testGetSafeHomeLocation() {
|
public void testGetSafeHomeLocation() {
|
||||||
IslandsManager im = new IslandsManager(plugin);
|
|
||||||
when(pm.getHomeLocation(any(), any(User.class), eq(0))).thenReturn(null);
|
when(pm.getHomeLocation(any(), any(User.class), eq(0))).thenReturn(null);
|
||||||
when(pm.getHomeLocation(any(), any(User.class), eq(1))).thenReturn(location);
|
when(pm.getHomeLocation(any(), any(User.class), eq(1))).thenReturn(location);
|
||||||
assertEquals(location, im.getSafeHomeLocation(world, user, 0));
|
assertEquals(location, im.getSafeHomeLocation(world, user, 0));
|
||||||
@ -731,7 +704,6 @@ public class IslandsManagerTest {
|
|||||||
*/
|
*/
|
||||||
@Test
|
@Test
|
||||||
public void testGetSafeHomeLocationWorldNotIslandWorld() {
|
public void testGetSafeHomeLocationWorldNotIslandWorld() {
|
||||||
IslandsManager im = new IslandsManager(plugin);
|
|
||||||
when(iwm.inWorld(world)).thenReturn(false);
|
when(iwm.inWorld(world)).thenReturn(false);
|
||||||
assertNull(im.getSafeHomeLocation(world, user, 0));
|
assertNull(im.getSafeHomeLocation(world, user, 0));
|
||||||
}
|
}
|
||||||
@ -741,7 +713,6 @@ public class IslandsManagerTest {
|
|||||||
*/
|
*/
|
||||||
@Test
|
@Test
|
||||||
public void testGetSafeHomeLocationNoIsland() {
|
public void testGetSafeHomeLocationNoIsland() {
|
||||||
IslandsManager im = new IslandsManager(plugin);
|
|
||||||
when(pm.getHomeLocation(eq(world), eq(user), eq(0))).thenReturn(null);
|
when(pm.getHomeLocation(eq(world), eq(user), eq(0))).thenReturn(null);
|
||||||
assertNull(im.getSafeHomeLocation(world, user, 0));
|
assertNull(im.getSafeHomeLocation(world, user, 0));
|
||||||
verify(plugin).logWarning(eq("null player has no island in world world!"));
|
verify(plugin).logWarning(eq("null player has no island in world world!"));
|
||||||
@ -752,7 +723,6 @@ public class IslandsManagerTest {
|
|||||||
*/
|
*/
|
||||||
@Test
|
@Test
|
||||||
public void testGetSpawnPoint() {
|
public void testGetSpawnPoint() {
|
||||||
IslandsManager im = new IslandsManager(plugin);
|
|
||||||
assertNull(im.getSpawnPoint(world));
|
assertNull(im.getSpawnPoint(world));
|
||||||
// Create a spawn island for this world
|
// Create a spawn island for this world
|
||||||
Island island = mock(Island.class);
|
Island island = mock(Island.class);
|
||||||
@ -771,7 +741,6 @@ public class IslandsManagerTest {
|
|||||||
@Test
|
@Test
|
||||||
public void testHomeTeleportPlayerInt() {
|
public void testHomeTeleportPlayerInt() {
|
||||||
when(iwm.getDefaultGameMode(world)).thenReturn(GameMode.SURVIVAL);
|
when(iwm.getDefaultGameMode(world)).thenReturn(GameMode.SURVIVAL);
|
||||||
IslandsManager im = new IslandsManager(plugin);
|
|
||||||
when(pm.getHomeLocation(any(), any(User.class), eq(0))).thenReturn(null);
|
when(pm.getHomeLocation(any(), any(User.class), eq(0))).thenReturn(null);
|
||||||
when(pm.getHomeLocation(any(), any(User.class), eq(1))).thenReturn(location);
|
when(pm.getHomeLocation(any(), any(User.class), eq(1))).thenReturn(location);
|
||||||
im.homeTeleport(world, player, 0);
|
im.homeTeleport(world, player, 0);
|
||||||
@ -784,7 +753,6 @@ public class IslandsManagerTest {
|
|||||||
*/
|
*/
|
||||||
@Test
|
@Test
|
||||||
public void testIsAtSpawn() {
|
public void testIsAtSpawn() {
|
||||||
IslandsManager im = new IslandsManager(plugin);
|
|
||||||
assertFalse(im.isAtSpawn(location));
|
assertFalse(im.isAtSpawn(location));
|
||||||
Island island = mock(Island.class);
|
Island island = mock(Island.class);
|
||||||
when(island.getWorld()).thenReturn(world);
|
when(island.getWorld()).thenReturn(world);
|
||||||
@ -803,7 +771,7 @@ public class IslandsManagerTest {
|
|||||||
|
|
||||||
when(islandCache.getIslandAt(any())).thenReturn(is);
|
when(islandCache.getIslandAt(any())).thenReturn(is);
|
||||||
|
|
||||||
IslandsManager im = new IslandsManager(plugin);
|
|
||||||
im.setIslandCache(islandCache);
|
im.setIslandCache(islandCache);
|
||||||
|
|
||||||
assertFalse(im.isOwner(world, null));
|
assertFalse(im.isOwner(world, null));
|
||||||
@ -828,7 +796,7 @@ public class IslandsManagerTest {
|
|||||||
*/
|
*/
|
||||||
@Test
|
@Test
|
||||||
public void testLoad() {
|
public void testLoad() {
|
||||||
//IslandsManager im = new IslandsManager(plugin);
|
//
|
||||||
//im.load();
|
//im.load();
|
||||||
|
|
||||||
}
|
}
|
||||||
@ -852,7 +820,7 @@ public class IslandsManagerTest {
|
|||||||
|
|
||||||
when(player.getUniqueId()).thenReturn(uuid);
|
when(player.getUniqueId()).thenReturn(uuid);
|
||||||
|
|
||||||
IslandsManager im = new IslandsManager(plugin);
|
|
||||||
im.setIslandCache(islandCache);
|
im.setIslandCache(islandCache);
|
||||||
|
|
||||||
assertFalse(im.locationIsOnIsland(null, null));
|
assertFalse(im.locationIsOnIsland(null, null));
|
||||||
@ -875,7 +843,6 @@ public class IslandsManagerTest {
|
|||||||
*/
|
*/
|
||||||
@Test
|
@Test
|
||||||
public void testUserIsOnIsland() {
|
public void testUserIsOnIsland() {
|
||||||
IslandsManager im = new IslandsManager(plugin);
|
|
||||||
im.setIslandCache(islandCache);
|
im.setIslandCache(islandCache);
|
||||||
|
|
||||||
// ----- CHECK INVALID ARGUMENTS -----
|
// ----- CHECK INVALID ARGUMENTS -----
|
||||||
@ -899,9 +866,9 @@ public class IslandsManagerTest {
|
|||||||
when(user.isPlayer()).thenReturn(true);
|
when(user.isPlayer()).thenReturn(true);
|
||||||
|
|
||||||
// The method returns true if the user's location is on an island that has them as member (rank >= MEMBER)
|
// The method returns true if the user's location is on an island that has them as member (rank >= MEMBER)
|
||||||
when(is.onIsland(any())).thenReturn(true);
|
when(island.onIsland(any())).thenReturn(true);
|
||||||
Map<UUID, Integer> members = new HashMap<>();
|
Map<UUID, Integer> members = new HashMap<>();
|
||||||
when(is.getMembers()).thenReturn(members);
|
when(island.getMembers()).thenReturn(members);
|
||||||
|
|
||||||
// -- The user is not part of the island --
|
// -- The user is not part of the island --
|
||||||
assertFalse(im.userIsOnIsland(world, user));
|
assertFalse(im.userIsOnIsland(world, user));
|
||||||
@ -968,7 +935,7 @@ public class IslandsManagerTest {
|
|||||||
*/
|
*/
|
||||||
@Test
|
@Test
|
||||||
public void testRemovePlayer() {
|
public void testRemovePlayer() {
|
||||||
IslandsManager im = new IslandsManager(plugin);
|
|
||||||
im.removePlayer(world, uuid);
|
im.removePlayer(world, uuid);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -977,7 +944,7 @@ public class IslandsManagerTest {
|
|||||||
*/
|
*/
|
||||||
@Test
|
@Test
|
||||||
public void testRemovePlayersFromIsland() {
|
public void testRemovePlayersFromIsland() {
|
||||||
IslandsManager im = new IslandsManager(plugin);
|
|
||||||
Island is = mock(Island.class);
|
Island is = mock(Island.class);
|
||||||
im.removePlayersFromIsland(is);
|
im.removePlayersFromIsland(is);
|
||||||
}
|
}
|
||||||
@ -1033,7 +1000,7 @@ public class IslandsManagerTest {
|
|||||||
Collection<Island> collection = new ArrayList<>();
|
Collection<Island> collection = new ArrayList<>();
|
||||||
collection.add(is);
|
collection.add(is);
|
||||||
when(islandCache.getIslands()).thenReturn(collection);
|
when(islandCache.getIslands()).thenReturn(collection);
|
||||||
IslandsManager im = new IslandsManager(plugin);
|
|
||||||
im.setIslandCache(islandCache);
|
im.setIslandCache(islandCache);
|
||||||
Map<UUID, Integer> members = new HashMap<>();
|
Map<UUID, Integer> members = new HashMap<>();
|
||||||
when(is.getMembers()).thenReturn(members);
|
when(is.getMembers()).thenReturn(members);
|
||||||
@ -1072,7 +1039,7 @@ public class IslandsManagerTest {
|
|||||||
Collection<Island> collection = new ArrayList<>();
|
Collection<Island> collection = new ArrayList<>();
|
||||||
collection.add(is);
|
collection.add(is);
|
||||||
when(islandCache.getIslands()).thenReturn(collection);
|
when(islandCache.getIslands()).thenReturn(collection);
|
||||||
IslandsManager im = new IslandsManager(plugin);
|
|
||||||
im.setIslandCache(islandCache);
|
im.setIslandCache(islandCache);
|
||||||
Map<UUID, Integer> members = new HashMap<>();
|
Map<UUID, Integer> members = new HashMap<>();
|
||||||
when(is.getMembers()).thenReturn(members);
|
when(is.getMembers()).thenReturn(members);
|
||||||
@ -1109,7 +1076,6 @@ public class IslandsManagerTest {
|
|||||||
@Test
|
@Test
|
||||||
public void testClearAreaWrongWorld() {
|
public void testClearAreaWrongWorld() {
|
||||||
when(iwm.inWorld(any(Location.class))).thenReturn(false);
|
when(iwm.inWorld(any(Location.class))).thenReturn(false);
|
||||||
IslandsManager im = new IslandsManager(plugin);
|
|
||||||
im.clearArea(location);
|
im.clearArea(location);
|
||||||
// No entities should be cleared
|
// No entities should be cleared
|
||||||
verify(zombie, never()).remove();
|
verify(zombie, never()).remove();
|
||||||
@ -1128,7 +1094,6 @@ public class IslandsManagerTest {
|
|||||||
*/
|
*/
|
||||||
@Test
|
@Test
|
||||||
public void testClearArea() {
|
public void testClearArea() {
|
||||||
IslandsManager im = new IslandsManager(plugin);
|
|
||||||
im.clearArea(location);
|
im.clearArea(location);
|
||||||
// Only the correct entities should be cleared
|
// Only the correct entities should be cleared
|
||||||
verify(zombie).remove();
|
verify(zombie).remove();
|
||||||
@ -1150,7 +1115,6 @@ public class IslandsManagerTest {
|
|||||||
String uuid = UUID.randomUUID().toString();
|
String uuid = UUID.randomUUID().toString();
|
||||||
when(islandCache.getIslandById(anyString())).thenReturn(island);
|
when(islandCache.getIslandById(anyString())).thenReturn(island);
|
||||||
// Test
|
// Test
|
||||||
IslandsManager im = new IslandsManager(plugin);
|
|
||||||
im.setIslandCache(islandCache);
|
im.setIslandCache(islandCache);
|
||||||
assertEquals(island, im.getIslandById(uuid).get());
|
assertEquals(island, im.getIslandById(uuid).get());
|
||||||
}
|
}
|
||||||
@ -1178,7 +1142,6 @@ public class IslandsManagerTest {
|
|||||||
// Island distance
|
// Island distance
|
||||||
when(iwm.getIslandDistance(eq(world))).thenReturn(100);
|
when(iwm.getIslandDistance(eq(world))).thenReturn(100);
|
||||||
// Test
|
// Test
|
||||||
IslandsManager im = new IslandsManager(plugin);
|
|
||||||
assertFalse(im.fixIslandCenter(island));
|
assertFalse(im.fixIslandCenter(island));
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1206,7 +1169,6 @@ public class IslandsManagerTest {
|
|||||||
when(iwm.getIslandDistance(eq(world))).thenReturn(100);
|
when(iwm.getIslandDistance(eq(world))).thenReturn(100);
|
||||||
// Test
|
// Test
|
||||||
ArgumentCaptor<Location> captor = ArgumentCaptor.forClass(Location.class);
|
ArgumentCaptor<Location> captor = ArgumentCaptor.forClass(Location.class);
|
||||||
IslandsManager im = new IslandsManager(plugin);
|
|
||||||
assertTrue(im.fixIslandCenter(island));
|
assertTrue(im.fixIslandCenter(island));
|
||||||
// Verify location
|
// Verify location
|
||||||
verify(island).setCenter(captor.capture());
|
verify(island).setCenter(captor.capture());
|
||||||
@ -1241,7 +1203,6 @@ public class IslandsManagerTest {
|
|||||||
when(iwm.getIslandDistance(eq(world))).thenReturn(100);
|
when(iwm.getIslandDistance(eq(world))).thenReturn(100);
|
||||||
// Test
|
// Test
|
||||||
ArgumentCaptor<Location> captor = ArgumentCaptor.forClass(Location.class);
|
ArgumentCaptor<Location> captor = ArgumentCaptor.forClass(Location.class);
|
||||||
IslandsManager im = new IslandsManager(plugin);
|
|
||||||
assertTrue(im.fixIslandCenter(island));
|
assertTrue(im.fixIslandCenter(island));
|
||||||
// Verify location
|
// Verify location
|
||||||
verify(island).setCenter(captor.capture());
|
verify(island).setCenter(captor.capture());
|
||||||
@ -1275,7 +1236,6 @@ public class IslandsManagerTest {
|
|||||||
// Island distance
|
// Island distance
|
||||||
when(iwm.getIslandDistance(eq(world))).thenReturn(100);
|
when(iwm.getIslandDistance(eq(world))).thenReturn(100);
|
||||||
// Test
|
// Test
|
||||||
IslandsManager im = new IslandsManager(plugin);
|
|
||||||
assertFalse(im.fixIslandCenter(island));
|
assertFalse(im.fixIslandCenter(island));
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1302,7 +1262,6 @@ public class IslandsManagerTest {
|
|||||||
// Island distance
|
// Island distance
|
||||||
when(iwm.getIslandDistance(eq(world))).thenReturn(100);
|
when(iwm.getIslandDistance(eq(world))).thenReturn(100);
|
||||||
// Test
|
// Test
|
||||||
IslandsManager im = new IslandsManager(plugin);
|
|
||||||
assertFalse(im.fixIslandCenter(island));
|
assertFalse(im.fixIslandCenter(island));
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1330,7 +1289,6 @@ public class IslandsManagerTest {
|
|||||||
when(iwm.getIslandDistance(eq(world))).thenReturn(100);
|
when(iwm.getIslandDistance(eq(world))).thenReturn(100);
|
||||||
// Test
|
// Test
|
||||||
ArgumentCaptor<Location> captor = ArgumentCaptor.forClass(Location.class);
|
ArgumentCaptor<Location> captor = ArgumentCaptor.forClass(Location.class);
|
||||||
IslandsManager im = new IslandsManager(plugin);
|
|
||||||
assertTrue(im.fixIslandCenter(island));
|
assertTrue(im.fixIslandCenter(island));
|
||||||
// Verify location
|
// Verify location
|
||||||
verify(island).setCenter(captor.capture());
|
verify(island).setCenter(captor.capture());
|
||||||
@ -1348,7 +1306,6 @@ public class IslandsManagerTest {
|
|||||||
Island island = mock(Island.class);
|
Island island = mock(Island.class);
|
||||||
when(island.getWorld()).thenReturn(null);
|
when(island.getWorld()).thenReturn(null);
|
||||||
// Test
|
// Test
|
||||||
IslandsManager im = new IslandsManager(plugin);
|
|
||||||
assertFalse(im.fixIslandCenter(island));
|
assertFalse(im.fixIslandCenter(island));
|
||||||
when(island.getWorld()).thenReturn(world);
|
when(island.getWorld()).thenReturn(world);
|
||||||
when(island.getCenter()).thenReturn(null);
|
when(island.getCenter()).thenReturn(null);
|
||||||
@ -1366,7 +1323,6 @@ public class IslandsManagerTest {
|
|||||||
Island island = mock(Island.class);
|
Island island = mock(Island.class);
|
||||||
when(island.getOwner()).thenReturn(null);
|
when(island.getOwner()).thenReturn(null);
|
||||||
// Test
|
// Test
|
||||||
IslandsManager im = new IslandsManager(plugin);
|
|
||||||
assertEquals(0, im.getMaxMembers(island, RanksManager.MEMBER_RANK));
|
assertEquals(0, im.getMaxMembers(island, RanksManager.MEMBER_RANK));
|
||||||
verify(island).setMaxMembers(eq(null));
|
verify(island).setMaxMembers(eq(null));
|
||||||
}
|
}
|
||||||
@ -1380,11 +1336,11 @@ public class IslandsManagerTest {
|
|||||||
when(island.getOwner()).thenReturn(uuid);
|
when(island.getOwner()).thenReturn(uuid);
|
||||||
when(island.getWorld()).thenReturn(world);
|
when(island.getWorld()).thenReturn(world);
|
||||||
when(island.getMaxMembers()).thenReturn(null);
|
when(island.getMaxMembers()).thenReturn(null);
|
||||||
|
when(island.getMaxMembers(Mockito.anyInt())).thenReturn(null);
|
||||||
when(iwm.getMaxTeamSize(eq(world))).thenReturn(4);
|
when(iwm.getMaxTeamSize(eq(world))).thenReturn(4);
|
||||||
// Offline owner
|
// Offline owner
|
||||||
when(Bukkit.getPlayer(any(UUID.class))).thenReturn(null);
|
when(Bukkit.getPlayer(any(UUID.class))).thenReturn(null);
|
||||||
// Test
|
// Test
|
||||||
IslandsManager im = new IslandsManager(plugin);
|
|
||||||
assertEquals(4, im.getMaxMembers(island, RanksManager.MEMBER_RANK));
|
assertEquals(4, im.getMaxMembers(island, RanksManager.MEMBER_RANK));
|
||||||
verify(island).setMaxMembers(eq(RanksManager.MEMBER_RANK), eq(null));
|
verify(island).setMaxMembers(eq(RanksManager.MEMBER_RANK), eq(null));
|
||||||
}
|
}
|
||||||
@ -1398,11 +1354,11 @@ public class IslandsManagerTest {
|
|||||||
when(island.getOwner()).thenReturn(uuid);
|
when(island.getOwner()).thenReturn(uuid);
|
||||||
when(island.getWorld()).thenReturn(world);
|
when(island.getWorld()).thenReturn(world);
|
||||||
when(island.getMaxMembers()).thenReturn(null);
|
when(island.getMaxMembers()).thenReturn(null);
|
||||||
|
when(island.getMaxMembers(Mockito.anyInt())).thenReturn(null);
|
||||||
when(iwm.getMaxTeamSize(eq(world))).thenReturn(4);
|
when(iwm.getMaxTeamSize(eq(world))).thenReturn(4);
|
||||||
// Online owner
|
// Online owner
|
||||||
when(Bukkit.getPlayer(any(UUID.class))).thenReturn(player);
|
when(Bukkit.getPlayer(any(UUID.class))).thenReturn(player);
|
||||||
// Test
|
// Test
|
||||||
IslandsManager im = new IslandsManager(plugin);
|
|
||||||
assertEquals(4, im.getMaxMembers(island, RanksManager.MEMBER_RANK));
|
assertEquals(4, im.getMaxMembers(island, RanksManager.MEMBER_RANK));
|
||||||
verify(island).setMaxMembers(eq(RanksManager.MEMBER_RANK), eq(null));
|
verify(island).setMaxMembers(eq(RanksManager.MEMBER_RANK), eq(null));
|
||||||
}
|
}
|
||||||
@ -1416,13 +1372,13 @@ public class IslandsManagerTest {
|
|||||||
when(island.getOwner()).thenReturn(uuid);
|
when(island.getOwner()).thenReturn(uuid);
|
||||||
when(island.getWorld()).thenReturn(world);
|
when(island.getWorld()).thenReturn(world);
|
||||||
when(island.getMaxMembers()).thenReturn(null);
|
when(island.getMaxMembers()).thenReturn(null);
|
||||||
|
when(island.getMaxMembers(Mockito.anyInt())).thenReturn(null);
|
||||||
when(iwm.getMaxTeamSize(eq(world))).thenReturn(4);
|
when(iwm.getMaxTeamSize(eq(world))).thenReturn(4);
|
||||||
when(iwm.getMaxCoopSize(eq(world))).thenReturn(2);
|
when(iwm.getMaxCoopSize(eq(world))).thenReturn(2);
|
||||||
when(iwm.getMaxTrustSize(eq(world))).thenReturn(3);
|
when(iwm.getMaxTrustSize(eq(world))).thenReturn(3);
|
||||||
// Online owner
|
// Online owner
|
||||||
when(Bukkit.getPlayer(any(UUID.class))).thenReturn(player);
|
when(Bukkit.getPlayer(any(UUID.class))).thenReturn(player);
|
||||||
// Test
|
// Test
|
||||||
IslandsManager im = new IslandsManager(plugin);
|
|
||||||
assertEquals(2, im.getMaxMembers(island, RanksManager.COOP_RANK));
|
assertEquals(2, im.getMaxMembers(island, RanksManager.COOP_RANK));
|
||||||
verify(island).setMaxMembers(eq(RanksManager.COOP_RANK), eq(null));
|
verify(island).setMaxMembers(eq(RanksManager.COOP_RANK), eq(null));
|
||||||
assertEquals(3, im.getMaxMembers(island, RanksManager.TRUSTED_RANK));
|
assertEquals(3, im.getMaxMembers(island, RanksManager.TRUSTED_RANK));
|
||||||
@ -1442,7 +1398,6 @@ public class IslandsManagerTest {
|
|||||||
// Online owner
|
// Online owner
|
||||||
when(Bukkit.getPlayer(any(UUID.class))).thenReturn(player);
|
when(Bukkit.getPlayer(any(UUID.class))).thenReturn(player);
|
||||||
// Test
|
// Test
|
||||||
IslandsManager im = new IslandsManager(plugin);
|
|
||||||
assertEquals(10, im.getMaxMembers(island, RanksManager.MEMBER_RANK));
|
assertEquals(10, im.getMaxMembers(island, RanksManager.MEMBER_RANK));
|
||||||
verify(island).setMaxMembers(eq(RanksManager.MEMBER_RANK), eq(10));
|
verify(island).setMaxMembers(eq(RanksManager.MEMBER_RANK), eq(10));
|
||||||
}
|
}
|
||||||
@ -1460,7 +1415,6 @@ public class IslandsManagerTest {
|
|||||||
// Online owner
|
// Online owner
|
||||||
when(Bukkit.getPlayer(any(UUID.class))).thenReturn(player);
|
when(Bukkit.getPlayer(any(UUID.class))).thenReturn(player);
|
||||||
// Test
|
// Test
|
||||||
IslandsManager im = new IslandsManager(plugin);
|
|
||||||
assertEquals(10, im.getMaxMembers(island, RanksManager.MEMBER_RANK));
|
assertEquals(10, im.getMaxMembers(island, RanksManager.MEMBER_RANK));
|
||||||
verify(island).setMaxMembers(eq(RanksManager.MEMBER_RANK), eq(10));
|
verify(island).setMaxMembers(eq(RanksManager.MEMBER_RANK), eq(10));
|
||||||
}
|
}
|
||||||
@ -1485,7 +1439,6 @@ public class IslandsManagerTest {
|
|||||||
// Online owner
|
// Online owner
|
||||||
when(Bukkit.getPlayer(any(UUID.class))).thenReturn(player);
|
when(Bukkit.getPlayer(any(UUID.class))).thenReturn(player);
|
||||||
// Test
|
// Test
|
||||||
IslandsManager im = new IslandsManager(plugin);
|
|
||||||
assertEquals(8, im.getMaxMembers(island, RanksManager.MEMBER_RANK));
|
assertEquals(8, im.getMaxMembers(island, RanksManager.MEMBER_RANK));
|
||||||
verify(island).setMaxMembers(eq(RanksManager.MEMBER_RANK), eq(8));
|
verify(island).setMaxMembers(eq(RanksManager.MEMBER_RANK), eq(8));
|
||||||
}
|
}
|
||||||
@ -1498,7 +1451,6 @@ public class IslandsManagerTest {
|
|||||||
public void testsetMaxMembers() {
|
public void testsetMaxMembers() {
|
||||||
Island island = mock(Island.class);
|
Island island = mock(Island.class);
|
||||||
// Test
|
// Test
|
||||||
IslandsManager im = new IslandsManager(plugin);
|
|
||||||
im.setMaxMembers(island, RanksManager.MEMBER_RANK, 40);
|
im.setMaxMembers(island, RanksManager.MEMBER_RANK, 40);
|
||||||
verify(island).setMaxMembers(eq(RanksManager.MEMBER_RANK), eq(40));
|
verify(island).setMaxMembers(eq(RanksManager.MEMBER_RANK), eq(40));
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user