@Test public void shouldRequestUpdatesForPlayers() throws IOException, ServletException { request.addParameter("vasya", "vasya"); screenController.handleRequest(request, new MockHttpServletResponse()); verify(screenSender).scheduleUpdate(updateRequestCaptor.capture()); assertUpdateRequestContainsPlayer("vasya"); }
@Test public void shouldRequestUpdatesForAllPlayersScreen() throws IOException, ServletException { request.addParameter("vasya", "vasya"); request.addParameter("allPlayersScreen", "true"); screenController.handleRequest(request, new MockHttpServletResponse()); verify(screenSender).scheduleUpdate(updateRequestCaptor.capture()); UpdateRequest updateRequest = updateRequestCaptor.getValue(); assertTrue(updateRequest.isForAllPlayers()); assertNull(updateRequest.getPlayersToUpdate()); }