Upgrade to spring-javaformat 0.0.11
This commit is contained in:
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2012-2016 the original author or authors.
|
||||
* * Copyright 2012-2019 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@@ -48,8 +48,7 @@ public class CustomerController {
|
||||
|
||||
@GetMapping(produces = MediaType.APPLICATION_JSON_VALUE)
|
||||
HttpEntity<Resources<Customer>> showCustomers() {
|
||||
Resources<Customer> resources = new Resources<Customer>(
|
||||
this.repository.findAll());
|
||||
Resources<Customer> resources = new Resources<Customer>(this.repository.findAll());
|
||||
resources.add(this.entityLinks.linkToCollectionResource(Customer.class));
|
||||
return new ResponseEntity<Resources<Customer>>(resources, HttpStatus.OK);
|
||||
}
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2012-2016 the original author or authors.
|
||||
* * Copyright 2012-2019 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@@ -42,11 +42,9 @@ public class SampleHateoasApplicationTests {
|
||||
|
||||
@Test
|
||||
public void hasHalLinks() throws Exception {
|
||||
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\"");
|
||||
}
|
||||
|
||||
@@ -55,8 +53,8 @@ public 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;charset=UTF-8"));
|
||||
|
||||
Reference in New Issue
Block a user