@@ -46,26 +46,36 @@ public void whenRedirectOnUrlWithUsingXMLConfig_thenStatusRedirectionAndRedirect
4646
4747 @ Test
4848 public void whenRedirectOnUrlWithUsingRedirectPrefix_thenStatusRedirectionAndRedirectedOnUrl () throws Exception {
49- mockMvc .perform (get ("/redirectWithRedirectPrefix" )).andExpect (status ().is3xxRedirection ()).andExpect (view ().name ("redirect:/redirectedUrl" )).andExpect (model ().attribute ("attribute" , is ("redirectWithRedirectPrefix" )))
49+ mockMvc .perform (get ("/redirectWithRedirectPrefix" )).andExpect (status ().is3xxRedirection ())
50+ .andExpect (view ().name ("redirect:/redirectedUrl" ))
51+ .andExpect (model ().attribute ("attribute" , is ("redirectWithRedirectPrefix" )))
5052 .andExpect (redirectedUrl ("/redirectedUrl?attribute=redirectWithRedirectPrefix" ));
5153 }
5254
5355 @ Test
54- public void whenRedirectOnUrlWithUsingRedirectAttributes_thenStatusRedirectionAndRedirectedOnUrlAndAddedAttributeToFlashScope () throws Exception {
55- mockMvc .perform (get ("/redirectWithRedirectAttributes" )).andExpect (status ().is3xxRedirection ()).andExpect (flash ().attribute ("flashAttribute" , is ("redirectWithRedirectAttributes" )))
56+ public void whenRedirectOnUrlWithUsingRedirectAttributes_thenStatusRedirectionAndRedirectedOnUrlAndAddedAttributeToFlashScope ()
57+ throws Exception {
58+ mockMvc .perform (get ("/redirectWithRedirectAttributes" )).andExpect (status ().is3xxRedirection ())
59+ .andExpect (flash ().attribute ("flashAttribute" , is ("redirectWithRedirectAttributes" )))
5660 .andExpect (model ().attribute ("attribute" , is ("redirectWithRedirectAttributes" )))
5761 .andExpect (model ().attribute ("flashAttribute" , is (nullValue ())))
5862 .andExpect (redirectedUrl ("redirectedUrl?attribute=redirectWithRedirectAttributes" ));
5963 }
6064
6165 @ Test
62- public void whenRedirectOnUrlWithUsingRedirectView_thenStatusRedirectionAndRedirectedOnUrlAndAddedAttributeToFlashScope () throws Exception {
63- mockMvc .perform (get ("/redirectWithRedirectView" )).andExpect (status ().is3xxRedirection ()).andExpect (model ().attribute ("attribute" , is ("redirectWithRedirectView" ))).andExpect (redirectedUrl ("redirectedUrl?attribute=redirectWithRedirectView" ));
66+ public void whenRedirectOnUrlWithUsingRedirectView_thenStatusRedirectionAndRedirectedOnUrlAndAddedAttributeToFlashScope ()
67+ throws Exception {
68+ mockMvc .perform (get ("/redirectWithRedirectView" )).andExpect (status ().is3xxRedirection ())
69+ .andExpect (model ().attribute ("attribute" , is ("redirectWithRedirectView" )))
70+ .andExpect (redirectedUrl ("redirectedUrl?attribute=redirectWithRedirectView" ));
6471 }
6572
6673 @ Test
6774 public void whenRedirectOnUrlWithUsingForwardPrefix_thenStatusOkAndForwardedOnUrl () throws Exception {
68- mockMvc .perform (get ("/redirectWithForwardPrefix" )).andExpect (status ().isOk ()).andExpect (view ().name ("forward:/redirectedUrl" )).andExpect (model ().attribute ("attribute" , is ("redirectWithForwardPrefix" ))).andExpect (forwardedUrl ("/redirectedUrl" ));
75+ mockMvc .perform (get ("/forwardWithForwardPrefix" )).andExpect (status ().isOk ())
76+ .andExpect (view ().name ("forward:/redirectedUrl" ))
77+ .andExpect (model ().attribute ("attribute" , is ("redirectWithForwardPrefix" )))
78+ .andExpect (forwardedUrl ("/redirectedUrl" ));
6979 }
7080
7181}
0 commit comments