Many people have given a great explanation here about @Mock
vs @InjectMocks
. I like it, but I think our tests and application should be written in such a way that we shouldn't need to use @InjectMocks
.
Reference for further reading with examples: https://tedvinke.wordpress.com/2014/02/13/mockito-why-you-should-not-use-injectmocks-annotation-to-autowire-fields/