src/test/java/com/webcheckers/ui/GetGameRouteTest.java
/**
     * Test for attempt to join nonexistant game.
     */
Test for attempt to join nonexistant game.
Test for attempt to join nonexistant game .
@Test
    public void nonexistant_game() {
        when(session.attribute(SessionAttributes.PLAYER)).thenReturn(player);
        when(gameCenter.getGameByPlayer(player)).thenReturn(null);
        final TemplateEngineTester testHelper = new TemplateEngineTester();
        when(engine.render(any(ModelAndView.class))).thenAnswer(testHelper.makeAnswer());
        try {
            CuT.handle(request, response);
        } catch (InterruptedException e) {
        }
        verify(response).redirect(WebServer.HOME_URL);
    }
@ Test public void nonexistant_game ( ) { when ( session . attribute ( SessionAttributes . PLAYER ) ) . thenReturn ( player ) ; when ( gameCenter . getGameByPlayer ( player ) ) . thenReturn ( null ) ; final TemplateEngineTester testHelper = new TemplateEngineTester ( ) ; when ( engine . render ( any ( ModelAndView . class ) ) ) . thenAnswer ( testHelper . makeAnswer ( ) ) ; try { CuT . handle ( request , response ) ; } catch ( InterruptedException e ) { } verify ( response ) . redirect ( WebServer . HOME_URL ) ; }
Test for attempt to join nonexistant game.
Test for attempt to join nonexistant game .
//Template engine tester //Call handle on the CuT