Which statement is false about Web slice testing with @WebMvcTest?
- @WebMvcTest disables full auto-configuration
- @WebMvcTest auto-configure MockMvc bean
- @WebMvcTest does not auto-configure by default Spring Security
- Typically @WebMvcTest is used in combination with @MockBean for mocking dependencies
#spring #certificationquestion #vcp
https://www.udemy.com/course/spring-professional-certification-6-full-tests-2v0-7222-a/?referralCode=04B6ED315B27753236AC
Spring doc:
By default, tests annotated with @WebMvcTest will also auto-configure Spring Security and MockMvc.
Baeldung:
Testing Controllers With @WebMvcTest
When using the @WebMvcTest annotation approach with Spring Security,
MockMvc is automatically configured with the necessary filter chain required to test our security configuration.
Because MockMvc is configured for us, weโre able to use @WithMockUser for our tests without any additional configuration:
Note that using @WebMvcTest will tell Spring Boot to instantiate only the web layer and not the entire context.
Because of this, controller tests that use @WebMvcTest will run faster than with other approaches.