File tree Expand file tree Collapse file tree 1 file changed +5
-5
lines changed
complete/src/test/java/com/example/securingweb Expand file tree Collapse file tree 1 file changed +5
-5
lines changed Original file line number Diff line number Diff line change @@ -29,30 +29,30 @@ class SecuringWebApplicationTests {
2929 void loginWithValidUserThenAuthenticated () throws Exception {
3030 FormLoginRequestBuilder login = formLogin ().user ("user" ).password ("password" );
3131
32- mockMvc .perform (login ).andExpect (authenticated ().withUsername ("user" ));
32+ this . mockMvc .perform (login ).andExpect (authenticated ().withUsername ("user" ));
3333 }
3434
3535 @ Test
3636 void loginWithInvalidUserThenUnauthenticated () throws Exception {
3737 FormLoginRequestBuilder login = formLogin ().user ("invalid" ).password ("invalidpassword" );
3838
39- mockMvc .perform (login ).andExpect (unauthenticated ());
39+ this . mockMvc .perform (login ).andExpect (unauthenticated ());
4040 }
4141
4242 @ Test
4343 void accessUnsecuredResourceThenOk () throws Exception {
44- mockMvc .perform (get ("/" )).andExpect (status ().isOk ());
44+ this . mockMvc .perform (get ("/" )).andExpect (status ().isOk ());
4545 }
4646
4747 @ Test
4848 void accessSecuredResourceUnauthenticatedThenRedirectsToLogin () throws Exception {
49- mockMvc .perform (get ("/hello" )).andExpect (status ().is3xxRedirection ()).andExpect (redirectedUrl ("/login" ));
49+ this . mockMvc .perform (get ("/hello" )).andExpect (status ().is3xxRedirection ()).andExpect (redirectedUrl ("/login" ));
5050 }
5151
5252 @ Test
5353 @ WithMockUser
5454 void accessSecuredResourceAuthenticatedThenOk () throws Exception {
55- MvcResult mvcResult = mockMvc .perform (get ("/hello" )).andExpect (status ().isOk ()).andReturn ();
55+ MvcResult mvcResult = this . mockMvc .perform (get ("/hello" )).andExpect (status ().isOk ()).andReturn ();
5656
5757 assertThat (mvcResult .getResponse ().getContentAsString ()).contains ("Hello user!" );
5858 }
You can’t perform that action at this time.
0 commit comments