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/5Score 0

What does `verifyNoInteractions(mockRepo)` check?

Questions in this quiz
  1. What does `verifyNoInteractions(mockRepo)` check?
  2. What does `reset(mock)` do?
  3. What does `any()` (or `anyString()`, `anyInt()`, etc.) do when used inside a `when()` or `verify()` call?
  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 `verify(mockRepo, never()).delete(any())` check?
  8. What is an `ArgumentCaptor` used for?
  9. How do you mock a `void` method to throw an exception (since `when(...).thenThrow(...)` doesn't work directly on a void call)?
  10. What is the purpose of `MockitoExtension` (JUnit 5) or `MockitoJUnitRunner` (JUnit 4)?
  11. Can Mockito mock `final` classes or methods?
  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

.NET.NET MAUIAbsintheAccessibilityActixActix Web