use of org.bukkit.Location in project AuthMeReloaded by AuthMe.
the class SetFirstSpawnCommandTest method shouldSetFirstSpawn.
@Test
public void shouldSetFirstSpawn() {
// given
Player player = mock(Player.class);
Location location = mock(Location.class);
given(player.getLocation()).willReturn(location);
given(spawnLoader.setFirstSpawn(location)).willReturn(true);
// when
command.executeCommand(player, Collections.emptyList());
// then
verify(spawnLoader).setFirstSpawn(location);
verify(player).sendMessage(argThat(containsString("defined new first spawn")));
}
use of org.bukkit.Location in project AuthMeReloaded by AuthMe.
the class SetSpawnCommandTest method shouldHandleError.
@Test
public void shouldHandleError() {
// given
Player player = mock(Player.class);
Location location = mock(Location.class);
given(player.getLocation()).willReturn(location);
given(spawnLoader.setSpawn(location)).willReturn(false);
// when
command.executeCommand(player, Collections.emptyList());
// then
verify(spawnLoader).setSpawn(location);
verify(player).sendMessage(argThat(containsString("has failed")));
}
use of org.bukkit.Location in project AuthMeReloaded by AuthMe.
the class SpawnCommandTest method shouldTeleportToSpawn.
@Test
public void shouldTeleportToSpawn() {
// given
Location spawn = mock(Location.class);
given(spawnLoader.getSpawn()).willReturn(spawn);
Player player = mock(Player.class);
// when
command.executeCommand(player, Collections.emptyList());
// then
verify(player).teleport(spawn);
verify(spawnLoader, atLeastOnce()).getSpawn();
}
use of org.bukkit.Location in project AuthMeReloaded by AuthMe.
the class PluginHookServiceTest method shouldGetMultiverseSpawn.
@Test
public void shouldGetMultiverseSpawn() {
// given
Location location = mock(Location.class);
MultiverseWorld multiverseWorld = mock(MultiverseWorld.class);
given(multiverseWorld.getSpawnLocation()).willReturn(location);
World world = mock(World.class);
MVWorldManager mvWorldManager = mock(MVWorldManager.class);
given(mvWorldManager.isMVWorld(world)).willReturn(true);
given(mvWorldManager.getMVWorld(world)).willReturn(multiverseWorld);
MultiverseCore multiverse = mock(MultiverseCore.class);
given(multiverse.getMVWorldManager()).willReturn(mvWorldManager);
PluginManager pluginManager = mock(PluginManager.class);
setPluginAvailable(pluginManager, MULTIVERSE, multiverse);
PluginHookService pluginHookService = new PluginHookService(pluginManager);
// when
Location spawn = pluginHookService.getMultiverseSpawn(world);
// then
assertThat(spawn, equalTo(location));
verify(mvWorldManager).isMVWorld(world);
verify(mvWorldManager).getMVWorld(world);
verify(multiverseWorld).getSpawnLocation();
}
use of org.bukkit.Location in project AuthMeReloaded by AuthMe.
the class PluginHookServiceTest method shouldReturnNullForUnavailableMultiverse.
@Test
public void shouldReturnNullForUnavailableMultiverse() {
// given
PluginManager pluginManager = mock(PluginManager.class);
PluginHookService pluginHookService = new PluginHookService(pluginManager);
World world = mock(World.class);
// when
Location result = pluginHookService.getMultiverseSpawn(world);
// then
assertThat(result, nullValue());
}
Aggregations