GameController { @RequestMapping(value = "logout", method = RequestMethod.POST) public void leaveSession( @RequestParam(name = "userName") final String userName, @RequestParam(name = "sessionId") final Long sessionId ) { sessionManager.removeUser(userName, sessionId); logger.info(userName + " has left session " + sessionId); messagingUtils.burstUsersMessages(sessionId); messagingUtils.burstResultsMessages(sessionId); } @Autowired  GameController(SessionManager sessionManager, MessagingUtils messagingUtils); @RequestMapping(value = "joinSession", method = RequestMethod.POST) void joinSession(
            @RequestParam(name = "sessionId") final Long sessionId,
            @RequestParam(name = "userName") final String userName
    ); @RequestMapping(value = "createSession", method = RequestMethod.POST) long createSession(
            @RequestParam(name = "userName") final String userName
    ); @RequestMapping(value = "logout", method = RequestMethod.POST) void leaveSession(
            @RequestParam(name = "userName") final String userName,
            @RequestParam(name = "sessionId") final Long sessionId
    ); @RequestMapping(value = "refresh", method = RequestMethod.GET) void refresh(
            @RequestParam(name = "sessionId") final Long sessionId
    ); @RequestMapping(value = "sessionUsers", method = RequestMethod.GET) List<String> getSessionUsers(
            @RequestParam(name = "sessionId") final Long sessionId
    ); @RequestMapping(value = "sessions", method = RequestMethod.GET) @ResponseBody Map<Long, List<String>> getSessions(); @RequestMapping(value = "reset", method = RequestMethod.POST) void reset(
            @RequestParam(name = "sessionId") final Long sessionId,
            @RequestParam(name = "userName") final String userName
    );  }
@Test public void testLeaveSession() throws Exception { Long sID = gameController.createSession(USER_NAME); gameController.leaveSession(USER_NAME, sID); assert (sessionManager.getSessionUsers(sID).isEmpty()); verify(sessionManager, times(1)).createSession(); verify(sessionManager, times(1)).registerUser(USER_NAME, sID); verify(sessionManager, times(1)).removeUser(USER_NAME, sID); verify(sessionManager, times(1)).getSessionUsers(sID); verifyNoMoreInteractions(sessionManager); }