use of org.bukkit.event.player.PlayerEvent in project AuthMeReloaded by AuthMe.
the class ListenerServiceTest method shouldHandlePlayerEventWithNullPlayer.
@Test
public void shouldHandlePlayerEventWithNullPlayer() {
// given
PlayerEvent event = new TestPlayerEvent(null);
// when
boolean result = listenerService.shouldCancelEvent(event);
// then
assertThat(result, equalTo(false));
}
use of org.bukkit.event.player.PlayerEvent in project AuthMeReloaded by AuthMe.
the class ListenerServiceTest method shouldHandlePlayerEvent.
@Test
public // This simply forwards to shouldCancelEvent(Player), so the rest is already tested
void shouldHandlePlayerEvent() {
// given
String playerName = "example";
Player player = mockPlayerWithName(playerName);
PlayerEvent event = new TestPlayerEvent(player);
given(playerCache.isAuthenticated(playerName)).willReturn(true);
// when
boolean result = listenerService.shouldCancelEvent(event);
// then
assertThat(result, equalTo(false));
verify(playerCache).isAuthenticated(playerName);
verifyZeroInteractions(dataSource);
}
Aggregations