title: Why does Mockito think this autowired bean is null?
body: <p>I have this class called restTemplate. It is a RestTemplate object from the Spring Framework. I am trying to reset it in the beginning of a setup method for my Mockito test but I get the exception: <br></p>
  
  <pre><code>org.mockito.exceptions.misusing.NotAMockException: Argument should be a mock, but is null!
  </code></pre>
  
  <p><br> So what am I doing wrong? I have the correct packages listed under </p>
  
  <pre><code>&lt;context:component-scan base-package = "..."/&gt;
  </code></pre>
  
  <p>It is autowired into my test class and is listed in my applicationContext-test.xml file. What should I be looking at first?<br>Edit:</p>
  
  <pre><code>&lt;bean id="restTemplate" class="org.mockito.Mockito" factory-method="mock"&gt;
      &lt;constructor-arg value="org.springframework.web.client.RestTemplate" /&gt;
  &lt;/bean&gt;
  </code></pre>