title: Mock Data with Mockito
body: <p>I am trying to mock data with Mockito and getting NPE. Here is the sample code I am trying to test:</p>
  
  <p><div class="snippet" data-lang="js" data-hide="false" data-console="true" data-babel="false">
  <div class="snippet-code">
  <pre class="snippet-code-html lang-html prettyprint-override"><code>public class MyPresenter implements Contract.Presenter {
    @Inject
    MyManager myManager;
  
    @Override
    public void doSomething(Data data) {
      myManager.doSomething(data);
    }
  }
  
  public class MyPresenterTest {
  
    @Mock
    private MyManager myManager; 
  
    @InjectMocks
    private MyPresenter myPresenter;
  
    @Before
    public void setup(){
    MockitoAnnotations.initMocks(this);
    }
  
    @Test
    public void doSomethingTest(){
      Data data = new Data();
      myPresenter.doSomething(data);
      verify(myManager).doSomething(data);
    }
  }</code></pre>
  </div>
  </div>
  </p>
  
  <p>NPE is coming at the following line in the MyPresenter class.</p>
  
  <p>myManager.doSomething(data);</p>
  
  <p>@Inject in MyPresenter injects the object using Dagger 2.</p>
  
  <p>Could anyone please help ?</p>