(State state)
| 23 | private final GameModel gameModel = new GameModel(); |
| 24 | |
| 25 | public void saveState(State state) throws SessionNotFoundException, GameNotFoundException { |
| 26 | // check session |
| 27 | String sessionId = state.getSession(); |
| 28 | String gameId = state.getGame(); |
| 29 | if (sessionModel.loadSession(sessionId) == null ) { |
| 30 | throw new SessionNotFoundException(sessionId); |
| 31 | } |
| 32 | if (gameModel.loadGame(gameId) == null ) { |
| 33 | throw new GameNotFoundException(gameId); |
| 34 | } |
| 35 | mapper.save(state); |
| 36 | } |
| 37 | |
| 38 | public State loadState(String stateId) throws StateNotFoundException { |
| 39 | State state = mapper.load(State.class, stateId); |
no test coverage detected