Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
40 changes: 40 additions & 0 deletions src/test/java/world/bentobox/border/BorderTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Expand Down Expand Up @@ -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<BorderType> view = border.getAvailableBorderTypesView();
Expand Down