mirror of
https://github.com/BentoBoxWorld/BentoBox.git
synced 2024-11-27 05:05:18 +01:00
Fixed EnterExitListener test class.
Added island.isOwned() mocking. Added 2 test cases to handle unowned island testing.
This commit is contained in:
parent
3e81b4a3cf
commit
eb06b39b4a
@ -136,6 +136,7 @@ public class EnterExitListenerTest {
|
||||
when(island.getCenter()).thenReturn(loc);
|
||||
when(island.getProtectionRange()).thenReturn(PROTECTION_RANGE);
|
||||
when(island.getOwner()).thenReturn(uuid);
|
||||
when(island.isOwned()).thenReturn(true);
|
||||
|
||||
when(im.getIsland(any(), any(UUID.class))).thenReturn(island);
|
||||
|
||||
@ -348,4 +349,31 @@ public class EnterExitListenerTest {
|
||||
verify(pim).callEvent(any(IslandExitEvent.class));
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Test method for {@link EnterExitListener#onTeleport(org.bukkit.event.player.PlayerTeleportEvent)}.
|
||||
*/
|
||||
@Test
|
||||
public void testEnterIslandTeleportUnowned() {
|
||||
when(island.isOwned()).thenReturn(false);
|
||||
PlayerTeleportEvent e = new PlayerTeleportEvent(user.getPlayer(), anotherWorld, inside, TeleportCause.PLUGIN);
|
||||
listener.onTeleport(e);
|
||||
verify(notifier, never()).notify(any(User.class), anyString());
|
||||
verify(pim).callEvent(any(IslandEnterEvent.class));
|
||||
verify(pim, never()).callEvent(any(IslandExitEvent.class));
|
||||
}
|
||||
|
||||
/**
|
||||
* Test method for {@link EnterExitListener#onTeleport(org.bukkit.event.player.PlayerTeleportEvent)}.
|
||||
*/
|
||||
@Test
|
||||
public void testExitIslandTeleportUnowned() {
|
||||
when(island.isOwned()).thenReturn(false);
|
||||
PlayerTeleportEvent e = new PlayerTeleportEvent(user.getPlayer(), inside, anotherWorld, TeleportCause.PLUGIN);
|
||||
listener.onTeleport(e);
|
||||
verify(notifier, never()).notify(any(User.class), anyString());
|
||||
verify(pim, never()).callEvent(any(IslandEnterEvent.class));
|
||||
verify(pim).callEvent(any(IslandExitEvent.class));
|
||||
}
|
||||
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user