Examples of RedirectAttributes


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

    public void submitEditPersonFormWhenLastNameIsEmpty() {
        MockHttpServletRequest mockRequest = new MockHttpServletRequest("/person/edit", "POST");
        PersonDTO updated = PersonTestUtil.createDTO(PERSON_ID, FIRST_NAME_UPDATED, null);

        BindingResult bindingResult = bindAndValidate(mockRequest, updated);
        RedirectAttributes attributes = new RedirectAttributesModelMap();

        String view = controller.submitEditPersonForm(updated, bindingResult, attributes);

        verifyZeroInteractions(personServiceMock);
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

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

        Person model = PersonTestUtil.createModelObject(PERSON_ID, FIRST_NAME, LAST_NAME);
        when(personServiceMock.create(created)).thenReturn(model);

        initMessageSourceForFeedbackMessage(PersonController.FEEDBACK_MESSAGE_KEY_PERSON_CREATED);
       
        RedirectAttributes attributes = new RedirectAttributesModelMap();
        BindingResult result = bindAndValidate(mockRequest, created);
       
        String view = controller.submitCreatePersonForm(created, result, attributes);
       
        verify(personServiceMock, times(1)).create(created);
View Full Code Here

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

    public void submitEmptyCreatePersonForm() {
        MockHttpServletRequest mockRequest = new MockHttpServletRequest("/person/create", "POST");
       
        PersonDTO created = new PersonDTO();
       
        RedirectAttributes attributes = new RedirectAttributesModelMap();
        BindingResult result = bindAndValidate(mockRequest, created);
       
        String view = controller.submitCreatePersonForm(created, result, attributes);
       
        verifyZeroInteractions(personServiceMock);
View Full Code Here

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

    public void submitCreatePersonFormWithEmptyFirstName() {
        MockHttpServletRequest mockRequest = new MockHttpServletRequest("/person/create", "POST");

        PersonDTO created = PersonTestUtil.createDTO(null, null, LAST_NAME);

        RedirectAttributes attributes = new RedirectAttributesModelMap();
        BindingResult result = bindAndValidate(mockRequest, created);

        String view = controller.submitCreatePersonForm(created, result, attributes);

        verifyZeroInteractions(personServiceMock);
View Full Code Here

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

    public void submitCreatePersonFormWithEmptyLastName() {
        MockHttpServletRequest mockRequest = new MockHttpServletRequest("/person/create", "POST");

        PersonDTO created = PersonTestUtil.createDTO(null, FIRST_NAME, null);

        RedirectAttributes attributes = new RedirectAttributesModelMap();
        BindingResult result = bindAndValidate(mockRequest, created);

        String view = controller.submitCreatePersonForm(created, result, attributes);

        verifyZeroInteractions(personServiceMock);
View Full Code Here

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

    public void showEditPersonForm() {
        Person person = PersonTestUtil.createModelObject(PERSON_ID, FIRST_NAME, LAST_NAME);
        when(personServiceMock.findById(PERSON_ID)).thenReturn(person);
       
        Model model = new BindingAwareModelMap();
        RedirectAttributes attributes = new RedirectAttributesModelMap();
       
        String view = controller.showEditPersonForm(PERSON_ID, model, attributes);
       
        verify(personServiceMock, times(1)).findById(PERSON_ID);
        verifyNoMoreInteractions(personServiceMock);
View Full Code Here

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

        when(personServiceMock.findById(PERSON_ID)).thenReturn(null);
       
        initMessageSourceForErrorMessage(PersonController.ERROR_MESSAGE_KEY_EDITED_PERSON_WAS_NOT_FOUND);
       
        Model model = new BindingAwareModelMap();
        RedirectAttributes attributes = new RedirectAttributesModelMap();
       
        String view = controller.showEditPersonForm(PERSON_ID, model, attributes);
       
        verify(personServiceMock, times(1)).findById(PERSON_ID);
        verifyNoMoreInteractions(personServiceMock);
View Full Code Here

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

        when(personServiceMock.update(updated)).thenReturn(person);
       
        initMessageSourceForFeedbackMessage(PersonController.FEEDBACK_MESSAGE_KEY_PERSON_EDITED);
       
        BindingResult bindingResult = bindAndValidate(mockRequest, updated);
        RedirectAttributes attributes = new RedirectAttributesModelMap();
       
        String view = controller.submitEditPersonForm(updated, bindingResult, attributes);
       
        verify(personServiceMock, times(1)).update(updated);
        verifyNoMoreInteractions(personServiceMock);
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.