Package org.jtalks.jcommune.model.dto

Examples of org.jtalks.jcommune.model.dto.RegisterUserDto


    @Test
    public void testRegistrationPage() throws Exception {
        ModelAndView mav = userController.registrationPage(null, null);

        assertViewName(mav, "registration");
        RegisterUserDto dto = assertAndReturnModelAttributeOfType(mav, "newUser", RegisterUserDto.class);
        assertNullFields(dto);
    }
View Full Code Here


        userController.pluginAction(pluginId, "someAction", request, response);
    }

    @Test
    public void testRegisterUserShouldBeSuccessful() throws Exception {
        RegisterUserDto dto = createRegisterUserDto(null);
        BindingResult bindingResult = new BeanPropertyBindingResult(dto, "newUser");
        when(authenticator.register(dto)).thenReturn(bindingResult);

        ModelAndView mav = userController.registerUser(dto, request, Locale.ENGLISH);
View Full Code Here

        verify(authenticator).register(dto);
    }

    @Test
    public void testRegisterValidationFail() throws Exception {
        RegisterUserDto dto = createRegisterUserDto(null);
        BindingResult bindingResult = mock(BindingResult.class);
        when(bindingResult.hasErrors()).thenReturn(true);
        when(authenticator.register(dto)).thenReturn(bindingResult);

        ModelAndView mav = userController.registerUser(dto, request, Locale.ENGLISH);
View Full Code Here

        assertViewName(mav, "registration");
    }

    @Test
    public void testRegisterFailIfUnexpectedErrorOccurred() throws Exception {
        RegisterUserDto dto = createRegisterUserDto(null);
        doThrow(new UnexpectedErrorException()).when(authenticator).register(dto);

        ModelAndView mav = userController.registerUser(dto, request, Locale.ENGLISH);

        assertViewName(mav, UserController.REG_SERVICE_UNEXPECTED_ERROR_URL);
View Full Code Here

        assertViewName(mav, UserController.REG_SERVICE_UNEXPECTED_ERROR_URL);
    }

    @Test
    public void testRegisterFailIfConnectionErrorOccurred() throws Exception {
        RegisterUserDto dto = createRegisterUserDto(null);
        doThrow(new NoConnectionException()).when(authenticator).register(dto);

        ModelAndView mav = userController.registerUser(dto, request, Locale.ENGLISH);

        assertViewName(mav, UserController.REG_SERVICE_CONNECTION_ERROR_URL);
View Full Code Here

        assertViewName(mav, UserController.REG_SERVICE_CONNECTION_ERROR_URL);
    }
   
    @Test
    public void testRegisterFailIfHoneypotCaptchaNotNull() throws Exception {
        RegisterUserDto dto = createRegisterUserDto("anyString");
       
        ModelAndView mav = userController.registerUser(dto, request, Locale.ENGLISH);
       
        assertViewName(mav, UserController.REG_SERVICE_HONEYPOT_FILLED_ERROR_URL);
    }
View Full Code Here

        assertViewName(mav, UserController.REG_SERVICE_HONEYPOT_FILLED_ERROR_URL);
    }

    @Test
    public void testRegisterUserAjaxShouldBeSuccessful() throws Exception {
        RegisterUserDto dto = createRegisterUserDto(null);
        BindingResult bindingResult = new BeanPropertyBindingResult(dto, "newUser");
        when(authenticator.register(dto)).thenReturn(bindingResult);

        JsonResponse response = userController.registerUserAjax(dto, request, Locale.ENGLISH);
View Full Code Here

                "User without validation errors should pass registration.");
    }

    @Test
    public void testRegisterAjaxValidationFail() throws Exception {
        RegisterUserDto dto = createRegisterUserDto(null);
        BindingResult bindingResult = mock(BindingResult.class);
        when(bindingResult.hasErrors()).thenReturn(true);
        when(authenticator.register(dto)).thenReturn(bindingResult);

        JsonResponse response = userController.registerUserAjax(dto, request, Locale.ENGLISH);
View Full Code Here

                "User with validation errors should fail registration.");
    }

    @Test
    public void testRegisterAjaxFailIfUnexpectedErrorOccurred() throws Exception {
        RegisterUserDto dto = createRegisterUserDto(null);
        doThrow(new UnexpectedErrorException()).when(authenticator).register(dto);

        JsonResponse response = userController.registerUserAjax(dto, request, Locale.ENGLISH);

        assertEquals(response.getStatus(), JsonResponseStatus.FAIL, "Unexpected error should fail registration.");
View Full Code Here

        assertEquals(response.getStatus(), JsonResponseStatus.FAIL, "Unexpected error should fail registration.");
    }

    @Test
    public void testRegisterAjaxFailIfConnectionErrorOccurred() throws Exception {
        RegisterUserDto dto = createRegisterUserDto(null);
        doThrow(new NoConnectionException()).when(authenticator).register(dto);

        JsonResponse response = userController.registerUserAjax(dto, request, Locale.ENGLISH);

        assertEquals(response.getStatus(), JsonResponseStatus.FAIL, "Connection error should fail registration.");
View Full Code Here

TOP

Related Classes of org.jtalks.jcommune.model.dto.RegisterUserDto

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.