When using _____ in Spring Boot, you can simulate HTTP requests to test web layers without running the server.
- @ControllerTest
- @RestTest
- @ServiceTest
- @WebMvcTest
In Spring Boot, the @WebMvcTest annotation is used to simulate HTTP requests and test the web layers (controllers) without starting a full web server. It focuses on testing the web-related components of your application.
Loading...
Related Quiz
- In what cases would you choose constructor injection over setter injection, and why?
- How can you handle different HTTP methods in a single method in a Spring Boot controller?
- The _____ annotation in Spring Boot is used to handle exceptions of type MethodArgumentNotValidException to catch validation errors.
- How can cache be synchronized across multiple instances of a Spring Boot application in a distributed environment?
- Which of the following is true about the deleteById method of a JpaRepository?