Junit Mockito test case for ResponseEntity<?> in spring integration framework
<p>I am trying to mock the external call.</p>

<p><div class="snippet" data-lang="js" data-hide="false" data-console="true" data-babel="false">
<div class="snippet-code">
<pre class="snippet-code-html lang-html prettyprint-override"><code> ResponseEntity&lt;?&gt; httpResponse = requestGateway.pushNotification(xtifyRequest);</code></pre>
</div>
</div>
</p>

<p>requestGateway is an interface.</p>

<pre><code>public interface RequestGateway
{
ResponseEntity&lt;?&gt; pushNotification(XtifyRequest xtifyRequest);
}
</code></pre>

<p>Below is the test method i am trying to do.</p>

<pre><code> @Test
public void test()
{


    ResponseEntity&lt;?&gt; r=new ResponseEntity&lt;&gt;(HttpStatus.ACCEPTED);

    when(requestGateway.pushNotification(any(XtifyRequest.class))).thenReturn(r);
}
</code></pre>

<p>A compilation error is there in the above when statement,saying it as an invalid type.even thougg r is of type ResponseEntity.</p>

<p>Can anyone please help me to solve this issue ?</p>