Close

Spring MVC - Unit Testing with AssertJ MCQ

« Tutorial
0 of 0 answered ( ✔ 0 | ✘ 0 )

1. What is the primary purpose of MockMvcTester in Spring MVC testing?

2. Which Spring Framework version introduced MockMvcTester?

3. What is the main advantage of using AssertJ over Hamcrest for MockMvc assertions?

4. How do you create a MockMvcTester for full Spring context support?

5. How do you create a MockMvcTester for standalone setup without a full Spring context?

6. What does MockMvcRequestBuilder implement, allowing it to be used with assertThat()?

7. Which package contains MockMvcTester?

8. What is the benefit of using .exchange() in AssertJ-based MockMvc tests?

9. In the AssertJ style, how do you assert that the response status is OK?

10. How do you assert that the response body contains a specific text using AssertJ?

11. What is the role of MvcTestResultAssert?

12. Why is MockMvcTester considered a fluent API?

13. What does MockMvcTester wrap?

14. Which annotations are used to enable full Spring context support with MockMvcTester?

15. What is the advantage of using MockMvcTester.of(controller) over MockMvcTester.from(wac)?

16. What does MockMvcRequestBuilder allow you to do?

17. What is the main difference between traditional Hamcrest-based MockMvc tests and AssertJ-based tests?

18. What is the purpose of assertThat(mockMvc.get().uri("/greeting")) in the example?

19. Which of the following is NOT a benefit of the AssertJ style mentioned in the tutorial?

20. What does MvcTestResult represent?

Join