title: Wanted but not invoked: There were zero interactions with this mock
body: <p>I am stuck with this issue for the whole day. Tried many resources and debug features but no luck.</p>
  
  <p>Can you guys please help me. </p>
  
  <pre><code>public class Data{
  
      DataDriver dataDriver; // DataDriver is a different class which I have injected.
      Connector connector; // Connector is a different class which I am injecting in Data class.
  
      // Constructor and Setter methods
  
      public void read(){
              CloseableHttpClient client = HttpClients.createDefault();
              Hashmap&lt;String, String&gt; credentials = dataDriver.run(new Date());
              HttpGet get = connector.execute(client,credentials);
      }
  }
  </code></pre>
  
  <p>For my test class, I am using Powermockito, as <code>HttClients.createDefault()</code> is a static method.      </p>
  
  <pre><code>@ContextConfiguration(locations = { "classpath:/XXX.xml" })
  @RunWith(PowerMockRunner.class)
  public class DataTest {
  
      Data mockeddata;
  
      @Mock
      Connector mockedconnector;
  
      @Mock
      DataDriver mockeddataDriver;
  
      @Mock
      CloseableHttpClient mockedClient;
  
      @Before
      public void Setup() {
          MockitoAnnotations.initMocks(Data.class);
          mockeddata =new Data();
          PowerMockito.mockStatic(HttpClients.class);
          mockedData.setConnector(mockedconnector);
          mockedData.setDataDriver(mockedDataDriver);
      }
  
      @Test
      @PrepareForTest({ HttpClients.class })
      public void testRead(){
          HashMap&lt;String, String&gt; credentials = new HashMap&lt;String, String&gt;();    
          PowerMockito.when(HttpClients.createDefault()).thenReturn(mockedClient);
          PowerMockito.when(mockeddataDriver.run(newDate())).thenReturn(credentials);
          PowerMockito.when(mockedconnector.execute(mockedClient,credentials)).thenReturn(new HttpGet());
          verify(mockedconnector, atLeastOnce()).execute(mockedClient, credentials);
      }
  }
  </code></pre>
  
  <p>It says zero interactions with the connector mock. Its not complaining on the dataDriver mock. I tried debugging and was able to see both my mock objects in the Data class. But its not going into the <em>execute</em> funtion of the Connector.</p>
  
  <p>Any advise on what I am doing wrong?</p>
  
  <p>Thank You</p>