title: Can't @InjectMocks attribute call Mockito's method thenReturn?
body: <p>I started using <code>Mockito</code> this week and I'm having a problem to understand <code>@InjectMocks</code> field.</p>
  
  <p>I have a class A that is like this:</p>
  
  <pre><code>public class A {
  
      public B b;
  
      public C c;
  
      public String string;
  
  }
  </code></pre>
  
  <p>when I use it at <code>JUnit</code> test with <code>Mockito</code>, I call it like this:</p>
  
  <pre><code>@RunWith(MockitoJUnitRunner.class)
  public class Test {
  
      @Mock
      B b;
  
      @Mock
      C c;
  
      @InjectMocks
      A a;
  
      ...
  
  }
  </code></pre>
  
  <p>but I want to set the <strong>string</strong> attribute! I try it like this:</p>
  
  <pre><code>Mockito.when(a.getString()).thenReturn("STRING");
  </code></pre>
  
  <p>however, the test throws an Exception:</p>
  
  <blockquote>
    <p>org.mockito.exceptions.misusing.MissingMethodInvocationException: 
    when() requires an argument which has to be 'a method call on a mock'.
    For example:
        when(mock.getArticles()).thenReturn(articles);</p>
    
    <p>Also, this error might show up because:
    1. you stub either of: final/private/equals()/hashCode() methods.    Those methods <em>cannot</em> be stubbed/verified.
    2. inside when() you don't call method on mock but on some other object.
    3. the parent of the mocked class is not public.    It is a limitation of the mock engine.</p>
  </blockquote>
  
  <p>Can I do something else to set this field?</p>