title: Mockito.thenReturn(...) in not working
body: <p>Test Class</p>
  
  <pre><code>public class CollectionImplementationUnitTest {
  
    CollectionImplementation colImp;
  
    public void setup() throws Exception {
      ...
      colImp = Mockito.spy(new CollectionImplementation());
      ...
    }
  
    private String mockHistoryFromStrgyTable() {
      String value1 = "myValue";
      return value1;
    }
  
    @Test 
    public void testgetinfo (){
      ...
      Mockito.when(
        colImp.historyFromStrgyTable(
           Mockito.anyString(),Mockito.anyString(),Mockito.anyString()
        )
      )
      .thenReturn(mockHistoryFromStrgyTable());
  
      CollectionsAccount Info = colImp.accountInfo(
        "string1","string2","string3", new IdentityAcc(), TableLst
      );
  
      //sometestmethods and asserts
    }
  }
  </code></pre>
  
  <p>Class under Test</p>
  
  <pre><code>public class CollectionImplementation {
    ...
    @Override
    public CollectionsAccount accountInfo(("string1","string2","string3", new IdentityAcc(), TableLst)) {
        DetailsHelper helper = new (db2, "string",getmethod());
        return helper.accountInfo("string1","string2", new IdentityAcc(), TableLst); 
    }
  
    public String historyFromStrgyTable(){
      //contains a call to the data base
    }
  }
  </code></pre>
  
  <p><strong>DetailsHelper</strong></p>
  
  <pre><code>public class DetailsHelper{
    public CollectionsAccount accountInfo((String string1,String string2,String string3, new IdentityAcc(), TableLst)){
    ...
    String paymentdetails = historyFromStrgyTable();  
    }
     public String historyFromStrgyTable(){
     //contains a call to the data base
     }
  }
  </code></pre>
  
  <p>When I try to mock the data for the method HistoryFromStrgyTable() it is actually making a call to HistoryFromStrgyTable() instead of getting from mockHistoryFromStrgyTable().</p>
  
  <p>My test cases are failing at this line</p>
  
  <pre><code>Mockito.when(col_Imp.HistoryFromStrgyTable(Mockito.anyString(),
    Mockito.anyString(),Mockito.anyString())).thenReturn(  mockHistoryFromStrgyTable());
  </code></pre>
  
  <p>Can anyone help me with this. I don't understand what's wrong. I also changed the method mockHistoryFromStrgyTable() from private to public since mockito cannot mock private methods.</p>