title: mockito @Mock does not inject into named @Resource as expected
body: <p>I have a class with three named @Resource members as follows: </p>
  
  <pre><code>@Resource(name = "contactsPaginationRequestValidator")
  private PaginationRequestValidator paginationRequestValidator;
  
  @Resource(name = "integerMaxPaginationRequestValidator")
  private PaginationRequestValidator integerMaxPaginationRequestValidator;
  
  @Resource(name = "contactsSearchResultPaginationRequestValidator")
  private PaginationRequestValidator contactsSearchResultPaginationRequestValidator;
  </code></pre>
  
  <p>After upgrading to Mockito 1.9.5 from 1.8.5, the test began failing. The test suite mocked PaginationRequestValidator only once as follows:</p>
  
  <pre><code>@Mock
  private PaginationRequestValidator mockPaginationRequestValidator;
  </code></pre>
  
  <p>This resulted in only the third of the three instances being injected as the following sysout makes clear:</p>
  
  <pre><code>paginationRequestValidator (contactsPaginationRequestValidator) is null
  integerMaxPaginationRequestValidator (integerMaxPaginationRequestValidator) is null
  contactsSearchResultPaginationRequestValidator (contactsSearchResultPaginationRequestValidator) is mockPaginationRequestValidator
  </code></pre>
  
  <p>Obviously, there was a change in behavior between the two versions. I am assuming the older version injected the mock into all three of fields - which would still be an acceptable solution to me. </p>
  
  <p>Being the smart guy that I am, I figured I could get the test to pass by providing the name associated with the resource, as follows:</p>
  
  <pre><code>@Mock(name = "contactsPaginationRequestValidator")
  private PaginationRequestValidator mockPaginationRequestValidator;
  </code></pre>
  
  <p>This resulted in similar, but subtly different results. The third field, not the expected targeted field was mocked, as above, but the it was mocked with the name provided in the @Mock. See the sysout:</p>
  
  <pre><code>paginationRequestValidator (contactsPaginationRequestValidator) is null
  integerMaxPaginationRequestValidator (integerMaxPaginationRequestValidator) is null
  contactsSearchResultPaginationRequestValidator (contactsSearchResultPaginationRequestValidator) is contactsPaginationRequestValidator
  </code></pre>
  
  <p>This is totally unexpected behavior. Yet, there is more. When I then added a similar mock for the second field, all the fields ended being mocked as expected: </p>
  
  <pre><code>@Mock(name = "contactsPaginationRequestValidator")
  private PaginationRequestValidator mockPaginationRequestValidator;
  
  @Mock(name = "integerMaxPaginationRequestValidator")
  private PaginationRequestValidator mockIntegerMaxPaginationRequestValidator;
  </code></pre>
  
  <p>Sysout:</p>
  
  <pre><code>paginationRequestValidator (contactsPaginationRequestValidator) is contactsPaginationRequestValidator
  integerMaxPaginationRequestValidator (integerMaxPaginationRequestValidator) is integerMaxPaginationRequestValidator
  contactsSearchResultPaginationRequestValidator (contactsSearchResultPaginationRequestValidator) is null
  </code></pre>
  
  <p>While this is exactly as I would expect, it seems completely contradictory to the previous tries.</p>
  
  <p>I have the documentation that explains this behavior, but it does not suggest a way to inject the same mock into all three. Is this possible, or must I create multiple mocks and then change individual test cases to use the "correct" mock?</p>
  
  <p>The test suite uses the @InjectMocks annotation.</p>