Revert "Fixed IslandCacheTest"

This reverts commit 8fb4e58994.
This commit is contained in:
Florian CUNY 2018-08-15 09:51:41 +02:00
parent d926873992
commit 82ebc8b018
2 changed files with 15 additions and 10 deletions

View File

@ -67,14 +67,11 @@ public class IslandGrid {
* @return Island or null
*/
public Island getIslandAt(int x, int z) {
Table.Cell<Integer, Integer, Cell> tableCell = grid.cellSet()
.stream()
.filter(cell -> (cell.getValue().getState().equals(CellState.OCCUPIED)))
.filter(cell -> ((Island) cell.getValue().getObject()).inIslandSpace(x, z))
.findFirst().orElse(null);
if (tableCell != null) {
return (Island) tableCell.getValue().getObject();
if (grid.contains(x, z)) {
Cell cell = grid.get(x, z);
if (cell.getState().equals(CellState.OCCUPIED)) {
return (Island) cell.getObject();
}
}
return null;
}
@ -104,7 +101,7 @@ public class IslandGrid {
* @author Poslovitch
*/
private enum CellState {
//RESERVED,
RESERVED,
OCCUPIED
}
}

View File

@ -61,6 +61,8 @@ public class IslandCacheTest {
IslandsManager im = mock(IslandsManager.class);
when(plugin.getIslands()).thenReturn(im);
island = mock(Island.class);
when(island.getWorld()).thenReturn(world);
location = mock(Location.class);
@ -195,8 +197,14 @@ public class IslandCacheTest {
assertNull(ic.getIslandAt(location2));
}
/*
@Test
public void testGetMembers() {
public void testGetIslands() {
fail("Not yet implemented"); // TODO
}
*/
@Test
public void testgetMembers() {
// New cache
IslandCache ic = new IslandCache();
ic.addIsland(island);