Skip to content

Latest commit

 

History

History
13 lines (10 loc) · 671 Bytes

testing-with-spring-security.adoc

File metadata and controls

13 lines (10 loc) · 671 Bytes

Testing With Spring Security

Spring Security provides support for running tests as a specific user. For example, the test in the snippet below will run with an authenticated user that has the ADMIN role.

link:{docs-java}/howto/testingwithspringsecurity/MySecurityTests.java[role=include]

Spring Security provides comprehensive integration with Spring MVC Test and this can also be used when testing controllers using the @WebMvcTest slice and MockMvc.

For additional details on Spring Security’s testing support, refer to Spring Security’s {spring-security-docs}#test[reference documentation]).