title: Mockito injection not working for constructor AND setter mocks together
body: <p>I have a class that has members injected through constructors, and OTHERS through setters. I can't seem to get Mockito to inject the setter ones. The constructor-injected are mocked fine, but the setter ones come back as null. When I flipped the setter-ed members to constructor- injected, all is well. here is the original production code:</p>
  
  <pre><code>@Autowired
  private BetRepository betRepository;
  
  public void setBetRepository(BetRepository betRepository) {
  this.betRepository = betRepository;
  }
  
  
  public TournamentScoringCache(TournamentScoringCacheInitializer cacheInitializer,
          ScoringEngineInitializer scoringEngineInitializer) {
      tournamentUserStates = cacheInitializer.initCache();
      scoringEngines = scoringEngineInitializer.initEngines();
  }
  
  public &lt;T extends SideScore&gt; void updateGameScore(Long tournamentId, Long gameId, MatchScore&lt;T&gt; score) {
      Map&lt;Long, UserTournamentState&gt; userStates = tournamentUserStates.get(tournamentId);
      ScoringEngine&lt;?&gt; scoringEngine = scoringEngines.get(tournamentId);
      List&lt;Bet&gt; bets = betRepository.getBetsByGameId(gameId);  //HERE IS WHERE I GET THE NPE
  ....
  }
  </code></pre>
  
  <p>Test Code:</p>
  
  <pre><code>@Mock
  BetRepository betRepository;
  @Mock
  TournamentScoringCacheInitializer cacheInitializer;
  @Mock
  ScoringEngineInitializer engineInitializer;
  
  @InjectMocks
  private TournamentScoringCacheAndDB tournamentScoringCache;
  
  @Test
  public void testUpdateGameScore() {
  ....        
  when(cacheInitializer.initCache()).thenReturn(utss);
      when(betRepository.getBetsByGameId(1L)).thenReturn(createBets());
      when(engineInitializer.initEngines()).thenReturn(createEngines());
      when(engine.getBetScore(bet1, score)).thenReturn(betScore);
      when(engine.getBetScore(bet2, score)).thenReturn(betScore2);
  
      tournamentScoringCache.updateGameScore(tournamentId, gameId, score);
  ....
  }
  </code></pre>
  
  <p>Any ideas?</p>
  
  <p>THanks!</p>