diff --git a/faf-java-server-app/src/main/java/com/faforever/server/game/GameService.java b/faf-java-server-app/src/main/java/com/faforever/server/game/GameService.java index f9c2d7b..34aba49 100644 --- a/faf-java-server-app/src/main/java/com/faforever/server/game/GameService.java +++ b/faf-java-server-app/src/main/java/com/faforever/server/game/GameService.java @@ -784,6 +784,7 @@ private void onGameClosed(Game game) { } changeGameState(game, GameState.CLOSED); + markDirty(game, Duration.ZERO, Duration.ZERO); activeGameRepository.delete(game); } diff --git a/faf-java-server-app/src/test/java/com/faforever/server/game/GameServiceTest.java b/faf-java-server-app/src/test/java/com/faforever/server/game/GameServiceTest.java index 7314789..5f61572 100644 --- a/faf-java-server-app/src/test/java/com/faforever/server/game/GameServiceTest.java +++ b/faf-java-server-app/src/test/java/com/faforever/server/game/GameServiceTest.java @@ -615,6 +615,10 @@ public void endGameIfNoPlayerConnected() throws Exception { closePlayerGame(player2); assertThat(game.getState(), is(GameState.CLOSED)); + ArgumentCaptor gameCaptor = ArgumentCaptor.forClass(GameResponse.class); + verify(clientService, atLeastOnce()).broadcastDelayed(gameCaptor.capture(), any(), any(), any(), any()); + + assertThat(gameCaptor.getValue().getState(), is(GameState.CLOSED)); assertThat(player1.getCurrentGame(), is(nullValue())); assertThat(player1.getGameState(), is(PlayerGameState.NONE)); assertThat(player2.getCurrentGame(), is(nullValue())); @@ -632,6 +636,11 @@ public void onGameClosedDoesntSaveGameIfGameDidntStart() throws Exception { verifyZeroInteractions(divisionService); assertThat(player1.getCurrentGame(), is(nullValue())); assertThat(player1.getGameState(), is(PlayerGameState.NONE)); + + ArgumentCaptor gameCaptor = ArgumentCaptor.forClass(GameResponse.class); + verify(clientService, atLeastOnce()).broadcastDelayed(gameCaptor.capture(), any(), any(), any(), any()); + + assertThat(gameCaptor.getValue().getState(), is(GameState.CLOSED)); } @Test @@ -718,6 +727,11 @@ public void onHostLeftClosesGameIfOpen() throws Exception { assertThat(player1.getGameState(), is(PlayerGameState.NONE)); assertThat(player2.getCurrentGame(), is(nullValue())); assertThat(player2.getGameState(), is(PlayerGameState.NONE)); + + ArgumentCaptor gameCaptor = ArgumentCaptor.forClass(GameResponse.class); + verify(clientService, atLeastOnce()).broadcastDelayed(gameCaptor.capture(), any(), any(), any(), any()); + + assertThat(gameCaptor.getValue().getState(), is(GameState.CLOSED)); } @Test