diff --git a/src/test/java/world/bentobox/border/BorderTest.java b/src/test/java/world/bentobox/border/BorderTest.java index b6e2ee2..a313258 100644 --- a/src/test/java/world/bentobox/border/BorderTest.java +++ b/src/test/java/world/bentobox/border/BorderTest.java @@ -14,6 +14,8 @@ import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Test; +import org.bukkit.World.Environment; + import world.bentobox.bentobox.api.addons.GameModeAddon; import world.bentobox.bentobox.util.Util; @@ -51,6 +53,44 @@ public void testInGameWorldReturnsFalseWhenNoGameModeMatches() throws Exception assertFalse(border.inGameWorld(world)); } + @Test + public void testInGameWorldReturnsFalseForVanillaNether() { + when(world.getEnvironment()).thenReturn(Environment.NETHER); + when(iwm.isIslandNether(world)).thenReturn(false); + + assertFalse(border.inGameWorld(world)); + } + + @Test + public void testInGameWorldReturnsFalseForVanillaEnd() { + when(world.getEnvironment()).thenReturn(Environment.THE_END); + when(iwm.isIslandEnd(world)).thenReturn(false); + + assertFalse(border.inGameWorld(world)); + } + + @Test + public void testInGameWorldDelegatesToGameModeForIslandNether() throws Exception { + when(world.getEnvironment()).thenReturn(Environment.NETHER); + when(iwm.isIslandNether(world)).thenReturn(true); + GameModeAddon matching = mock(GameModeAddon.class); + when(matching.inWorld(world)).thenReturn(true); + getGameModes().add(matching); + + assertTrue(border.inGameWorld(world)); + } + + @Test + public void testInGameWorldDelegatesToGameModeForIslandEnd() throws Exception { + when(world.getEnvironment()).thenReturn(Environment.THE_END); + when(iwm.isIslandEnd(world)).thenReturn(true); + GameModeAddon matching = mock(GameModeAddon.class); + when(matching.inWorld(world)).thenReturn(true); + getGameModes().add(matching); + + assertTrue(border.inGameWorld(world)); + } + @Test public void testGetAvailableBorderTypesViewIsUnmodifiable() { Set view = border.getAvailableBorderTypesView();