Fix failing tests

This commit is contained in:
Gabriele C 2017-09-03 02:54:29 +02:00
parent 9e28700acf
commit 8ae8ccf5cf

View File

@ -24,6 +24,7 @@ import org.mockito.stubbing.Answer;
import java.util.Arrays; import java.util.Arrays;
import static fr.xephi.authme.TestHelper.runSyncDelayedTask; import static fr.xephi.authme.TestHelper.runSyncDelayedTask;
import static fr.xephi.authme.TestHelper.runSyncTaskFromOptionallyAsyncTask;
import static org.hamcrest.Matchers.equalTo; import static org.hamcrest.Matchers.equalTo;
import static org.junit.Assert.assertThat; import static org.junit.Assert.assertThat;
import static org.mockito.ArgumentMatchers.any; import static org.mockito.ArgumentMatchers.any;
@ -94,7 +95,7 @@ public class TeleportationServiceTest {
// when // when
teleportationService.teleportNewPlayerToFirstSpawn(player); teleportationService.teleportNewPlayerToFirstSpawn(player);
runSyncDelayedTask(bukkitService); runSyncTaskFromOptionallyAsyncTask(bukkitService);
// then // then
verify(player).teleport(firstSpawn); verify(player).teleport(firstSpawn);
@ -114,7 +115,7 @@ public class TeleportationServiceTest {
// when // when
teleportationService.teleportOnJoin(player); teleportationService.teleportOnJoin(player);
runSyncDelayedTask(bukkitService); runSyncTaskFromOptionallyAsyncTask(bukkitService);
// then // then
verify(player).teleport(spawn); verify(player).teleport(spawn);
@ -186,7 +187,7 @@ public class TeleportationServiceTest {
// when // when
teleportationService.teleportOnJoin(player); teleportationService.teleportOnJoin(player);
runSyncDelayedTask(bukkitService); runSyncTaskFromOptionallyAsyncTask(bukkitService);
// then // then
verify(bukkitService).callEvent(any(SpawnTeleportEvent.class)); verify(bukkitService).callEvent(any(SpawnTeleportEvent.class));
@ -212,7 +213,7 @@ public class TeleportationServiceTest {
// when // when
teleportationService.teleportOnJoin(player); teleportationService.teleportOnJoin(player);
runSyncDelayedTask(bukkitService); runSyncTaskFromOptionallyAsyncTask(bukkitService);
// then // then
verify(bukkitService).callEvent(any(SpawnTeleportEvent.class)); verify(bukkitService).callEvent(any(SpawnTeleportEvent.class));
@ -253,7 +254,7 @@ public class TeleportationServiceTest {
// when // when
teleportationService.teleportOnLogin(player, auth, limbo); teleportationService.teleportOnLogin(player, auth, limbo);
runSyncDelayedTask(bukkitService); runSyncTaskFromOptionallyAsyncTask(bukkitService);
// then // then
verify(player).teleport(spawn); verify(player).teleport(spawn);
@ -300,7 +301,7 @@ public class TeleportationServiceTest {
// when // when
teleportationService.teleportOnLogin(player, auth, limbo); teleportationService.teleportOnLogin(player, auth, limbo);
runSyncDelayedTask(bukkitService); runSyncTaskFromOptionallyAsyncTask(bukkitService);
// then // then
ArgumentCaptor<Location> locationCaptor = ArgumentCaptor.forClass(Location.class); ArgumentCaptor<Location> locationCaptor = ArgumentCaptor.forClass(Location.class);
@ -328,7 +329,7 @@ public class TeleportationServiceTest {
// when // when
teleportationService.teleportOnLogin(player, auth, limbo); teleportationService.teleportOnLogin(player, auth, limbo);
runSyncDelayedTask(bukkitService); runSyncTaskFromOptionallyAsyncTask(bukkitService);
// then // then
ArgumentCaptor<Location> locationCaptor = ArgumentCaptor.forClass(Location.class); ArgumentCaptor<Location> locationCaptor = ArgumentCaptor.forClass(Location.class);
@ -353,7 +354,7 @@ public class TeleportationServiceTest {
// when // when
teleportationService.teleportOnLogin(player, auth, limbo); teleportationService.teleportOnLogin(player, auth, limbo);
runSyncDelayedTask(bukkitService); runSyncTaskFromOptionallyAsyncTask(bukkitService);
// then // then
verify(player).teleport(location); verify(player).teleport(location);
@ -375,7 +376,7 @@ public class TeleportationServiceTest {
// when // when
teleportationService.teleportOnLogin(player, auth, limbo); teleportationService.teleportOnLogin(player, auth, limbo);
runSyncDelayedTask(bukkitService); runSyncTaskFromOptionallyAsyncTask(bukkitService);
// then // then
verify(player).teleport(location); verify(player).teleport(location);