← 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?
- A.Creates a mock of the class
- B.Creates the real class under test and passes the @Mock objects into it
- C.Starts the Spring container
- 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 →