title: Mockito's @InjectMock annotation
body: <p>I'm a little confused with <code>@RunWith(MockitoJUnitRunner.class)</code> and <code>@InjectMock</code> annotations and how they are related to each other. As per my understanding by giving <code>@RunWith(MockitoJUnitRunner.class)</code> we don't need to initialize the mock like <code>mock(ABC.class)</code>.</p>
  
  <p>On the other hand <code>@InjectMocks</code> injects the mock automatically with getters and setters. The documentation says:</p>
  
  <blockquote>
    <p><code>@InjectMocks</code> currently it only supports setter injection.  If you prefer constructor injection - please contribute a patch....</p>
  </blockquote>
  
  <p>What I don't understand is that when I remove <code>@InjectMocks</code> below I get nullpointer exception for the tests as dependency is null. Does that mean construtor based inject is supported? Or does it has something to do with <code>@RunWith(MockitoJUnitRunner.class)</code></p>
  
  <p>Here's the code</p>
  
  <pre><code>@RunWith(MockitoJUnitRunner.class)
  public class MyClassTest {
      @Mock
      private Dependency dependency;
  
      @InjectMocks
      private MyClass cls = new MyClass(dependency);
      //...
  }
  
  class MyClass {
      private Dependency dependency;
  
      MyClass(Dependency dependency) {
          this.dependency = dependency;
      }
      //...
  }
  </code></pre>