(String sessionId, String gameId)
| 57 | } |
| 58 | |
| 59 | public void deleteGame(String sessionId, String gameId) throws GameNotFoundException { |
| 60 | Game game = mapper.load(Game.class, gameId); |
| 61 | if ( game == null ) { |
| 62 | throw new GameNotFoundException(gameId); |
| 63 | } |
| 64 | mapper.delete(game); |
| 65 | //delete game from session |
| 66 | Session session = mapper.load(Session.class, sessionId); |
| 67 | Set<String> sessionGames = session.getGames(); |
| 68 | sessionGames.remove(gameId); |
| 69 | if (sessionGames.size() == 0) { |
| 70 | session.clearGames(); |
| 71 | } else { |
| 72 | session.setGames(sessionGames); |
| 73 | } |
| 74 | mapper.save(session); |
| 75 | } |
| 76 | } |
no test coverage detected