Skip to content

Commit bd257c8

Browse files
committed
Updates
1 parent 8a76f45 commit bd257c8

File tree

1 file changed

+3
-0
lines changed
  • spring-security/getting-started/SecureApplication/src/test/java/com/reflectoring/security/web

1 file changed

+3
-0
lines changed

spring-security/getting-started/SecureApplication/src/test/java/com/reflectoring/security/web/BookControllerTest.java

+3
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@
1414
import org.springframework.test.web.servlet.MockMvc;
1515

1616
import static org.hamcrest.Matchers.hasSize;
17+
import static org.springframework.security.test.web.servlet.response.SecurityMockMvcResultMatchers.authenticated;
1718
import static org.springframework.test.context.jdbc.Sql.ExecutionPhase.BEFORE_TEST_METHOD;
1819
import static org.springframework.test.web.servlet.request.MockMvcRequestBuilders.get;
1920
import static org.springframework.test.web.servlet.result.MockMvcResultHandlers.print;
@@ -41,6 +42,8 @@ void successIfSecurityApplies() throws Exception {
4142
.header("X-Application-Name", "Library"))
4243
.andDo(print())
4344
.andExpect(status().isOk())
45+
.andExpect(authenticated().withUsername("bookadmin"))
46+
.andExpect(authenticated().withRoles("USER"))
4447
.andExpect(jsonPath("$", hasSize(3)))
4548
;
4649
}

0 commit comments

Comments
 (0)