Fix tests

This commit is contained in:
tastybento 2019-05-26 17:35:19 -07:00
parent 7882a77b14
commit f5338bfaac
3 changed files with 7 additions and 0 deletions

View File

@ -67,6 +67,7 @@ public class PlayersTest {
Location l = mock(Location.class);
World w = mock(World.class);
when(w.getName()).thenReturn("world");
when(w.getEnvironment()).thenReturn(World.Environment.NORMAL);
when(l.getWorld()).thenReturn(w);
p.setHomeLocation(l, 5);
assertEquals(l, p.getHomeLocation(w, 5));

View File

@ -3,6 +3,7 @@ package world.bentobox.bentobox.managers;
import com.google.common.collect.ImmutableSet;
import com.google.common.collect.ImmutableSet.Builder;
import org.bukkit.Bukkit;
import org.bukkit.Chunk;
import org.bukkit.GameMode;
import org.bukkit.Location;
import org.bukkit.Material;
@ -149,6 +150,8 @@ public class IslandsManagerTest {
when(location.getWorld()).thenReturn(world);
when(location.getBlock()).thenReturn(space1);
when(location.getWorld()).thenReturn(world);
Chunk chunk = mock(Chunk.class);
when(location.getChunk()).thenReturn(chunk);
when(space1.getRelative(BlockFace.DOWN)).thenReturn(ground);
when(space1.getRelative(BlockFace.UP)).thenReturn(space2);
// A safe spot

View File

@ -80,10 +80,13 @@ public class PlayersManagerTest {
IslandWorldManager iwm = mock(IslandWorldManager.class);
world = mock(World.class);
when(world.getName()).thenReturn("world");
when(world.getEnvironment()).thenReturn(World.Environment.NORMAL);
nether = mock(World.class);
when(nether.getName()).thenReturn("world_nether");
when(nether.getEnvironment()).thenReturn(World.Environment.NETHER);
end = mock(World.class);
when(end.getName()).thenReturn("world_the_end");
when(end.getEnvironment()).thenReturn(World.Environment.THE_END);
when(iwm.inWorld(any(World.class))).thenReturn(true);
when(iwm.inWorld(any(Location.class))).thenReturn(true);
when(plugin.getIWM()).thenReturn(iwm);