JMockit withCapture() returning null
<p>I am trying to verify an argument passed to a mock using Verifications of JMockit. The mock seems to be working, but the argument is not getting captured and returns null.</p>

<pre><code>@Test
public void testHTTPRequestGeneration() throws IOException{

    final CloseableHttpClient anyInstance = HttpClientBuilder.create().build();

    new NonStrictExpectations(CloseableHttpClient.class) {
        {
            anyInstance.execute((HttpUriRequest)any); 
            result = new MockHTTPResponse();    
        }   
    };

    Entity entity = new Entity();
    entity.setType(Entity1);
    handler.processEvent(entity);

    new Verifications() {{
        HttpUriRequest httpUriRequest;
        anyInstance.execute(httpUriRequest = withCapture());
        System.out.println("----&gt;"+httpUriRequest);
    }};

}
</code></pre>

<p>In above the response of execute is getting mocked fine, i get the return value as "new MockHTTPResponse()". But the verification block is not capturing it.</p>