Search in sources :

Example 1 with MultiverseWorld

use of com.onarandombox.MultiverseCore.api.MultiverseWorld 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();
}
Also used : PluginManager(org.bukkit.plugin.PluginManager) MultiverseWorld(com.onarandombox.MultiverseCore.api.MultiverseWorld) MultiverseCore(com.onarandombox.MultiverseCore.MultiverseCore) MVWorldManager(com.onarandombox.MultiverseCore.api.MVWorldManager) World(org.bukkit.World) MultiverseWorld(com.onarandombox.MultiverseCore.api.MultiverseWorld) Location(org.bukkit.Location) Test(org.junit.Test)

Aggregations

MultiverseCore (com.onarandombox.MultiverseCore.MultiverseCore)1 MVWorldManager (com.onarandombox.MultiverseCore.api.MVWorldManager)1 MultiverseWorld (com.onarandombox.MultiverseCore.api.MultiverseWorld)1 Location (org.bukkit.Location)1 World (org.bukkit.World)1 PluginManager (org.bukkit.plugin.PluginManager)1 Test (org.junit.Test)1