Merge branch '2.1.x'
Closes gh-17079
This commit is contained in:
@@ -39,11 +39,9 @@ class SampleHateoasApplicationTests {
|
||||
|
||||
@Test
|
||||
void hasHalLinks() {
|
||||
ResponseEntity<String> entity = this.restTemplate.getForEntity("/customers/1",
|
||||
String.class);
|
||||
ResponseEntity<String> entity = this.restTemplate.getForEntity("/customers/1", String.class);
|
||||
assertThat(entity.getStatusCode()).isEqualTo(HttpStatus.OK);
|
||||
assertThat(entity.getBody()).startsWith(
|
||||
"{\"id\":1,\"firstName\":\"Oliver\"" + ",\"lastName\":\"Gierke\"");
|
||||
assertThat(entity.getBody()).startsWith("{\"id\":1,\"firstName\":\"Oliver\"" + ",\"lastName\":\"Gierke\"");
|
||||
assertThat(entity.getBody()).contains("_links\":{\"self\":{\"href\"");
|
||||
}
|
||||
|
||||
@@ -52,11 +50,10 @@ class SampleHateoasApplicationTests {
|
||||
HttpHeaders headers = new HttpHeaders();
|
||||
headers.set(HttpHeaders.ACCEPT, "application/xml;q=0.9,application/json;q=0.8");
|
||||
HttpEntity<?> request = new HttpEntity<>(headers);
|
||||
ResponseEntity<String> response = this.restTemplate.exchange("/customers/1",
|
||||
HttpMethod.GET, request, String.class);
|
||||
ResponseEntity<String> response = this.restTemplate.exchange("/customers/1", HttpMethod.GET, request,
|
||||
String.class);
|
||||
assertThat(response.getStatusCode()).isEqualTo(HttpStatus.OK);
|
||||
assertThat(response.getHeaders().getContentType())
|
||||
.isEqualTo(MediaType.parseMediaType("application/json"));
|
||||
assertThat(response.getHeaders().getContentType()).isEqualTo(MediaType.parseMediaType("application/json"));
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user