Mockito: Why You Should Not Use InjectMocks Annotation to Autowire Fields | Ted Vinke's Blog
The org.mockito.InjectMocks
annotation can be seen as an equivalent of Spring's own dependency injection. The Javadoc states:
Mockito will try to inject mocks only either by constructor injection, setter injection, or property injection in order and as described below. If any of the following strategy fail, then Mockito won't report failure; i.e. you will have to provide dependencies yourself.
Read full article from Mockito: Why You Should Not Use InjectMocks Annotation to Autowire Fields | Ted Vinke's Blog
No comments:
Post a Comment