← Quiz: Spring Boot Interview Questions: all 10 questions
Quiz: Spring Boot Interview Questions · Question 8 of 10
What is the difference between @Mock and @MockitoBean?
What is the difference between @Mock and @MockitoBean?
- A.@Mock is for plain Mockito tests; @MockitoBean replaces a bean inside a Spring test context
- B.They are identical
- C.@MockitoBean is for static methods only
- D.@Mock starts the Spring context
Answer & explanation
Correct answer: @Mock is for plain Mockito tests; @MockitoBean replaces a bean inside a Spring test context
Mixing them up is a common interview slip.
Can you get the rest right without peeking?
Take the timed Quiz: Spring Boot Interview Questions quiz free. Pass it to earn XP and count towards your certificate.
Start the quiz →