🎙 Free live masterclass · Sun, 29 Nov, 7:00 pm IST · Java Full Stack roadmap Register free →
Skills101
← Quiz: Testing Spring Boot: all 10 questions

Quiz: Testing Spring Boot · Question 2 of 10

In a Mockito test, what does @InjectMocks do?

In a Mockito test, what does @InjectMocks do?

  1. A.Creates a mock of the class
  2. B.Creates the real class under test and passes the @Mock objects into it
  3. C.Starts the Spring container
  4. D.Verifies all mocks were called
Answer & explanation

Correct answer: Creates the real class under test and passes the @Mock objects into it

The class under test is real; its dependencies are mocks.

Can you get the rest right without peeking?

Take the timed Quiz: Testing Spring Boot quiz free. Pass it to earn XP and count towards your certificate.

Start the quiz →