Cleanup and format code
This commit is contained in:
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2012-2016 the original author or authors.
|
||||
* Copyright 2012-2017 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.
|
||||
@@ -51,7 +51,7 @@ public class SampleController {
|
||||
@PostMapping("/")
|
||||
@ResponseBody
|
||||
public Map<String, Object> olleh(@Validated Message message) {
|
||||
Map<String, Object> model = new LinkedHashMap<String, Object>();
|
||||
Map<String, Object> model = new LinkedHashMap<>();
|
||||
model.put("message", message.getValue());
|
||||
model.put("title", "Hello Home");
|
||||
model.put("date", new Date());
|
||||
|
||||
@@ -48,7 +48,7 @@ public class SampleAtmosphereApplication {
|
||||
public ServletRegistrationBean<AtmosphereServlet> atmosphereServlet() {
|
||||
// Dispatcher servlet is mapped to '/home' to allow the AtmosphereServlet
|
||||
// to be mapped to '/chat'
|
||||
ServletRegistrationBean<AtmosphereServlet> registration = new ServletRegistrationBean<AtmosphereServlet>(
|
||||
ServletRegistrationBean<AtmosphereServlet> registration = new ServletRegistrationBean<>(
|
||||
new AtmosphereServlet(), "/chat/*");
|
||||
registration.addInitParameter("org.atmosphere.cpr.packages", "sample");
|
||||
registration.addInitParameter("org.atmosphere.interceptor.HeartbeatInterceptor"
|
||||
|
||||
@@ -79,7 +79,7 @@ public class SampleAtmosphereApplicationTests {
|
||||
|
||||
private final CountDownLatch latch = new CountDownLatch(1);
|
||||
|
||||
private final AtomicReference<String> messagePayload = new AtomicReference<String>();
|
||||
private final AtomicReference<String> messagePayload = new AtomicReference<>();
|
||||
|
||||
@Override
|
||||
public void run(String... args) throws Exception {
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2012-2016 the original author or authors.
|
||||
* Copyright 2012-2017 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.
|
||||
@@ -83,7 +83,7 @@ class HotelServiceImpl implements HotelService {
|
||||
private final Map<Rating, Long> ratingCount;
|
||||
|
||||
public ReviewsSummaryImpl(List<RatingCount> ratingCounts) {
|
||||
this.ratingCount = new HashMap<Rating, Long>();
|
||||
this.ratingCount = new HashMap<>();
|
||||
for (RatingCount ratingCount : ratingCounts) {
|
||||
this.ratingCount.put(ratingCount.getRating(), ratingCount.getCount());
|
||||
}
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2012-2015 the original author or authors.
|
||||
* Copyright 2012-2017 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.
|
||||
@@ -25,7 +25,7 @@ import org.springframework.util.ObjectUtils;
|
||||
@Repository
|
||||
public class InMemoryCustomerRepository implements CustomerRepository {
|
||||
|
||||
private final List<Customer> customers = new ArrayList<Customer>();
|
||||
private final List<Customer> customers = new ArrayList<>();
|
||||
|
||||
public InMemoryCustomerRepository() {
|
||||
this.customers.add(new Customer(1L, "Oliver", "Gierke"));
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2012-2016 the original author or authors.
|
||||
* Copyright 2012-2017 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,17 +48,16 @@ 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<>(this.repository.findAll());
|
||||
resources.add(this.entityLinks.linkToCollectionResource(Customer.class));
|
||||
return new ResponseEntity<Resources<Customer>>(resources, HttpStatus.OK);
|
||||
return new ResponseEntity<>(resources, HttpStatus.OK);
|
||||
}
|
||||
|
||||
@GetMapping(path = "/{id}", produces = MediaType.APPLICATION_JSON_VALUE)
|
||||
HttpEntity<Resource<Customer>> showCustomer(@PathVariable Long id) {
|
||||
Resource<Customer> resource = new Resource<Customer>(this.repository.findOne(id));
|
||||
Resource<Customer> resource = new Resource<>(this.repository.findOne(id));
|
||||
resource.add(this.entityLinks.linkToSingleResource(Customer.class, id));
|
||||
return new ResponseEntity<Resource<Customer>>(resource, HttpStatus.OK);
|
||||
return new ResponseEntity<>(resource, HttpStatus.OK);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -47,7 +47,7 @@ public class SampleJersey1Application {
|
||||
|
||||
@Bean
|
||||
public FilterRegistrationBean<ServletContainer> jersey() {
|
||||
FilterRegistrationBean<ServletContainer> bean = new FilterRegistrationBean<ServletContainer>();
|
||||
FilterRegistrationBean<ServletContainer> bean = new FilterRegistrationBean<>();
|
||||
bean.setFilter(new ServletContainer());
|
||||
bean.addInitParameter("com.sun.jersey.config.property.packages",
|
||||
"com.sun.jersey;sample.jersey1");
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2012-2016 the original author or authors.
|
||||
* Copyright 2012-2017 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.
|
||||
@@ -63,7 +63,7 @@ public class SampleJettyApplicationTests {
|
||||
public void testCompression() throws Exception {
|
||||
HttpHeaders requestHeaders = new HttpHeaders();
|
||||
requestHeaders.set("Accept-Encoding", "gzip");
|
||||
HttpEntity<?> requestEntity = new HttpEntity<Object>(requestHeaders);
|
||||
HttpEntity<?> requestEntity = new HttpEntity<>(requestHeaders);
|
||||
|
||||
ResponseEntity<byte[]> entity = this.restTemplate.exchange("/", HttpMethod.GET,
|
||||
requestEntity, byte[].class);
|
||||
|
||||
@@ -133,6 +133,7 @@ public class Author extends TableImpl<Record> {
|
||||
/**
|
||||
* Rename this table
|
||||
*/
|
||||
@Override
|
||||
public Author rename(String name) {
|
||||
return new Author(name, null);
|
||||
}
|
||||
|
||||
@@ -136,6 +136,7 @@ public class Book extends TableImpl<Record> {
|
||||
/**
|
||||
* Rename this table
|
||||
*/
|
||||
@Override
|
||||
public Book rename(String name) {
|
||||
return new Book(name, null);
|
||||
}
|
||||
|
||||
@@ -94,6 +94,7 @@ public class BookStore extends TableImpl<Record> {
|
||||
/**
|
||||
* Rename this table
|
||||
*/
|
||||
@Override
|
||||
public BookStore rename(String name) {
|
||||
return new BookStore(name, null);
|
||||
}
|
||||
|
||||
@@ -124,6 +124,7 @@ public class BookToBookStore extends TableImpl<Record> {
|
||||
/**
|
||||
* Rename this table
|
||||
*/
|
||||
@Override
|
||||
public BookToBookStore rename(String name) {
|
||||
return new BookToBookStore(name, null);
|
||||
}
|
||||
|
||||
@@ -114,6 +114,7 @@ public class Language extends TableImpl<Record> {
|
||||
/**
|
||||
* Rename this table
|
||||
*/
|
||||
@Override
|
||||
public Language rename(String name) {
|
||||
return new Language(name, null);
|
||||
}
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2012-2016 the original author or authors.
|
||||
* Copyright 2012-2017 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.
|
||||
@@ -67,8 +67,8 @@ public class SampleSessionRedisApplicationTests {
|
||||
HttpHeaders requestHeaders = new HttpHeaders();
|
||||
requestHeaders.set("Cookie", response.getHeaders().getFirst("Set-Cookie"));
|
||||
|
||||
RequestEntity<Void> request = new RequestEntity<Void>(requestHeaders,
|
||||
HttpMethod.GET, uri);
|
||||
RequestEntity<Void> request = new RequestEntity<>(requestHeaders, HttpMethod.GET,
|
||||
uri);
|
||||
|
||||
String uuid2 = restTemplate.exchange(request, String.class).getBody();
|
||||
assertThat(uuid1).isEqualTo(uuid2);
|
||||
|
||||
@@ -71,7 +71,7 @@ public class SampleTomcatApplicationTests {
|
||||
public void testCompression() throws Exception {
|
||||
HttpHeaders requestHeaders = new HttpHeaders();
|
||||
requestHeaders.set("Accept-Encoding", "gzip");
|
||||
HttpEntity<?> requestEntity = new HttpEntity<Object>(requestHeaders);
|
||||
HttpEntity<?> requestEntity = new HttpEntity<>(requestHeaders);
|
||||
ResponseEntity<byte[]> entity = this.restTemplate.exchange("/", HttpMethod.GET,
|
||||
requestEntity, byte[].class);
|
||||
assertThat(entity.getStatusCode()).isEqualTo(HttpStatus.OK);
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2012-2016 the original author or authors.
|
||||
* Copyright 2012-2017 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.
|
||||
@@ -66,7 +66,7 @@ public class SampleUndertowApplicationTests {
|
||||
public void testCompression() throws Exception {
|
||||
HttpHeaders requestHeaders = new HttpHeaders();
|
||||
requestHeaders.set("Accept-Encoding", "gzip");
|
||||
HttpEntity<?> requestEntity = new HttpEntity<Object>(requestHeaders);
|
||||
HttpEntity<?> requestEntity = new HttpEntity<>(requestHeaders);
|
||||
ResponseEntity<byte[]> entity = this.restTemplate.exchange("/", HttpMethod.GET,
|
||||
requestEntity, byte[].class);
|
||||
assertThat(entity.getStatusCode()).isEqualTo(HttpStatus.OK);
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2012-2016 the original author or authors.
|
||||
* Copyright 2012-2017 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.
|
||||
@@ -62,7 +62,7 @@ public class SampleWebFreeMarkerApplicationTests {
|
||||
public void testFreeMarkerErrorTemplate() throws Exception {
|
||||
HttpHeaders headers = new HttpHeaders();
|
||||
headers.setAccept(Arrays.asList(MediaType.TEXT_HTML));
|
||||
HttpEntity<String> requestEntity = new HttpEntity<String>(headers);
|
||||
HttpEntity<String> requestEntity = new HttpEntity<>(headers);
|
||||
|
||||
ResponseEntity<String> responseEntity = this.testRestTemplate
|
||||
.exchange("/does-not-exist", HttpMethod.GET, requestEntity, String.class);
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2012-2015 the original author or authors.
|
||||
* Copyright 2012-2017 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.
|
||||
@@ -24,7 +24,7 @@ public class InMemoryMessageRepository implements MessageRepository {
|
||||
|
||||
private static AtomicLong counter = new AtomicLong();
|
||||
|
||||
private final ConcurrentMap<Long, Message> messages = new ConcurrentHashMap<Long, Message>();
|
||||
private final ConcurrentMap<Long, Message> messages = new ConcurrentHashMap<>();
|
||||
|
||||
@Override
|
||||
public Iterable<Message> findAll() {
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2012-2016 the original author or authors.
|
||||
* Copyright 2012-2017 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.
|
||||
@@ -77,7 +77,7 @@ public class MessageController {
|
||||
}
|
||||
|
||||
private Map<String, ObjectError> getFieldErrors(BindingResult result) {
|
||||
Map<String, ObjectError> map = new HashMap<String, ObjectError>();
|
||||
Map<String, ObjectError> map = new HashMap<>();
|
||||
for (FieldError error : result.getFieldErrors()) {
|
||||
map.put(error.getField(), error);
|
||||
}
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2012-2016 the original author or authors.
|
||||
* Copyright 2012-2017 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.
|
||||
@@ -61,7 +61,7 @@ public class SampleGroovyTemplateApplicationTests {
|
||||
|
||||
@Test
|
||||
public void testCreate() throws Exception {
|
||||
MultiValueMap<String, String> map = new LinkedMultiValueMap<String, String>();
|
||||
MultiValueMap<String, String> map = new LinkedMultiValueMap<>();
|
||||
map.set("text", "FOO text");
|
||||
map.set("summary", "FOO");
|
||||
URI location = this.restTemplate.postForLocation("/", map);
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2012-2016 the original author or authors.
|
||||
* Copyright 2012-2017 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.
|
||||
@@ -72,14 +72,12 @@ public class SampleMethodSecurityApplicationTests {
|
||||
public void testLogin() throws Exception {
|
||||
HttpHeaders headers = new HttpHeaders();
|
||||
headers.setAccept(Arrays.asList(MediaType.TEXT_HTML));
|
||||
MultiValueMap<String, String> form = new LinkedMultiValueMap<String, String>();
|
||||
MultiValueMap<String, String> form = new LinkedMultiValueMap<>();
|
||||
form.set("username", "admin");
|
||||
form.set("password", "admin");
|
||||
getCsrf(form, headers);
|
||||
ResponseEntity<String> entity = this.restTemplate.exchange("/login",
|
||||
HttpMethod.POST,
|
||||
new HttpEntity<MultiValueMap<String, String>>(form, headers),
|
||||
String.class);
|
||||
HttpMethod.POST, new HttpEntity<>(form, headers), String.class);
|
||||
assertThat(entity.getStatusCode()).isEqualTo(HttpStatus.FOUND);
|
||||
assertThat(entity.getHeaders().getLocation().toString())
|
||||
.isEqualTo("http://localhost:" + this.port + "/");
|
||||
@@ -89,14 +87,12 @@ public class SampleMethodSecurityApplicationTests {
|
||||
public void testDenied() throws Exception {
|
||||
HttpHeaders headers = new HttpHeaders();
|
||||
headers.setAccept(Arrays.asList(MediaType.TEXT_HTML));
|
||||
MultiValueMap<String, String> form = new LinkedMultiValueMap<String, String>();
|
||||
MultiValueMap<String, String> form = new LinkedMultiValueMap<>();
|
||||
form.set("username", "user");
|
||||
form.set("password", "user");
|
||||
getCsrf(form, headers);
|
||||
ResponseEntity<String> entity = this.restTemplate.exchange("/login",
|
||||
HttpMethod.POST,
|
||||
new HttpEntity<MultiValueMap<String, String>>(form, headers),
|
||||
String.class);
|
||||
HttpMethod.POST, new HttpEntity<>(form, headers), String.class);
|
||||
assertThat(entity.getStatusCode()).isEqualTo(HttpStatus.FOUND);
|
||||
String cookie = entity.getHeaders().getFirst("Set-Cookie");
|
||||
headers.set("Cookie", cookie);
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2012-2016 the original author or authors.
|
||||
* Copyright 2012-2017 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.
|
||||
@@ -61,7 +61,7 @@ public class SampleWebMustacheApplicationTests {
|
||||
public void testMustacheErrorTemplate() throws Exception {
|
||||
HttpHeaders headers = new HttpHeaders();
|
||||
headers.setAccept(Arrays.asList(MediaType.TEXT_HTML));
|
||||
HttpEntity<String> requestEntity = new HttpEntity<String>(headers);
|
||||
HttpEntity<String> requestEntity = new HttpEntity<>(headers);
|
||||
ResponseEntity<String> responseEntity = this.restTemplate
|
||||
.exchange("/does-not-exist", HttpMethod.GET, requestEntity, String.class);
|
||||
assertThat(responseEntity.getStatusCode()).isEqualTo(HttpStatus.NOT_FOUND);
|
||||
@@ -73,7 +73,7 @@ public class SampleWebMustacheApplicationTests {
|
||||
public void test503HtmlResource() throws Exception {
|
||||
HttpHeaders headers = new HttpHeaders();
|
||||
headers.setAccept(Arrays.asList(MediaType.TEXT_HTML));
|
||||
HttpEntity<String> requestEntity = new HttpEntity<String>(headers);
|
||||
HttpEntity<String> requestEntity = new HttpEntity<>(headers);
|
||||
ResponseEntity<String> entity = this.restTemplate.exchange("/serviceUnavailable",
|
||||
HttpMethod.GET, requestEntity, String.class);
|
||||
assertThat(entity.getStatusCode()).isEqualTo(HttpStatus.SERVICE_UNAVAILABLE);
|
||||
@@ -84,7 +84,7 @@ public class SampleWebMustacheApplicationTests {
|
||||
public void test5xxHtmlResource() throws Exception {
|
||||
HttpHeaders headers = new HttpHeaders();
|
||||
headers.setAccept(Arrays.asList(MediaType.TEXT_HTML));
|
||||
HttpEntity<String> requestEntity = new HttpEntity<String>(headers);
|
||||
HttpEntity<String> requestEntity = new HttpEntity<>(headers);
|
||||
ResponseEntity<String> entity = this.restTemplate.exchange("/bang",
|
||||
HttpMethod.GET, requestEntity, String.class);
|
||||
assertThat(entity.getStatusCode()).isEqualTo(HttpStatus.INTERNAL_SERVER_ERROR);
|
||||
@@ -95,7 +95,7 @@ public class SampleWebMustacheApplicationTests {
|
||||
public void test507Template() throws Exception {
|
||||
HttpHeaders headers = new HttpHeaders();
|
||||
headers.setAccept(Arrays.asList(MediaType.TEXT_HTML));
|
||||
HttpEntity<String> requestEntity = new HttpEntity<String>(headers);
|
||||
HttpEntity<String> requestEntity = new HttpEntity<>(headers);
|
||||
ResponseEntity<String> entity = this.restTemplate.exchange("/insufficientStorage",
|
||||
HttpMethod.GET, requestEntity, String.class);
|
||||
assertThat(entity.getStatusCode()).isEqualTo(HttpStatus.INSUFFICIENT_STORAGE);
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2012-2016 the original author or authors.
|
||||
* Copyright 2012-2017 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.
|
||||
@@ -83,13 +83,11 @@ public class SampleWebSecureCustomApplicationTests {
|
||||
HttpHeaders headers = getHeaders();
|
||||
headers.setAccept(Arrays.asList(MediaType.TEXT_HTML));
|
||||
headers.setContentType(MediaType.APPLICATION_FORM_URLENCODED);
|
||||
MultiValueMap<String, String> form = new LinkedMultiValueMap<String, String>();
|
||||
MultiValueMap<String, String> form = new LinkedMultiValueMap<>();
|
||||
form.set("username", "user");
|
||||
form.set("password", "user");
|
||||
ResponseEntity<String> entity = this.restTemplate.exchange("/login",
|
||||
HttpMethod.POST,
|
||||
new HttpEntity<MultiValueMap<String, String>>(form, headers),
|
||||
String.class);
|
||||
HttpMethod.POST, new HttpEntity<>(form, headers), String.class);
|
||||
assertThat(entity.getStatusCode()).isEqualTo(HttpStatus.FOUND);
|
||||
assertThat(entity.getHeaders().getLocation().toString())
|
||||
.endsWith(this.port + "/");
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2012-2016 the original author or authors.
|
||||
* Copyright 2012-2017 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.
|
||||
@@ -83,13 +83,11 @@ public class SampleWebSecureJdbcApplicationTests {
|
||||
HttpHeaders headers = getHeaders();
|
||||
headers.setAccept(Arrays.asList(MediaType.TEXT_HTML));
|
||||
headers.setContentType(MediaType.APPLICATION_FORM_URLENCODED);
|
||||
MultiValueMap<String, String> form = new LinkedMultiValueMap<String, String>();
|
||||
MultiValueMap<String, String> form = new LinkedMultiValueMap<>();
|
||||
form.set("username", "user");
|
||||
form.set("password", "user");
|
||||
ResponseEntity<String> entity = this.restTemplate.exchange("/login",
|
||||
HttpMethod.POST,
|
||||
new HttpEntity<MultiValueMap<String, String>>(form, headers),
|
||||
String.class);
|
||||
HttpMethod.POST, new HttpEntity<>(form, headers), String.class);
|
||||
assertThat(entity.getStatusCode()).isEqualTo(HttpStatus.FOUND);
|
||||
assertThat(entity.getHeaders().getLocation().toString())
|
||||
.endsWith(this.port + "/");
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2012-2016 the original author or authors.
|
||||
* Copyright 2012-2017 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.
|
||||
@@ -83,13 +83,11 @@ public class SampleSecureApplicationTests {
|
||||
HttpHeaders headers = getHeaders();
|
||||
headers.setAccept(Arrays.asList(MediaType.TEXT_HTML));
|
||||
headers.setContentType(MediaType.APPLICATION_FORM_URLENCODED);
|
||||
MultiValueMap<String, String> form = new LinkedMultiValueMap<String, String>();
|
||||
MultiValueMap<String, String> form = new LinkedMultiValueMap<>();
|
||||
form.set("username", "user");
|
||||
form.set("password", "user");
|
||||
ResponseEntity<String> entity = this.restTemplate.exchange("/login",
|
||||
HttpMethod.POST,
|
||||
new HttpEntity<MultiValueMap<String, String>>(form, headers),
|
||||
String.class);
|
||||
HttpMethod.POST, new HttpEntity<>(form, headers), String.class);
|
||||
assertThat(entity.getStatusCode()).isEqualTo(HttpStatus.FOUND);
|
||||
assertThat(entity.getHeaders().getLocation().toString())
|
||||
.endsWith(this.port + "/");
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2012-2015 the original author or authors.
|
||||
* Copyright 2012-2017 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.
|
||||
@@ -27,7 +27,7 @@ public class InMemoryMessageRepository implements MessageRepository {
|
||||
|
||||
private static AtomicLong counter = new AtomicLong();
|
||||
|
||||
private final ConcurrentMap<Long, Message> messages = new ConcurrentHashMap<Long, Message>();
|
||||
private final ConcurrentMap<Long, Message> messages = new ConcurrentHashMap<>();
|
||||
|
||||
@Override
|
||||
public Iterable<Message> findAll() {
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2012-2016 the original author or authors.
|
||||
* Copyright 2012-2017 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.
|
||||
@@ -61,7 +61,7 @@ public class SampleWebUiApplicationTests {
|
||||
|
||||
@Test
|
||||
public void testCreate() throws Exception {
|
||||
MultiValueMap<String, String> map = new LinkedMultiValueMap<String, String>();
|
||||
MultiValueMap<String, String> map = new LinkedMultiValueMap<>();
|
||||
map.set("text", "FOO text");
|
||||
map.set("summary", "FOO");
|
||||
URI location = this.restTemplate.postForLocation("/", map);
|
||||
|
||||
@@ -28,7 +28,7 @@ public class Snake {
|
||||
|
||||
private static final int DEFAULT_LENGTH = 5;
|
||||
|
||||
private final Deque<Location> tail = new ArrayDeque<Location>();
|
||||
private final Deque<Location> tail = new ArrayDeque<>();
|
||||
|
||||
private final Object monitor = new Object();
|
||||
|
||||
|
||||
@@ -39,7 +39,7 @@ public class SnakeTimer {
|
||||
|
||||
private static final Logger log = LoggerFactory.getLogger(SnakeTimer.class);
|
||||
|
||||
private static final ConcurrentHashMap<Integer, Snake> snakes = new ConcurrentHashMap<Integer, Snake>();
|
||||
private static final ConcurrentHashMap<Integer, Snake> snakes = new ConcurrentHashMap<>();
|
||||
|
||||
private static Timer gameTimer = null;
|
||||
|
||||
|
||||
@@ -94,7 +94,7 @@ public class SampleWebSocketsApplicationTests {
|
||||
|
||||
private final CountDownLatch latch = new CountDownLatch(1);
|
||||
|
||||
private final AtomicReference<String> messagePayload = new AtomicReference<String>();
|
||||
private final AtomicReference<String> messagePayload = new AtomicReference<>();
|
||||
|
||||
@Override
|
||||
public void run(String... args) throws Exception {
|
||||
|
||||
@@ -109,7 +109,7 @@ public class CustomContainerWebSocketsApplicationTests {
|
||||
|
||||
private final CountDownLatch latch = new CountDownLatch(1);
|
||||
|
||||
private final AtomicReference<String> messagePayload = new AtomicReference<String>();
|
||||
private final AtomicReference<String> messagePayload = new AtomicReference<>();
|
||||
|
||||
@Override
|
||||
public void run(String... args) throws Exception {
|
||||
|
||||
@@ -28,7 +28,7 @@ public class Snake {
|
||||
|
||||
private static final int DEFAULT_LENGTH = 5;
|
||||
|
||||
private final Deque<Location> tail = new ArrayDeque<Location>();
|
||||
private final Deque<Location> tail = new ArrayDeque<>();
|
||||
|
||||
private final Object monitor = new Object();
|
||||
|
||||
|
||||
@@ -39,7 +39,7 @@ public class SnakeTimer {
|
||||
|
||||
private static final Log log = LogFactory.getLog(SnakeTimer.class);
|
||||
|
||||
private static final ConcurrentHashMap<Integer, Snake> snakes = new ConcurrentHashMap<Integer, Snake>();
|
||||
private static final ConcurrentHashMap<Integer, Snake> snakes = new ConcurrentHashMap<>();
|
||||
|
||||
private static Timer gameTimer = null;
|
||||
|
||||
|
||||
@@ -94,7 +94,7 @@ public class SampleWebSocketsApplicationTests {
|
||||
|
||||
private final CountDownLatch latch = new CountDownLatch(1);
|
||||
|
||||
private final AtomicReference<String> messagePayload = new AtomicReference<String>();
|
||||
private final AtomicReference<String> messagePayload = new AtomicReference<>();
|
||||
|
||||
@Override
|
||||
public void run(String... args) throws Exception {
|
||||
|
||||
@@ -109,7 +109,7 @@ public class CustomContainerWebSocketsApplicationTests {
|
||||
|
||||
private final CountDownLatch latch = new CountDownLatch(1);
|
||||
|
||||
private final AtomicReference<String> messagePayload = new AtomicReference<String>();
|
||||
private final AtomicReference<String> messagePayload = new AtomicReference<>();
|
||||
|
||||
@Override
|
||||
public void run(String... args) throws Exception {
|
||||
|
||||
@@ -28,7 +28,7 @@ public class Snake {
|
||||
|
||||
private static final int DEFAULT_LENGTH = 5;
|
||||
|
||||
private final Deque<Location> tail = new ArrayDeque<Location>();
|
||||
private final Deque<Location> tail = new ArrayDeque<>();
|
||||
|
||||
private final Object monitor = new Object();
|
||||
|
||||
|
||||
@@ -39,7 +39,7 @@ public class SnakeTimer {
|
||||
|
||||
private static final Logger log = LoggerFactory.getLogger(SnakeTimer.class);
|
||||
|
||||
private static final ConcurrentHashMap<Integer, Snake> snakes = new ConcurrentHashMap<Integer, Snake>();
|
||||
private static final ConcurrentHashMap<Integer, Snake> snakes = new ConcurrentHashMap<>();
|
||||
|
||||
private static Timer gameTimer = null;
|
||||
|
||||
|
||||
@@ -94,7 +94,7 @@ public class SampleWebSocketsApplicationTests {
|
||||
|
||||
private final CountDownLatch latch = new CountDownLatch(1);
|
||||
|
||||
private final AtomicReference<String> messagePayload = new AtomicReference<String>();
|
||||
private final AtomicReference<String> messagePayload = new AtomicReference<>();
|
||||
|
||||
@Override
|
||||
public void run(String... args) throws Exception {
|
||||
|
||||
@@ -109,7 +109,7 @@ public class CustomContainerWebSocketsApplicationTests {
|
||||
|
||||
private final CountDownLatch latch = new CountDownLatch(1);
|
||||
|
||||
private final AtomicReference<String> messagePayload = new AtomicReference<String>();
|
||||
private final AtomicReference<String> messagePayload = new AtomicReference<>();
|
||||
|
||||
@Override
|
||||
public void run(String... args) throws Exception {
|
||||
|
||||
Reference in New Issue
Block a user