Mocked Dependency Object Is Null After Using Mockito @InjectMocks Annotation
Let me explain the problem first. We have a Java class under test. We are using Junit with Mockito framework to write the unit test cases.We have annotated our test class with @InjectMocks annotation as below: @InjectMocks private TestClass testClass; @Mock private Dependency1 dependency1; @Mock private Dependency2 dependency2; That should inject mocked dependencies to the … Read more