Closed
Description
In Boot 2.4.2, both overloads of TestRestTemplate#exchange
that accept RequestEntity
call getUrl
on it. When the RequestEntity
has been initialized with a URI template instead of a java.net.URI
, this triggers an UnsupportedOperationException
.
var req = RequestEntity.get("http://localhost/helloworld").build();
var resp = testRestTemplate.exchange(req, String.class);
Internally, the real RestTemplate
dispatches based on the concrete type of RequestEntity
, but TestRestTemplate
fails to check.