mock resttemplate to test a service as restFul client
<p>I have a service class, written in spring, with some methods.</p>
<p>One of this acts as a restful consumer like below:</p>
<pre><code>HttpEntity request = new HttpEntity&lt;&gt;(getHeadersForRequest());
RestTemplate restTemplate = new RestTemplate();
String url = ENDPOINT_URL.concat(ENDPOINT_API1);

UriComponentsBuilder builder = UriComponentsBuilder.fromHttpUrl(url)
                                        .queryParam(&quot;param1&quot;, parameter1);
ReportModel infoModel = null;
try {
    infoModel = restTemplate.exchange(builder.toUriString(),
                    HttpMethod.GET, request, ReportModel.class).getBody();
} catch (HttpClientErrorException | HttpServerErrorException e){
    e.printStackTrace();
}
</code></pre>
<p>I want to use <code>Mockito</code> to mock my service, but every method that interacts with restful server instance a <code>new RestTemplate</code>.</p>
<p>I've to create a static class to Inject it into my service?</p>