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