### Question:
GameEndingByMoving extends GameEnding { public void checkGameEndingByMoving(Game game) { BooleanContext isAllCellsOwned = new BooleanContext(); Map<Long, Integer> playersCellsCount = preparePlayersCellsCount(game); fillPlayersCellsCount(game, playersCellsCount, isAllCellsOwned); if (!isAllCellsOwned.isBool) { return; } Player winner = findMostConqueredCellsPlayer(playersCellsCount, game); finishGame(game, winner); }  void checkGameEndingByMoving(Game game);  }### Answer:
@Test public void whenThereisEmptyCell() { game.getBoard().getCells()[0][1].setOwner(EMPTY_CELL_PLAYER_ID); gameEndingByMoving.checkGameEndingByMoving(game); assertFalse(game.isFinished()); assertThat(game.getWinner()).isNull(); }
@Test public void whenSecondPlayerHasMoreCells() { gameEndingByMoving.checkGameEndingByMoving(game); assertTrue(game.isFinished()); assertThat(game.getWinner()).isEqualTo(secondPlayer); }
@Test public void whenPlayersHasEqualsCellsCount() { game.getBoard().getCells()[0][1].setOwner(FIRST_PLAYER_ID); gameEndingByMoving.checkGameEndingByMoving(game); assertTrue(game.isFinished()); assertThat(game.getWinner()).isNull(); }
@Test(expected = UnsupportedOperationException.class) public void when3Players() { game.getPlayers().add( createPlayer(99)); gameEndingByMoving.checkGameEndingByMoving(game); }