🎙 Free live masterclass · Sun, 29 Nov, 7:00 pm IST · Java Full Stack roadmap Register free →
Skills101
← All topics

Quiz: Testing Spring Boot: questions with answers

10 questions, each with the answer and a short explanation.

Take the timed quiz + get a certificate →
  1. Q1. Which annotation starts only the web layer for one controller?
  2. Q2. In a Mockito test, what does @InjectMocks do?
  3. Q3. How do you check that deleteById was NOT called?
  4. Q4. What does @DataJpaTest do after each test by default?
  5. Q5. In Spring Boot 4, which annotation replaces a bean with a Mockito mock in a Spring test?
  6. Q6. What does when(repository.findById(1L)).thenReturn(Optional.of(course)) do in a Mockito test?
  7. Q7. What is the Arrange-Act-Assert pattern?
  8. Q8. Why does the integration test class have @Transactional?
  9. Q9. What does JsonCompareMode.STRICT add to a JSON comparison?
  10. Q10. What is the main problem with using @SpringBootTest for every test?