From 4cbfc8a81232542fb1118c40f77ca3d1e52c5612 Mon Sep 17 00:00:00 2001 From: Gabriele C Date: Fri, 7 Jul 2017 20:41:31 +0200 Subject: [PATCH] Fix limbo service unit test --- .../fr/xephi/authme/data/limbo/LimboServiceTest.java | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/src/test/java/fr/xephi/authme/data/limbo/LimboServiceTest.java b/src/test/java/fr/xephi/authme/data/limbo/LimboServiceTest.java index 6b2bd4eb0..4b997558f 100644 --- a/src/test/java/fr/xephi/authme/data/limbo/LimboServiceTest.java +++ b/src/test/java/fr/xephi/authme/data/limbo/LimboServiceTest.java @@ -19,6 +19,8 @@ import org.junit.Test; import org.junit.runner.RunWith; import org.mockito.Mock; import org.mockito.Mockito; +import org.mockito.invocation.InvocationOnMock; +import org.mockito.stubbing.Answer; import java.util.Collection; import java.util.Collections; @@ -32,6 +34,7 @@ import static org.junit.Assert.assertThat; import static org.mockito.ArgumentMatchers.any; import static org.mockito.ArgumentMatchers.eq; import static org.mockito.BDDMockito.given; +import static org.mockito.Mockito.doAnswer; import static org.mockito.Mockito.mock; import static org.mockito.Mockito.only; import static org.mockito.Mockito.verify; @@ -80,6 +83,14 @@ public class LimboServiceTest { given(settings.getProperty(RestrictionSettings.ALLOW_UNAUTHED_MOVEMENT)).willReturn(false); } + @Before + public void mockBukkitService() { + doAnswer(invocation -> { + ((Runnable) invocation.getArguments()[0]).run(); + return null; + }).when(bukkitService).runTask(any(Runnable.class)); + } + @Test public void shouldCreateLimboPlayer() { // given