@ -1,11 +1,5 @@
package sample.secure.sso ;
import static org.hamcrest.CoreMatchers.containsString ;
import static org.springframework.test.web.servlet.request.MockMvcRequestBuilders.get ;
import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.header ;
import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.status ;
import static org.springframework.test.web.servlet.setup.MockMvcBuilders.webAppContextSetup ;
import org.junit.Before ;
import org.junit.Test ;
import org.junit.runner.RunWith ;
@ -19,6 +13,12 @@ import org.springframework.test.context.web.WebAppConfiguration;
import org.springframework.test.web.servlet.MockMvc ;
import org.springframework.web.context.WebApplicationContext ;
import static org.hamcrest.CoreMatchers.containsString ;
import static org.springframework.test.web.servlet.request.MockMvcRequestBuilders.get ;
import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.header ;
import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.status ;
import static org.springframework.test.web.servlet.setup.MockMvcBuilders.webAppContextSetup ;
/ * *
* Series of automated integration tests to verify proper behavior of auto - configured ,
* OAuth2 - secured system
@ -47,8 +47,9 @@ public class SampleOAuth2SsoApplicationTests {
@Test
public void everythingIsSecuredByDefault ( ) throws Exception {
this . mvc . perform ( get ( "/" ) ) . andExpect ( status ( ) . isFound ( ) )
. andExpect ( header ( ) . string ( "location" , containsString ( "github.com" ) ) ) ;
this . mvc . perform ( get ( "/" ) )
. andExpect ( status ( ) . isFound ( ) )
. andExpect ( header ( ) . string ( "location" , containsString ( "localhost/login" ) ) ) ;
}
}