Google News
logo
JUnit - Interview Questions
What is the main difference between @Mock and @InjectMocks?
@Mock annotation is used for creating mocks whereas @InjectMocks is used for creating class objects. Whenever the actual method body has to be executed of a given class, then we can use @InjectMocks.
Advertisement