🎙 Free live masterclass · Sun, 29 Nov, 7:00 pm IST · Java Full Stack roadmap Register free →
Skills101
← 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?

  1. A.@Mock is for plain Mockito tests; @MockitoBean replaces a bean inside a Spring test context
  2. B.They are identical
  3. C.@MockitoBean is for static methods only
  4. 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 →