title: Getting around setter injection using mockito's @InjectMocks
body: <p>I have an abstract class with two Map fields. One I would like to mock and inject into an object of a subclass of AbstractClass for unit testing. The other I really don't care much about, but it has a setter.</p>
  
  <pre><code>public abstract class AbstractClass {
      private Map&lt;String, Object&gt; mapToMock;
      private Map&lt;String, Object&gt; dontMockMe;
  
      private void setDontMockMe(Map&lt;String, Object&gt; map) {
          dontMockMe = map;
      }
  }
  </code></pre>
  
  <p>When using @InjectMocks, it automatically tries to inject in the order: constructor, setter, field. It checks if it can inject in each of these places by checking types, then names if there are multiple type possibilities. This doesn't work well for me, because my mocked mapToMock is actually injected into dontMockMe via its setter. I cannot edit this abstract class. Is there any way for me to get around the setter injection? Thank you in advance!</p>