Examples of RedirectAttributes


Examples of org.springframework.web.servlet.mvc.support.RedirectAttributes

    }

    @Test
    public void testUpdate() throws Exception {
        final Model model = createNiceMock(Model.class);
        RedirectAttributes redirectAttributes = createNiceMock(RedirectAttributes.class);
        NewUser newUser = new NewUser();
        replay(redirectAttributes);
        replay(model);
        BindingResult results = new DirectFieldBindingResult(newUser, ModelKeys.NEW_USER);
        String viewName = controller.update(newUser, results, model, redirectAttributes);
View Full Code Here

Examples of org.springframework.web.servlet.mvc.support.RedirectAttributes

    @Test
    public void testCreate() throws Exception {
        Model model = createNiceMock(Model.class);
        UserForm User = new UserForm();
        BindingResult results = new DirectFieldBindingResult(User, ModelKeys.USER);
        RedirectAttributes redirectAttributes = createNiceMock(RedirectAttributes.class);
        replay(redirectAttributes);
        replay(model);

        // user part
        // required email
View Full Code Here

Examples of org.springframework.web.servlet.mvc.support.RedirectAttributes


    @Test
    public void testInitialize() throws Exception {
        final Model model = createNiceMock(Model.class);
        RedirectAttributes redirectAttributes = createNiceMock(RedirectAttributes.class);
        replay(redirectAttributes);
        replay(model);
        String viewName = controller.initialize(model, null);
        assertThat(viewName, CoreMatchers.equalTo(ViewNames.PASSWORD_CHANGE));
    }
View Full Code Here

Examples of org.springframework.web.servlet.mvc.support.RedirectAttributes

    }

    @Test
    public void testUpdate() throws Exception {
        final Model model = createNiceMock(Model.class);
        RedirectAttributes redirectAttributes = createNiceMock(RedirectAttributes.class);
        UserForm newUser = new UserForm();
        replay(redirectAttributes);
        replay(model);
        BindingResult results = new DirectFieldBindingResult(newUser, ModelKeys.USER);
        String viewName = controller.update(newUser, results, model, redirectAttributes);
View Full Code Here

Examples of org.springframework.web.servlet.mvc.support.RedirectAttributes

    }

    @Test
    public void create_ValidFormSubmitted() throws Exception {
        final Model model = createNiceMock(Model.class);
        final RedirectAttributes redirectAttributes = createNiceMock(RedirectAttributes.class);
        final UserForm User = new UserForm();
        final BindingResult errors = new BeanPropertyBindingResult(User, ModelKeys.NEW_USER);
        final String username = "username";
        final String password = "password";
        final String email = "User@example.com";
View Full Code Here

Examples of org.springframework.web.servlet.mvc.support.RedirectAttributes

        assertEquals("redirect:/app/admin/users", result);
    }
    @Test
    public void create_EmptyForm() throws Exception {
        final Model model = createNiceMock(Model.class);
        final RedirectAttributes redirectAttributes = createNiceMock(RedirectAttributes.class);
        final UserForm User = new UserForm();
        final BindingResult errors = new BeanPropertyBindingResult(User, ModelKeys.NEW_USER);
        final String username = "";
        final String password = "";
        final String email = "";
View Full Code Here

Examples of org.springframework.web.servlet.mvc.support.RedirectAttributes

    }

    @Test
    public void create_ValidFormSubmitted() throws Exception {
        final Model model = createNiceMock(Model.class);
        final RedirectAttributes redirectAttributes = createNiceMock(RedirectAttributes.class);
        final UserForm User = new UserForm();
        final BindingResult errors = new BeanPropertyBindingResult(User, ModelKeys.NEW_USER);
        final String username = "username";
        final String password = "password";
        final String email = "User@example.com";
View Full Code Here

Examples of org.springframework.web.servlet.mvc.support.RedirectAttributes

    }
    @Test
    public void create_EmptyForm() throws Exception {
        final Model model = createNiceMock(Model.class);
        final RedirectAttributes redirectAttributes = createNiceMock(RedirectAttributes.class);
        final UserForm User = new UserForm();
        final BindingResult errors = new BeanPropertyBindingResult(User, ModelKeys.NEW_USER);
        final String username = "";
        final String password = "";
        final String email = "";
View Full Code Here

Examples of org.springframework.web.servlet.mvc.support.RedirectAttributes

        Person deleted = PersonTestUtil.createModelObject(PERSON_ID, FIRST_NAME, LAST_NAME);
        when(personServiceMock.delete(PERSON_ID)).thenReturn(deleted);
       
        initMessageSourceForFeedbackMessage(PersonController.FEEDBACK_MESSAGE_KEY_PERSON_DELETED);
       
        RedirectAttributes attributes = new RedirectAttributesModelMap();
        String view = controller.delete(PERSON_ID, attributes);
       
        verify(personServiceMock, times(1)).delete(PERSON_ID);
        verifyNoMoreInteractions(personServiceMock);
        assertFeedbackMessage(attributes, PersonController.FEEDBACK_MESSAGE_KEY_PERSON_DELETED);
View Full Code Here

Examples of org.springframework.web.servlet.mvc.support.RedirectAttributes

    public void deleteWhenPersonIsNotFound() throws PersonNotFoundException {
        when(personServiceMock.delete(PERSON_ID)).thenThrow(new PersonNotFoundException());
       
        initMessageSourceForErrorMessage(PersonController.ERROR_MESSAGE_KEY_DELETED_PERSON_WAS_NOT_FOUND);
       
        RedirectAttributes attributes = new RedirectAttributesModelMap();
        String view = controller.delete(PERSON_ID, attributes);
       
        verify(personServiceMock, times(1)).delete(PERSON_ID);
        verifyNoMoreInteractions(personServiceMock);
        assertErrorMessage(attributes, PersonController.ERROR_MESSAGE_KEY_DELETED_PERSON_WAS_NOT_FOUND);
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.