Skip to content

Commit

Permalink
Fix Kill notice test
Browse files Browse the repository at this point in the history
  • Loading branch information
Sheikah45 committed Nov 30, 2023
1 parent 86753a1 commit 918098f
Showing 1 changed file with 11 additions and 0 deletions.
11 changes: 11 additions & 0 deletions src/test/java/com/faforever/client/game/GameServiceTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -1088,13 +1088,24 @@ public void spawnReplayTerminationListenerTest() {

@Test
public void onKillNoticeStopsGame() throws Exception {
GameBean game = GameBeanBuilder.create().defaultValues().get();
GameLaunchResponse gameLaunchMessage = GameLaunchMessageBuilder.create().defaultValues().get();
mockStartGameProcess(gameMapper.map(gameLaunchMessage));
when(mapService.isInstalled(game.getMapFolderName())).thenReturn(true);
when(fafServerAccessor.requestJoinGame(game.getId(), null)).thenReturn(completedFuture(gameLaunchMessage));
when(gameUpdater.update(any(), any(), any(), any(), anyBoolean())).thenReturn(completedFuture(null));
when(modService.getFeaturedMod(game.getFeaturedMod())).thenReturn(Mono.just(FeaturedModBeanBuilder.create()
.defaultValues()
.get()));

when(process.isAlive()).thenReturn(true);

NoticeInfo noticeMessage = new NoticeInfo("kill", null);


CompletableFuture<Void> future = instance.joinGame(game, null).toCompletableFuture();
future.join();

testNoticePublisher.next(noticeMessage);

verify(iceAdapter).onGameCloseRequested();
Expand Down

0 comments on commit 918098f

Please sign in to comment.