All quizzes
Free quiz · 21 questions in the bank

Mockito quiz

Test your Mockito knowledge with a free interactive quiz — 21 questions with answers and explanations. No signup needed to play.

Question 1/12Score 0

What does `verifyNoInteractions(mockRepo)` check?

In this round
  1. What does `verifyNoInteractions(mockRepo)` check?
  2. What does `any()` (or `anyString()`, `anyInt()`, etc.) do when used inside a `when()` or `verify()` call?
  3. What is `@InjectMocks` used for?
  4. How do you configure a mock to return different values on successive calls?
  5. What is the difference between a "mock" and a "spy" in Mockito?
  6. How do you configure a mock to return a specific value when a method is called?
  7. What does `reset(mock)` do?
  8. What does `verify(mockRepo, never()).delete(any())` check?
  9. Can Mockito mock `final` classes or methods?
  10. What is an `ArgumentCaptor` used for?
  11. What is the purpose of `MockitoExtension` (JUnit 5) or `MockitoJUnitRunner` (JUnit 4)?
  12. How do you create a mock object of a class/interface?
Gaps to close?
Read the curated Mockito notes — core concepts, patterns, interview prep.
Mockito notes

More quizzes

.NETAccessibilityAgileAgile MethodologyAirflowAkka