diff --git a/src/test/java/com/faforever/client/game/GameServiceTest.java b/src/test/java/com/faforever/client/game/GameServiceTest.java index 758a5412ff..570adeff64 100644 --- a/src/test/java/com/faforever/client/game/GameServiceTest.java +++ b/src/test/java/com/faforever/client/game/GameServiceTest.java @@ -37,6 +37,7 @@ import static org.junit.jupiter.api.Assertions.assertEquals; import static org.mockito.ArgumentMatchers.any; import static org.mockito.Mockito.doThrow; +import static org.mockito.Mockito.lenient; import static org.mockito.Mockito.when; public class GameServiceTest extends ServiceTest { @@ -61,6 +62,10 @@ public void setUp() throws Exception { MapperSetup.injectMappers(gameMapper); when(fxApplicationThreadExecutor.asScheduler()).thenReturn(Schedulers.immediate()); + lenient().doAnswer(invocation -> { + invocation.getArgument(0, Runnable.class).run(); + return null; + }).when(fxApplicationThreadExecutor).execute(any()); when(fafServerAccessor.getEvents(com.faforever.commons.lobby.GameInfo.class)).thenReturn(testGamePublisher.flux()); when(fafServerAccessor.connectionStateProperty()).thenReturn(new SimpleObjectProperty<>()); @@ -109,8 +114,9 @@ public void testOnGames() { GameInfoMessageBuilder.create(1) .defaultValues() .get(), - GameInfoMessageBuilder.create(2).defaultValues().get()) - ).get(); + GameInfoMessageBuilder.create(2) + .defaultValues() + .get())).get(); testGamePublisher.next(multiGameInfo); @@ -134,16 +140,8 @@ public void testOnGameInfoAdd() { testGamePublisher.next(gameInfo2); - assertThat(instance.getGames(), containsInAnyOrder( - allOf( - GameMatchers.hasId(1), - GameMatchers.hasTitle("Game 1") - ), - allOf( - GameMatchers.hasId(2), - GameMatchers.hasTitle("Game 2") - ) - )); + assertThat(instance.getGames(), containsInAnyOrder(allOf(GameMatchers.hasId(1), GameMatchers.hasTitle("Game 1")), + allOf(GameMatchers.hasId(2), GameMatchers.hasTitle("Game 2")))); } @Test