title: Correct usage of ParameterizedTypeReference
body: <p>In a test I wish to hit an endpoint which returns a list of a type. Currently I have</p>
  
  <pre><code>@Test
  public void when_endpoint_is_hit_then_return_list(){
     //Given
     ParameterizedTypeReference&lt;List&lt;Example&gt;&gt; responseType = new ParameterizedTypeReference&lt;List&lt;Example&gt;&gt;() {};
  
     String targetUrl = "/path/to/hit/" + expectedExample.getParameterOfList();
  
     //When
  
     //This works however highlights an unchecked assignment of List to List&lt;Example&gt;
     List&lt;Example&gt; actualExample = restTemplate.getForObject(targetUrl, List.class);
  
     //This does not work
     List&lt;Example&gt; actualExample = restTemplate.getForObject(targetUrl, responseType);
  
     //This does not work either
     List&lt;Example&gt; actualExample = restTemplate.exchange(targetUrl, HttpMethod.GET, null, new ParameterizedTypeReference&lt;List&lt;Example&gt;&gt;() {});
  
     //Then
     //Assert Results
  }
  </code></pre>
  
  <p>The problem for getForObject method is the ParameterizedTypeReference makes the getForObject method not resolve, as the types do not match up.</p>
  
  <p>The problem for the exchange method is incompatible types. Required List but 'exchange' was inferred to ResponseEntity: no instance(s) of type variable(s) exist so that ResponseEntity conforms to List</p>
  
  <p>How could I use the ParameterizedTypeReference correctly in this situation to safely return the List type I want?</p>