src/test/java/com/webcheckers/ui/PostLoginRouteTest.java
/**
     * Test for checking if the password can be empty.
     */
Test for checking if the password can be empty.
Test for checking if the password can be empty .
@Test
    public void login_game_pass(){
        when(request.queryParams(eq(USERNAME))).thenReturn(USERW);
        when(request.queryParams(eq(PASSWORD))).thenReturn(empty);
        when(playerLobby.sign_in(USERW, empty)).thenReturn(LoginStatus.INVALID_PASS_FORMAT);
        final TemplateEngineTester testHelper = new TemplateEngineTester();
        when(engine.render(any(ModelAndView.class))).thenAnswer(testHelper.makeAnswer());
        CuT.handle(request, response);
        Application.playerLobby.sign_in(USERW, empty);
        testHelper.assertViewModelExists();
        testHelper.assertViewModelIsaMap();
        testHelper.assertViewModelAttribute(VMAttributes.TITLE, PostLoginRoute.TITLE);
        testHelper.assertViewModelAttribute(VMAttributes.MESSAGE, PostLoginRoute.PASS);
        testHelper.assertViewName("signin.ftl");
    }
@ Test public void login_game_pass ( ) { when ( request . queryParams ( eq ( USERNAME ) ) ) . thenReturn ( USERW ) ; when ( request . queryParams ( eq ( PASSWORD ) ) ) . thenReturn ( empty ) ; when ( playerLobby . sign_in ( USERW , empty ) ) . thenReturn ( LoginStatus . INVALID_PASS_FORMAT ) ; final TemplateEngineTester testHelper = new TemplateEngineTester ( ) ; when ( engine . render ( any ( ModelAndView . class ) ) ) . thenAnswer ( testHelper . makeAnswer ( ) ) ; CuT . handle ( request , response ) ; Application . playerLobby . sign_in ( USERW , empty ) ; testHelper . assertViewModelExists ( ) ; testHelper . assertViewModelIsaMap ( ) ; testHelper . assertViewModelAttribute ( VMAttributes . TITLE , PostLoginRoute . TITLE ) ; testHelper . assertViewModelAttribute ( VMAttributes . MESSAGE , PostLoginRoute . PASS ) ; testHelper . assertViewName ( "signin.ftl" ) ; }
Test for checking if the password can be empty.
Test for checking if the password can be empty .
// Template engine tester //call handle on the CuT //Test viewmodel // assert view model data //assert view