When I was writing test case using the Mockito and Junit, I was using the @InjectMocks
for the class to be tested. In other parts of project, I also see @Autowired
is being used for the class to be tested.
When can I use @InjectMocks
and @Autowired
? What is the difference between two when we are trying to use them with class to be tested?