2v0-7222 Exam QuestionsBrowse all questions from this exam

2v0-7222 Exam - Question 69


Which two statements are true regarding @WebMvcTest? (Choose two.)

Show Answer
Correct Answer: A,B,D

The statements 'It auto-configures a MockMvc' and 'It will only scan for @Controller beans in the source code' are true regarding @WebMvcTest. @WebMvcTest is used for testing Spring MVC controllers, and it does not start a full server but nonetheless provides the necessary configuration to test @Controller classes and similar components. It auto-configures MockMvc, which is a crucial part of testing Spring MVC handlers. It also restricts the component scanning to only @Controller beans, making it efficient for controller layer testing.

Discussion

2 comments
Sign in to comment
2211094
Jun 18, 2024

CD is correct answer.

2211094Options: AD
Jun 18, 2024

Sorry CD is not correct but rather AD, why because @WebMvcTest is specifically designed for testing Spring MVC components without starting a full application server