Skip to content

Commit

Permalink
Fix test
Browse files Browse the repository at this point in the history
  • Loading branch information
Sheikah45 committed Jun 8, 2024
1 parent ba662be commit 3a32f7d
Showing 1 changed file with 10 additions and 12 deletions.
22 changes: 10 additions & 12 deletions src/test/java/com/faforever/client/game/GameServiceTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand All @@ -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<>());

Expand Down Expand Up @@ -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);


Expand All @@ -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
Expand Down

0 comments on commit 3a32f7d

Please sign in to comment.