Explicit type can be replaced by <>
Issue: SPR-13188
This commit is contained in:
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2002-2015 the original author or authors.
|
||||
* Copyright 2002-2016 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.
|
||||
@@ -33,7 +33,7 @@ public class HttpEntityTests {
|
||||
@Test
|
||||
public void noHeaders() {
|
||||
String body = "foo";
|
||||
HttpEntity<String> entity = new HttpEntity<String>(body);
|
||||
HttpEntity<String> entity = new HttpEntity<>(body);
|
||||
assertSame(body, entity.getBody());
|
||||
assertTrue(entity.getHeaders().isEmpty());
|
||||
}
|
||||
@@ -43,7 +43,7 @@ public class HttpEntityTests {
|
||||
HttpHeaders headers = new HttpHeaders();
|
||||
headers.setContentType(MediaType.TEXT_PLAIN);
|
||||
String body = "foo";
|
||||
HttpEntity<String> entity = new HttpEntity<String>(body, headers);
|
||||
HttpEntity<String> entity = new HttpEntity<>(body, headers);
|
||||
assertEquals(body, entity.getBody());
|
||||
assertEquals(MediaType.TEXT_PLAIN, entity.getHeaders().getContentType());
|
||||
assertEquals("text/plain", entity.getHeaders().getFirst("Content-Type"));
|
||||
@@ -51,10 +51,10 @@ public class HttpEntityTests {
|
||||
|
||||
@Test
|
||||
public void multiValueMap() {
|
||||
MultiValueMap<String, String> map = new LinkedMultiValueMap<String, String>();
|
||||
MultiValueMap<String, String> map = new LinkedMultiValueMap<>();
|
||||
map.set("Content-Type", "text/plain");
|
||||
String body = "foo";
|
||||
HttpEntity<String> entity = new HttpEntity<String>(body, map);
|
||||
HttpEntity<String> entity = new HttpEntity<>(body, map);
|
||||
assertEquals(body, entity.getBody());
|
||||
assertEquals(MediaType.TEXT_PLAIN, entity.getHeaders().getContentType());
|
||||
assertEquals("text/plain", entity.getHeaders().getFirst("Content-Type"));
|
||||
@@ -62,25 +62,25 @@ public class HttpEntityTests {
|
||||
|
||||
@Test
|
||||
public void testEquals() {
|
||||
MultiValueMap<String, String> map1 = new LinkedMultiValueMap<String, String>();
|
||||
MultiValueMap<String, String> map1 = new LinkedMultiValueMap<>();
|
||||
map1.set("Content-Type", "text/plain");
|
||||
|
||||
MultiValueMap<String, String> map2 = new LinkedMultiValueMap<String, String>();
|
||||
MultiValueMap<String, String> map2 = new LinkedMultiValueMap<>();
|
||||
map2.set("Content-Type", "application/json");
|
||||
|
||||
assertTrue(new HttpEntity<Object>().equals(new HttpEntity<Object>()));
|
||||
assertFalse(new HttpEntity<Object>(map1).equals(new HttpEntity<Object>()));
|
||||
assertFalse(new HttpEntity<Object>().equals(new HttpEntity<Object>(map2)));
|
||||
assertTrue(new HttpEntity<>().equals(new HttpEntity<Object>()));
|
||||
assertFalse(new HttpEntity<>(map1).equals(new HttpEntity<Object>()));
|
||||
assertFalse(new HttpEntity<>().equals(new HttpEntity<Object>(map2)));
|
||||
|
||||
assertTrue(new HttpEntity<Object>(map1).equals(new HttpEntity<Object>(map1)));
|
||||
assertFalse(new HttpEntity<Object>(map1).equals(new HttpEntity<Object>(map2)));
|
||||
assertTrue(new HttpEntity<>(map1).equals(new HttpEntity<Object>(map1)));
|
||||
assertFalse(new HttpEntity<>(map1).equals(new HttpEntity<Object>(map2)));
|
||||
|
||||
assertTrue(new HttpEntity<String>(null, null).equals(new HttpEntity<String>(null, null)));
|
||||
assertFalse(new HttpEntity<String>("foo", null).equals(new HttpEntity<String>(null, null)));
|
||||
assertFalse(new HttpEntity<String>(null, null).equals(new HttpEntity<String>("bar", null)));
|
||||
assertFalse(new HttpEntity<>("foo", null).equals(new HttpEntity<String>(null, null)));
|
||||
assertFalse(new HttpEntity<String>(null, null).equals(new HttpEntity<>("bar", null)));
|
||||
|
||||
assertTrue(new HttpEntity<String>("foo", map1).equals(new HttpEntity<String>("foo", map1)));
|
||||
assertFalse(new HttpEntity<String>("foo", map1).equals(new HttpEntity<String>("bar", map1)));
|
||||
assertTrue(new HttpEntity<>("foo", map1).equals(new HttpEntity<String>("foo", map1)));
|
||||
assertFalse(new HttpEntity<>("foo", map1).equals(new HttpEntity<String>("bar", map1)));
|
||||
}
|
||||
|
||||
@Test
|
||||
@@ -88,9 +88,9 @@ public class HttpEntityTests {
|
||||
HttpHeaders headers = new HttpHeaders();
|
||||
headers.setContentType(MediaType.TEXT_PLAIN);
|
||||
String body = "foo";
|
||||
HttpEntity<String> httpEntity = new HttpEntity<String>(body, headers);
|
||||
ResponseEntity<String> responseEntity = new ResponseEntity<String>(body, headers, HttpStatus.OK);
|
||||
ResponseEntity<String> responseEntity2 = new ResponseEntity<String>(body, headers, HttpStatus.OK);
|
||||
HttpEntity<String> httpEntity = new HttpEntity<>(body, headers);
|
||||
ResponseEntity<String> responseEntity = new ResponseEntity<>(body, headers, HttpStatus.OK);
|
||||
ResponseEntity<String> responseEntity2 = new ResponseEntity<>(body, headers, HttpStatus.OK);
|
||||
|
||||
assertEquals(body, responseEntity.getBody());
|
||||
assertEquals(MediaType.TEXT_PLAIN, responseEntity.getHeaders().getContentType());
|
||||
@@ -108,9 +108,9 @@ public class HttpEntityTests {
|
||||
HttpHeaders headers = new HttpHeaders();
|
||||
headers.setContentType(MediaType.TEXT_PLAIN);
|
||||
String body = "foo";
|
||||
HttpEntity<String> httpEntity = new HttpEntity<String>(body, headers);
|
||||
RequestEntity<String> requestEntity = new RequestEntity<String>(body, headers, HttpMethod.GET, new URI("/"));
|
||||
RequestEntity<String> requestEntity2 = new RequestEntity<String>(body, headers, HttpMethod.GET, new URI("/"));
|
||||
HttpEntity<String> httpEntity = new HttpEntity<>(body, headers);
|
||||
RequestEntity<String> requestEntity = new RequestEntity<>(body, headers, HttpMethod.GET, new URI("/"));
|
||||
RequestEntity<String> requestEntity2 = new RequestEntity<>(body, headers, HttpMethod.GET, new URI("/"));
|
||||
|
||||
assertEquals(body, requestEntity.getBody());
|
||||
assertEquals(MediaType.TEXT_PLAIN, requestEntity.getHeaders().getContentType());
|
||||
|
||||
@@ -58,7 +58,7 @@ public class HttpHeadersTests {
|
||||
public void accept() {
|
||||
MediaType mediaType1 = new MediaType("text", "html");
|
||||
MediaType mediaType2 = new MediaType("text", "plain");
|
||||
List<MediaType> mediaTypes = new ArrayList<MediaType>(2);
|
||||
List<MediaType> mediaTypes = new ArrayList<>(2);
|
||||
mediaTypes.add(mediaType1);
|
||||
mediaTypes.add(mediaType2);
|
||||
headers.setAccept(mediaTypes);
|
||||
@@ -78,7 +78,7 @@ public class HttpHeadersTests {
|
||||
public void acceptCharsets() {
|
||||
Charset charset1 = Charset.forName("UTF-8");
|
||||
Charset charset2 = Charset.forName("ISO-8859-1");
|
||||
List<Charset> charsets = new ArrayList<Charset>(2);
|
||||
List<Charset> charsets = new ArrayList<>(2);
|
||||
charsets.add(charset1);
|
||||
charsets.add(charset2);
|
||||
headers.setAcceptCharset(charsets);
|
||||
@@ -184,7 +184,7 @@ public class HttpHeadersTests {
|
||||
public void ifNoneMatchList() {
|
||||
String ifNoneMatch1 = "\"v2.6\"";
|
||||
String ifNoneMatch2 = "\"v2.7\", \"v2.8\"";
|
||||
List<String> ifNoneMatchList = new ArrayList<String>(2);
|
||||
List<String> ifNoneMatchList = new ArrayList<>(2);
|
||||
ifNoneMatchList.add(ifNoneMatch1);
|
||||
ifNoneMatchList.add(ifNoneMatch2);
|
||||
headers.setIfNoneMatch(ifNoneMatchList);
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2002-2015 the original author or authors.
|
||||
* Copyright 2002-2016 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 @@ import static org.junit.Assert.*;
|
||||
/** @author Arjen Poutsma */
|
||||
public class HttpStatusTests {
|
||||
|
||||
private Map<Integer, String> statusCodes = new LinkedHashMap<Integer, String>();
|
||||
private Map<Integer, String> statusCodes = new LinkedHashMap<>();
|
||||
|
||||
@Before
|
||||
public void createStatusCodes() {
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2002-2013 the original author or authors.
|
||||
* Copyright 2002-2016 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.
|
||||
@@ -158,14 +158,14 @@ public class MediaTypeTests {
|
||||
|
||||
assertTrue("Invalid comparison result", audioBasicLevel.compareTo(audio) > 0);
|
||||
|
||||
List<MediaType> expected = new ArrayList<MediaType>();
|
||||
List<MediaType> expected = new ArrayList<>();
|
||||
expected.add(audio);
|
||||
expected.add(audioBasic);
|
||||
expected.add(audioBasicLevel);
|
||||
expected.add(audioBasic07);
|
||||
expected.add(audioWave);
|
||||
|
||||
List<MediaType> result = new ArrayList<MediaType>(expected);
|
||||
List<MediaType> result = new ArrayList<>(expected);
|
||||
Random rnd = new Random();
|
||||
// shuffle & sort 10 times
|
||||
for (int i = 0; i < 10; i++) {
|
||||
@@ -277,7 +277,7 @@ public class MediaTypeTests {
|
||||
MediaType audioBasicLevel = new MediaType("audio", "basic", Collections.singletonMap("level", "1"));
|
||||
MediaType all = MediaType.ALL;
|
||||
|
||||
List<MediaType> expected = new ArrayList<MediaType>();
|
||||
List<MediaType> expected = new ArrayList<>();
|
||||
expected.add(audioBasicLevel);
|
||||
expected.add(audioBasic);
|
||||
expected.add(audio);
|
||||
@@ -285,7 +285,7 @@ public class MediaTypeTests {
|
||||
expected.add(audio03);
|
||||
expected.add(all);
|
||||
|
||||
List<MediaType> result = new ArrayList<MediaType>(expected);
|
||||
List<MediaType> result = new ArrayList<>(expected);
|
||||
Random rnd = new Random();
|
||||
// shuffle & sort 10 times
|
||||
for (int i = 0; i < 10; i++) {
|
||||
@@ -304,12 +304,12 @@ public class MediaTypeTests {
|
||||
MediaType audioWave = new MediaType("audio", "wave");
|
||||
MediaType textHtml = new MediaType("text", "html");
|
||||
|
||||
List<MediaType> expected = new ArrayList<MediaType>();
|
||||
List<MediaType> expected = new ArrayList<>();
|
||||
expected.add(textHtml);
|
||||
expected.add(audioBasic);
|
||||
expected.add(audioWave);
|
||||
|
||||
List<MediaType> result = new ArrayList<MediaType>(expected);
|
||||
List<MediaType> result = new ArrayList<>(expected);
|
||||
MediaType.sortBySpecificity(result);
|
||||
|
||||
for (int i = 0; i < result.size(); i++) {
|
||||
@@ -381,7 +381,7 @@ public class MediaTypeTests {
|
||||
MediaType audioBasicLevel = new MediaType("audio", "basic", Collections.singletonMap("level", "1"));
|
||||
MediaType all = MediaType.ALL;
|
||||
|
||||
List<MediaType> expected = new ArrayList<MediaType>();
|
||||
List<MediaType> expected = new ArrayList<>();
|
||||
expected.add(audioBasicLevel);
|
||||
expected.add(audioBasic);
|
||||
expected.add(audio);
|
||||
@@ -389,7 +389,7 @@ public class MediaTypeTests {
|
||||
expected.add(audio07);
|
||||
expected.add(audio03);
|
||||
|
||||
List<MediaType> result = new ArrayList<MediaType>(expected);
|
||||
List<MediaType> result = new ArrayList<>(expected);
|
||||
Random rnd = new Random();
|
||||
// shuffle & sort 10 times
|
||||
for (int i = 0; i < 10; i++) {
|
||||
@@ -408,12 +408,12 @@ public class MediaTypeTests {
|
||||
MediaType audioWave = new MediaType("audio", "wave");
|
||||
MediaType textHtml = new MediaType("text", "html");
|
||||
|
||||
List<MediaType> expected = new ArrayList<MediaType>();
|
||||
List<MediaType> expected = new ArrayList<>();
|
||||
expected.add(textHtml);
|
||||
expected.add(audioBasic);
|
||||
expected.add(audioWave);
|
||||
|
||||
List<MediaType> result = new ArrayList<MediaType>(expected);
|
||||
List<MediaType> result = new ArrayList<>(expected);
|
||||
MediaType.sortBySpecificity(result);
|
||||
|
||||
for (int i = 0; i < result.size(); i++) {
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2002-2012 the original author or authors.
|
||||
* Copyright 2002-2016 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.
|
||||
@@ -59,7 +59,7 @@ public class InterceptingClientHttpRequestFactoryTests {
|
||||
|
||||
@Test
|
||||
public void basic() throws Exception {
|
||||
List<ClientHttpRequestInterceptor> interceptors = new ArrayList<ClientHttpRequestInterceptor>();
|
||||
List<ClientHttpRequestInterceptor> interceptors = new ArrayList<>();
|
||||
interceptors.add(new NoOpInterceptor());
|
||||
interceptors.add(new NoOpInterceptor());
|
||||
interceptors.add(new NoOpInterceptor());
|
||||
@@ -77,7 +77,7 @@ public class InterceptingClientHttpRequestFactoryTests {
|
||||
|
||||
@Test
|
||||
public void noExecution() throws Exception {
|
||||
List<ClientHttpRequestInterceptor> interceptors = new ArrayList<ClientHttpRequestInterceptor>();
|
||||
List<ClientHttpRequestInterceptor> interceptors = new ArrayList<>();
|
||||
interceptors.add(new ClientHttpRequestInterceptor() {
|
||||
@Override
|
||||
public ClientHttpResponse intercept(HttpRequest request, byte[] body, ClientHttpRequestExecution execution)
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2002-2015 the original author or authors.
|
||||
* Copyright 2002-2016 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.
|
||||
@@ -112,7 +112,7 @@ public class FormHttpMessageConverterTests {
|
||||
|
||||
@Test
|
||||
public void writeForm() throws IOException {
|
||||
MultiValueMap<String, String> body = new LinkedMultiValueMap<String, String>();
|
||||
MultiValueMap<String, String> body = new LinkedMultiValueMap<>();
|
||||
body.set("name 1", "value 1");
|
||||
body.add("name 2", "value 2+1");
|
||||
body.add("name 2", "value 2+2");
|
||||
@@ -130,7 +130,7 @@ public class FormHttpMessageConverterTests {
|
||||
|
||||
@Test
|
||||
public void writeMultipart() throws Exception {
|
||||
MultiValueMap<String, Object> parts = new LinkedMultiValueMap<String, Object>();
|
||||
MultiValueMap<String, Object> parts = new LinkedMultiValueMap<>();
|
||||
parts.add("name 1", "value 1");
|
||||
parts.add("name 2", "value 2+1");
|
||||
parts.add("name 2", "value 2+2");
|
||||
@@ -151,7 +151,7 @@ public class FormHttpMessageConverterTests {
|
||||
Source xml = new StreamSource(new StringReader("<root><child/></root>"));
|
||||
HttpHeaders entityHeaders = new HttpHeaders();
|
||||
entityHeaders.setContentType(MediaType.TEXT_XML);
|
||||
HttpEntity<Source> entity = new HttpEntity<Source>(xml, entityHeaders);
|
||||
HttpEntity<Source> entity = new HttpEntity<>(xml, entityHeaders);
|
||||
parts.add("xml", entity);
|
||||
|
||||
MockHttpOutputMessage outputMessage = new MockHttpOutputMessage();
|
||||
@@ -209,12 +209,12 @@ public class FormHttpMessageConverterTests {
|
||||
MyBean myBean = new MyBean();
|
||||
myBean.setString("foo");
|
||||
|
||||
MultiValueMap<String, Object> parts = new LinkedMultiValueMap<String, Object>();
|
||||
MultiValueMap<String, Object> parts = new LinkedMultiValueMap<>();
|
||||
parts.add("part1", myBean);
|
||||
|
||||
HttpHeaders entityHeaders = new HttpHeaders();
|
||||
entityHeaders.setContentType(MediaType.TEXT_XML);
|
||||
HttpEntity<MyBean> entity = new HttpEntity<MyBean>(myBean, entityHeaders);
|
||||
HttpEntity<MyBean> entity = new HttpEntity<>(myBean, entityHeaders);
|
||||
parts.add("part2", entity);
|
||||
|
||||
MockHttpOutputMessage outputMessage = new MockHttpOutputMessage();
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2002-2015 the original author or authors.
|
||||
* Copyright 2002-2016 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.
|
||||
@@ -40,7 +40,7 @@ public class HttpMessageConverterTests {
|
||||
@Test
|
||||
public void canRead() {
|
||||
MediaType mediaType = new MediaType("foo", "bar");
|
||||
HttpMessageConverter<MyType> converter = new MyHttpMessageConverter<MyType>(mediaType);
|
||||
HttpMessageConverter<MyType> converter = new MyHttpMessageConverter<>(mediaType);
|
||||
|
||||
assertTrue(converter.canRead(MyType.class, mediaType));
|
||||
assertFalse(converter.canRead(MyType.class, new MediaType("foo", "*")));
|
||||
@@ -50,7 +50,7 @@ public class HttpMessageConverterTests {
|
||||
@Test
|
||||
public void canReadWithWildcardSubtype() {
|
||||
MediaType mediaType = new MediaType("foo");
|
||||
HttpMessageConverter<MyType> converter = new MyHttpMessageConverter<MyType>(mediaType);
|
||||
HttpMessageConverter<MyType> converter = new MyHttpMessageConverter<>(mediaType);
|
||||
|
||||
assertTrue(converter.canRead(MyType.class, new MediaType("foo", "bar")));
|
||||
assertTrue(converter.canRead(MyType.class, new MediaType("foo", "*")));
|
||||
@@ -60,7 +60,7 @@ public class HttpMessageConverterTests {
|
||||
@Test
|
||||
public void canWrite() {
|
||||
MediaType mediaType = new MediaType("foo", "bar");
|
||||
HttpMessageConverter<MyType> converter = new MyHttpMessageConverter<MyType>(mediaType);
|
||||
HttpMessageConverter<MyType> converter = new MyHttpMessageConverter<>(mediaType);
|
||||
|
||||
assertTrue(converter.canWrite(MyType.class, mediaType));
|
||||
assertTrue(converter.canWrite(MyType.class, new MediaType("foo", "*")));
|
||||
@@ -70,7 +70,7 @@ public class HttpMessageConverterTests {
|
||||
@Test
|
||||
public void canWriteWithWildcardInSupportedSubtype() {
|
||||
MediaType mediaType = new MediaType("foo");
|
||||
HttpMessageConverter<MyType> converter = new MyHttpMessageConverter<MyType>(mediaType);
|
||||
HttpMessageConverter<MyType> converter = new MyHttpMessageConverter<>(mediaType);
|
||||
|
||||
assertTrue(converter.canWrite(MyType.class, new MediaType("foo", "bar")));
|
||||
assertTrue(converter.canWrite(MyType.class, new MediaType("foo", "*")));
|
||||
|
||||
@@ -105,7 +105,7 @@ public class ResourceRegionHttpMessageConverterTests {
|
||||
MockHttpOutputMessage outputMessage = new MockHttpOutputMessage();
|
||||
Resource body = new ClassPathResource("byterangeresource.txt", getClass());
|
||||
List<HttpRange> rangeList = HttpRange.parseRanges("bytes=0-5,7-15,17-20,22-38");
|
||||
List<ResourceRegion> regions = new ArrayList<ResourceRegion>();
|
||||
List<ResourceRegion> regions = new ArrayList<>();
|
||||
for(HttpRange range : rangeList) {
|
||||
regions.add(range.toResourceRegion(body));
|
||||
}
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2002-2014 the original author or authors.
|
||||
* Copyright 2002-2016 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.
|
||||
@@ -98,7 +98,7 @@ public class AtomFeedHttpMessageConverterTests {
|
||||
entry2.setId("id2");
|
||||
entry2.setTitle("title2");
|
||||
|
||||
List<Entry> entries = new ArrayList<Entry>(2);
|
||||
List<Entry> entries = new ArrayList<>(2);
|
||||
entries.add(entry1);
|
||||
entries.add(entry2);
|
||||
feed.setEntries(entries);
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2002-2014 the original author or authors.
|
||||
* Copyright 2002-2016 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.
|
||||
@@ -98,7 +98,7 @@ public class RssChannelHttpMessageConverterTests {
|
||||
Item item2 = new Item();
|
||||
item2.setTitle("title2");
|
||||
|
||||
List<Item> items = new ArrayList<Item>(2);
|
||||
List<Item> items = new ArrayList<>(2);
|
||||
items.add(item1);
|
||||
items.add(item2);
|
||||
channel.setItems(items);
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2002-2015 the original author or authors.
|
||||
* Copyright 2002-2016 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.
|
||||
@@ -94,7 +94,7 @@ public class GsonHttpMessageConverterTests {
|
||||
assertEquals(42, n.longValue());
|
||||
n = (Number) result.get("fraction");
|
||||
assertEquals(42D, n.doubleValue(), 0D);
|
||||
List<String> array = new ArrayList<String>();
|
||||
List<String> array = new ArrayList<>();
|
||||
array.add("Foo");
|
||||
array.add("Bar");
|
||||
assertEquals(array, result.get("array"));
|
||||
|
||||
@@ -344,7 +344,7 @@ public class Jackson2ObjectMapperBuilderTests {
|
||||
public void mixIns() {
|
||||
Class<?> target = String.class;
|
||||
Class<?> mixInSource = Object.class;
|
||||
Map<Class<?>, Class<?>> mixIns = new HashMap<Class<?>, Class<?>>();
|
||||
Map<Class<?>, Class<?>> mixIns = new HashMap<>();
|
||||
mixIns.put(target, mixInSource);
|
||||
|
||||
ObjectMapper objectMapper = Jackson2ObjectMapperBuilder.json().modules()
|
||||
@@ -374,7 +374,7 @@ public class Jackson2ObjectMapperBuilderTests {
|
||||
public void completeSetup() throws JsonMappingException {
|
||||
NopAnnotationIntrospector annotationIntrospector = NopAnnotationIntrospector.instance;
|
||||
|
||||
Map<Class<?>, JsonDeserializer<?>> deserializerMap = new HashMap<Class<?>, JsonDeserializer<?>>();
|
||||
Map<Class<?>, JsonDeserializer<?>> deserializerMap = new HashMap<>();
|
||||
JsonDeserializer<Date> deserializer = new DateDeserializers.DateDeserializer();
|
||||
deserializerMap.put(Date.class, deserializer);
|
||||
|
||||
|
||||
@@ -283,7 +283,7 @@ public class Jackson2ObjectMapperFactoryBeanTests {
|
||||
public void setMixIns() {
|
||||
Class<?> target = String.class;
|
||||
Class<?> mixinSource = Object.class;
|
||||
Map<Class<?>, Class<?>> mixIns = new HashMap<Class<?>, Class<?>>();
|
||||
Map<Class<?>, Class<?>> mixIns = new HashMap<>();
|
||||
mixIns.put(target, mixinSource);
|
||||
|
||||
this.factory.setModules(Collections.emptyList());
|
||||
@@ -316,7 +316,7 @@ public class Jackson2ObjectMapperFactoryBeanTests {
|
||||
assertTrue(this.factory.isSingleton());
|
||||
assertEquals(ObjectMapper.class, this.factory.getObjectType());
|
||||
|
||||
Map<Class<?>, JsonDeserializer<?>> deserializers = new HashMap<Class<?>, JsonDeserializer<?>>();
|
||||
Map<Class<?>, JsonDeserializer<?>> deserializers = new HashMap<>();
|
||||
deserializers.put(Date.class, new DateDeserializer());
|
||||
|
||||
JsonSerializer<Class<?>> serializer1 = new ClassSerializer();
|
||||
|
||||
@@ -99,7 +99,7 @@ public class MappingJackson2HttpMessageConverterTests {
|
||||
assertEquals("Foo", result.get("string"));
|
||||
assertEquals(42, result.get("number"));
|
||||
assertEquals(42D, (Double) result.get("fraction"), 0D);
|
||||
List<String> array = new ArrayList<String>();
|
||||
List<String> array = new ArrayList<>();
|
||||
array.add("Foo");
|
||||
array.add("Bar");
|
||||
assertEquals(array, result.get("array"));
|
||||
@@ -329,7 +329,7 @@ public class MappingJackson2HttpMessageConverterTests {
|
||||
@Test // SPR-13318
|
||||
public void writeSubTypeList() throws Exception {
|
||||
MockHttpOutputMessage outputMessage = new MockHttpOutputMessage();
|
||||
List<MyBean> beans = new ArrayList<MyBean>();
|
||||
List<MyBean> beans = new ArrayList<>();
|
||||
MyBean foo = new MyBean();
|
||||
foo.setString("Foo");
|
||||
foo.setNumber(42);
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2002-2015 the original author or authors.
|
||||
* Copyright 2002-2016 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.
|
||||
@@ -73,7 +73,7 @@ public class SourceHttpMessageConverterTests {
|
||||
|
||||
@Before
|
||||
public void setUp() throws IOException {
|
||||
converter = new SourceHttpMessageConverter<Source>();
|
||||
converter = new SourceHttpMessageConverter<>();
|
||||
Resource external = new ClassPathResource("external.txt", getClass());
|
||||
|
||||
bodyExternal = "<!DOCTYPE root SYSTEM \"http://192.168.28.42/1.jsp\" [" +
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2002-2012 the original author or authors.
|
||||
* Copyright 2002-2016 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.
|
||||
@@ -35,7 +35,7 @@ import org.springframework.util.CollectionUtils;
|
||||
*/
|
||||
class HeaderValueHolder {
|
||||
|
||||
private final List<Object> values = new LinkedList<Object>();
|
||||
private final List<Object> values = new LinkedList<>();
|
||||
|
||||
|
||||
public void setValue(Object value) {
|
||||
@@ -60,7 +60,7 @@ class HeaderValueHolder {
|
||||
}
|
||||
|
||||
public List<String> getStringValues() {
|
||||
List<String> stringList = new ArrayList<String>(this.values.size());
|
||||
List<String> stringList = new ArrayList<>(this.values.size());
|
||||
for (Object value : this.values) {
|
||||
stringList.add(value.toString());
|
||||
}
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2002-2015 the original author or authors.
|
||||
* Copyright 2002-2016 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.
|
||||
@@ -45,13 +45,13 @@ public class MockAsyncContext implements AsyncContext {
|
||||
|
||||
private final HttpServletResponse response;
|
||||
|
||||
private final List<AsyncListener> listeners = new ArrayList<AsyncListener>();
|
||||
private final List<AsyncListener> listeners = new ArrayList<>();
|
||||
|
||||
private String dispatchedPath;
|
||||
|
||||
private long timeout = 10 * 1000L; // 10 seconds is Tomcat's default
|
||||
|
||||
private final List<Runnable> dispatchHandlers = new ArrayList<Runnable>();
|
||||
private final List<Runnable> dispatchHandlers = new ArrayList<>();
|
||||
|
||||
|
||||
public MockAsyncContext(ServletRequest request, ServletResponse response) {
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2002-2012 the original author or authors.
|
||||
* Copyright 2002-2016 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,7 +42,7 @@ public class MockFilterConfig implements FilterConfig {
|
||||
|
||||
private final String filterName;
|
||||
|
||||
private final Map<String, String> initParameters = new LinkedHashMap<String, String>();
|
||||
private final Map<String, String> initParameters = new LinkedHashMap<>();
|
||||
|
||||
|
||||
/**
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2002-2015 the original author or authors.
|
||||
* Copyright 2002-2016 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.
|
||||
@@ -144,7 +144,7 @@ public class MockHttpServletRequest implements HttpServletRequest {
|
||||
// ServletRequest properties
|
||||
// ---------------------------------------------------------------------
|
||||
|
||||
private final Map<String, Object> attributes = new LinkedHashMap<String, Object>();
|
||||
private final Map<String, Object> attributes = new LinkedHashMap<>();
|
||||
|
||||
private String characterEncoding;
|
||||
|
||||
@@ -152,7 +152,7 @@ public class MockHttpServletRequest implements HttpServletRequest {
|
||||
|
||||
private String contentType;
|
||||
|
||||
private final Map<String, String[]> parameters = new LinkedHashMap<String, String[]>(16);
|
||||
private final Map<String, String[]> parameters = new LinkedHashMap<>(16);
|
||||
|
||||
private String protocol = DEFAULT_PROTOCOL;
|
||||
|
||||
@@ -167,7 +167,7 @@ public class MockHttpServletRequest implements HttpServletRequest {
|
||||
private String remoteHost = DEFAULT_REMOTE_HOST;
|
||||
|
||||
/** List of locales in descending order */
|
||||
private final List<Locale> locales = new LinkedList<Locale>();
|
||||
private final List<Locale> locales = new LinkedList<>();
|
||||
|
||||
private boolean secure = false;
|
||||
|
||||
@@ -198,7 +198,7 @@ public class MockHttpServletRequest implements HttpServletRequest {
|
||||
|
||||
private Cookie[] cookies;
|
||||
|
||||
private final Map<String, HeaderValueHolder> headers = new LinkedCaseInsensitiveMap<HeaderValueHolder>();
|
||||
private final Map<String, HeaderValueHolder> headers = new LinkedCaseInsensitiveMap<>();
|
||||
|
||||
private String method;
|
||||
|
||||
@@ -210,7 +210,7 @@ public class MockHttpServletRequest implements HttpServletRequest {
|
||||
|
||||
private String remoteUser;
|
||||
|
||||
private final Set<String> userRoles = new HashSet<String>();
|
||||
private final Set<String> userRoles = new HashSet<>();
|
||||
|
||||
private Principal userPrincipal;
|
||||
|
||||
@@ -228,7 +228,7 @@ public class MockHttpServletRequest implements HttpServletRequest {
|
||||
|
||||
private boolean requestedSessionIdFromURL = false;
|
||||
|
||||
private final MultiValueMap<String, Part> parts = new LinkedMultiValueMap<String, Part>();
|
||||
private final MultiValueMap<String, Part> parts = new LinkedMultiValueMap<>();
|
||||
|
||||
|
||||
// ---------------------------------------------------------------------
|
||||
@@ -347,7 +347,7 @@ public class MockHttpServletRequest implements HttpServletRequest {
|
||||
@Override
|
||||
public Enumeration<String> getAttributeNames() {
|
||||
checkActive();
|
||||
return Collections.enumeration(new LinkedHashSet<String>(this.attributes.keySet()));
|
||||
return Collections.enumeration(new LinkedHashSet<>(this.attributes.keySet()));
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -973,7 +973,7 @@ public class MockHttpServletRequest implements HttpServletRequest {
|
||||
@Override
|
||||
public Enumeration<String> getHeaders(String name) {
|
||||
HeaderValueHolder header = HeaderValueHolder.getByName(this.headers, name);
|
||||
return Collections.enumeration(header != null ? header.getStringValues() : new LinkedList<String>());
|
||||
return Collections.enumeration(header != null ? header.getStringValues() : new LinkedList<>());
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -1213,7 +1213,7 @@ public class MockHttpServletRequest implements HttpServletRequest {
|
||||
|
||||
@Override
|
||||
public Collection<Part> getParts() throws IOException, IllegalStateException, ServletException {
|
||||
List<Part> result = new LinkedList<Part>();
|
||||
List<Part> result = new LinkedList<>();
|
||||
for (List<Part> list : this.parts.values()) {
|
||||
result.addAll(list);
|
||||
}
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2002-2015 the original author or authors.
|
||||
* Copyright 2002-2016 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.
|
||||
@@ -102,9 +102,9 @@ public class MockHttpServletResponse implements HttpServletResponse {
|
||||
// HttpServletResponse properties
|
||||
//---------------------------------------------------------------------
|
||||
|
||||
private final List<Cookie> cookies = new ArrayList<Cookie>();
|
||||
private final List<Cookie> cookies = new ArrayList<>();
|
||||
|
||||
private final Map<String, HeaderValueHolder> headers = new LinkedCaseInsensitiveMap<HeaderValueHolder>();
|
||||
private final Map<String, HeaderValueHolder> headers = new LinkedCaseInsensitiveMap<>();
|
||||
|
||||
private int status = HttpServletResponse.SC_OK;
|
||||
|
||||
@@ -112,7 +112,7 @@ public class MockHttpServletResponse implements HttpServletResponse {
|
||||
|
||||
private String forwardedUrl;
|
||||
|
||||
private final List<String> includedUrls = new ArrayList<String>();
|
||||
private final List<String> includedUrls = new ArrayList<>();
|
||||
|
||||
|
||||
//---------------------------------------------------------------------
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2002-2015 the original author or authors.
|
||||
* Copyright 2002-2016 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 MockHttpSession implements HttpSession {
|
||||
|
||||
private final ServletContext servletContext;
|
||||
|
||||
private final Map<String, Object> attributes = new LinkedHashMap<String, Object>();
|
||||
private final Map<String, Object> attributes = new LinkedHashMap<>();
|
||||
|
||||
private boolean invalid = false;
|
||||
|
||||
@@ -166,7 +166,7 @@ public class MockHttpSession implements HttpSession {
|
||||
@Override
|
||||
public Enumeration<String> getAttributeNames() {
|
||||
assertIsValid();
|
||||
return Collections.enumeration(new LinkedHashSet<String>(this.attributes.keySet()));
|
||||
return Collections.enumeration(new LinkedHashSet<>(this.attributes.keySet()));
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -270,7 +270,7 @@ public class MockHttpSession implements HttpSession {
|
||||
* @return a representation of this session's serialized state
|
||||
*/
|
||||
public Serializable serializeState() {
|
||||
HashMap<String, Serializable> state = new HashMap<String, Serializable>();
|
||||
HashMap<String, Serializable> state = new HashMap<>();
|
||||
for (Iterator<Map.Entry<String, Object>> it = this.attributes.entrySet().iterator(); it.hasNext();) {
|
||||
Map.Entry<String, Object> entry = it.next();
|
||||
String name = entry.getKey();
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2002-2015 the original author or authors.
|
||||
* Copyright 2002-2016 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.
|
||||
@@ -50,7 +50,7 @@ import org.springframework.web.multipart.MultipartHttpServletRequest;
|
||||
public class MockMultipartHttpServletRequest extends MockHttpServletRequest implements MultipartHttpServletRequest {
|
||||
|
||||
private final MultiValueMap<String, MultipartFile> multipartFiles =
|
||||
new LinkedMultiValueMap<String, MultipartFile>();
|
||||
new LinkedMultiValueMap<>();
|
||||
|
||||
|
||||
/**
|
||||
@@ -112,7 +112,7 @@ public class MockMultipartHttpServletRequest extends MockHttpServletRequest impl
|
||||
|
||||
@Override
|
||||
public MultiValueMap<String, MultipartFile> getMultiFileMap() {
|
||||
return new LinkedMultiValueMap<String, MultipartFile>(this.multipartFiles);
|
||||
return new LinkedMultiValueMap<>(this.multipartFiles);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2002-2015 the original author or authors.
|
||||
* Copyright 2002-2016 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 MockPageContext extends PageContext {
|
||||
|
||||
private final ServletConfig servletConfig;
|
||||
|
||||
private final Map<String, Object> attributes = new LinkedHashMap<String, Object>();
|
||||
private final Map<String, Object> attributes = new LinkedHashMap<>();
|
||||
|
||||
private JspWriter out;
|
||||
|
||||
@@ -257,7 +257,7 @@ public class MockPageContext extends PageContext {
|
||||
}
|
||||
|
||||
public Enumeration<String> getAttributeNames() {
|
||||
return Collections.enumeration(new LinkedHashSet<String>(this.attributes.keySet()));
|
||||
return Collections.enumeration(new LinkedHashSet<>(this.attributes.keySet()));
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2002-2012 the original author or authors.
|
||||
* Copyright 2002-2016 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.
|
||||
@@ -41,7 +41,7 @@ public class MockServletConfig implements ServletConfig {
|
||||
|
||||
private final String servletName;
|
||||
|
||||
private final Map<String, String> initParameters = new LinkedHashMap<String, String>();
|
||||
private final Map<String, String> initParameters = new LinkedHashMap<>();
|
||||
|
||||
|
||||
/**
|
||||
|
||||
@@ -106,7 +106,7 @@ public class MockServletContext implements ServletContext {
|
||||
private static final String TEMP_DIR_SYSTEM_PROPERTY = "java.io.tmpdir";
|
||||
|
||||
private static final Set<SessionTrackingMode> DEFAULT_SESSION_TRACKING_MODES =
|
||||
new LinkedHashSet<SessionTrackingMode>(3);
|
||||
new LinkedHashSet<>(3);
|
||||
|
||||
static {
|
||||
DEFAULT_SESSION_TRACKING_MODES.add(SessionTrackingMode.COOKIE);
|
||||
@@ -123,7 +123,7 @@ public class MockServletContext implements ServletContext {
|
||||
|
||||
private String contextPath = "";
|
||||
|
||||
private final Map<String, ServletContext> contexts = new HashMap<String, ServletContext>();
|
||||
private final Map<String, ServletContext> contexts = new HashMap<>();
|
||||
|
||||
private int majorVersion = 3;
|
||||
|
||||
@@ -133,17 +133,17 @@ public class MockServletContext implements ServletContext {
|
||||
|
||||
private int effectiveMinorVersion = 0;
|
||||
|
||||
private final Map<String, RequestDispatcher> namedRequestDispatchers = new HashMap<String, RequestDispatcher>();
|
||||
private final Map<String, RequestDispatcher> namedRequestDispatchers = new HashMap<>();
|
||||
|
||||
private String defaultServletName = COMMON_DEFAULT_SERVLET_NAME;
|
||||
|
||||
private final Map<String, String> initParameters = new LinkedHashMap<String, String>();
|
||||
private final Map<String, String> initParameters = new LinkedHashMap<>();
|
||||
|
||||
private final Map<String, Object> attributes = new LinkedHashMap<String, Object>();
|
||||
private final Map<String, Object> attributes = new LinkedHashMap<>();
|
||||
|
||||
private String servletContextName = "MockServletContext";
|
||||
|
||||
private final Set<String> declaredRoles = new LinkedHashSet<String>();
|
||||
private final Set<String> declaredRoles = new LinkedHashSet<>();
|
||||
|
||||
private Set<SessionTrackingMode> sessionTrackingModes;
|
||||
|
||||
@@ -304,7 +304,7 @@ public class MockServletContext implements ServletContext {
|
||||
if (ObjectUtils.isEmpty(fileList)) {
|
||||
return null;
|
||||
}
|
||||
Set<String> resourcePaths = new LinkedHashSet<String>(fileList.length);
|
||||
Set<String> resourcePaths = new LinkedHashSet<>(fileList.length);
|
||||
for (String fileEntry : fileList) {
|
||||
String resultPath = actualPath + fileEntry;
|
||||
if (resource.createRelative(fileEntry).getFile().isDirectory()) {
|
||||
@@ -502,7 +502,7 @@ public class MockServletContext implements ServletContext {
|
||||
|
||||
@Override
|
||||
public Enumeration<String> getAttributeNames() {
|
||||
return Collections.enumeration(new LinkedHashSet<String>(this.attributes.keySet()));
|
||||
return Collections.enumeration(new LinkedHashSet<>(this.attributes.keySet()));
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -1,3 +1,19 @@
|
||||
/*
|
||||
* Copyright 2002-2016 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.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
// Generated by the protocol buffer compiler. DO NOT EDIT!
|
||||
// source: sample.proto
|
||||
|
||||
@@ -614,11 +630,10 @@ public final class Msg extends
|
||||
org.springframework.protobuf.SecondMsg, org.springframework.protobuf.SecondMsg.Builder, org.springframework.protobuf.SecondMsgOrBuilder>
|
||||
getBlahFieldBuilder() {
|
||||
if (blahBuilder_ == null) {
|
||||
blahBuilder_ = new com.google.protobuf.SingleFieldBuilder<
|
||||
org.springframework.protobuf.SecondMsg, org.springframework.protobuf.SecondMsg.Builder, org.springframework.protobuf.SecondMsgOrBuilder>(
|
||||
blah_,
|
||||
getParentForChildren(),
|
||||
isClean());
|
||||
blahBuilder_ = new com.google.protobuf.SingleFieldBuilder<>(
|
||||
blah_,
|
||||
getParentForChildren(),
|
||||
isClean());
|
||||
blah_ = null;
|
||||
}
|
||||
return blahBuilder_;
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2002-2013 the original author or authors.
|
||||
* Copyright 2002-2016 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.
|
||||
@@ -242,7 +242,7 @@ public class ServletRequestDataBinderTests {
|
||||
assertTrue("Doesn't contain tory", !pvs.contains("tory"));
|
||||
|
||||
PropertyValue[] ps = pvs.getPropertyValues();
|
||||
Map<String, String> m = new HashMap<String, String>();
|
||||
Map<String, String> m = new HashMap<>();
|
||||
m.put("forname", "Tony");
|
||||
m.put("surname", "Blair");
|
||||
m.put("age", "50");
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2002-2015 the original author or authors.
|
||||
* Copyright 2002-2016 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.
|
||||
@@ -105,7 +105,7 @@ public class WebRequestDataBinderIntegrationTests {
|
||||
PartsBean bean = new PartsBean();
|
||||
partsServlet.setBean(bean);
|
||||
|
||||
MultiValueMap<String, Object> parts = new LinkedMultiValueMap<String, Object>();
|
||||
MultiValueMap<String, Object> parts = new LinkedMultiValueMap<>();
|
||||
Resource firstPart = new ClassPathResource("/org/springframework/http/converter/logo.jpg");
|
||||
parts.add("firstPart", firstPart);
|
||||
parts.add("secondPart", "secondValue");
|
||||
@@ -122,7 +122,7 @@ public class WebRequestDataBinderIntegrationTests {
|
||||
PartListBean bean = new PartListBean();
|
||||
partListServlet.setBean(bean);
|
||||
|
||||
MultiValueMap<String, Object> parts = new LinkedMultiValueMap<String, Object>();
|
||||
MultiValueMap<String, Object> parts = new LinkedMultiValueMap<>();
|
||||
parts.add("partList", "first value");
|
||||
parts.add("partList", "second value");
|
||||
Resource logo = new ClassPathResource("/org/springframework/http/converter/logo.jpg");
|
||||
|
||||
@@ -319,7 +319,7 @@ public class WebRequestDataBinderTests {
|
||||
assertTrue("Doesn't contain tory", !pvs.contains("tory"));
|
||||
|
||||
PropertyValue[] pvArray = pvs.getPropertyValues();
|
||||
Map<String, String> m = new HashMap<String, String>();
|
||||
Map<String, String> m = new HashMap<>();
|
||||
m.put("forname", "Tony");
|
||||
m.put("surname", "Blair");
|
||||
m.put("age", "50");
|
||||
|
||||
@@ -1,11 +1,11 @@
|
||||
/*
|
||||
* Copyright 2002-2014 the original author or authors.
|
||||
* Copyright 2002-2016 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.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
@@ -56,7 +56,7 @@ public class HttpMessageConverterExtractorTests {
|
||||
@Test
|
||||
public void noContent() throws IOException {
|
||||
HttpMessageConverter<?> converter = mock(HttpMessageConverter.class);
|
||||
extractor = new HttpMessageConverterExtractor<String>(String.class, createConverterList(converter));
|
||||
extractor = new HttpMessageConverterExtractor<>(String.class, createConverterList(converter));
|
||||
given(response.getStatusCode()).willReturn(HttpStatus.NO_CONTENT);
|
||||
|
||||
Object result = extractor.extractData(response);
|
||||
@@ -67,7 +67,7 @@ public class HttpMessageConverterExtractorTests {
|
||||
@Test
|
||||
public void notModified() throws IOException {
|
||||
HttpMessageConverter<?> converter = mock(HttpMessageConverter.class);
|
||||
extractor = new HttpMessageConverterExtractor<String>(String.class, createConverterList(converter));
|
||||
extractor = new HttpMessageConverterExtractor<>(String.class, createConverterList(converter));
|
||||
given(response.getStatusCode()).willReturn(HttpStatus.NOT_MODIFIED);
|
||||
|
||||
Object result = extractor.extractData(response);
|
||||
@@ -78,7 +78,7 @@ public class HttpMessageConverterExtractorTests {
|
||||
@Test
|
||||
public void informational() throws IOException {
|
||||
HttpMessageConverter<?> converter = mock(HttpMessageConverter.class);
|
||||
extractor = new HttpMessageConverterExtractor<String>(String.class, createConverterList(converter));
|
||||
extractor = new HttpMessageConverterExtractor<>(String.class, createConverterList(converter));
|
||||
given(response.getStatusCode()).willReturn(HttpStatus.CONTINUE);
|
||||
|
||||
Object result = extractor.extractData(response);
|
||||
@@ -91,7 +91,7 @@ public class HttpMessageConverterExtractorTests {
|
||||
HttpMessageConverter<?> converter = mock(HttpMessageConverter.class);
|
||||
HttpHeaders responseHeaders = new HttpHeaders();
|
||||
responseHeaders.setContentLength(0);
|
||||
extractor = new HttpMessageConverterExtractor<String>(String.class, createConverterList(converter));
|
||||
extractor = new HttpMessageConverterExtractor<>(String.class, createConverterList(converter));
|
||||
given(response.getStatusCode()).willReturn(HttpStatus.OK);
|
||||
given(response.getHeaders()).willReturn(responseHeaders);
|
||||
|
||||
@@ -104,10 +104,10 @@ public class HttpMessageConverterExtractorTests {
|
||||
@SuppressWarnings("unchecked")
|
||||
public void emptyMessageBody() throws IOException {
|
||||
HttpMessageConverter<String> converter = mock(HttpMessageConverter.class);
|
||||
List<HttpMessageConverter<?>> converters = new ArrayList<HttpMessageConverter<?>>();
|
||||
List<HttpMessageConverter<?>> converters = new ArrayList<>();
|
||||
converters.add(converter);
|
||||
HttpHeaders responseHeaders = new HttpHeaders();
|
||||
extractor = new HttpMessageConverterExtractor<String>(String.class, createConverterList(converter));
|
||||
extractor = new HttpMessageConverterExtractor<>(String.class, createConverterList(converter));
|
||||
given(response.getStatusCode()).willReturn(HttpStatus.OK);
|
||||
given(response.getHeaders()).willReturn(responseHeaders);
|
||||
given(response.getBody()).willReturn(new ByteArrayInputStream("".getBytes()));
|
||||
@@ -120,13 +120,13 @@ public class HttpMessageConverterExtractorTests {
|
||||
@SuppressWarnings("unchecked")
|
||||
public void normal() throws IOException {
|
||||
HttpMessageConverter<String> converter = mock(HttpMessageConverter.class);
|
||||
List<HttpMessageConverter<?>> converters = new ArrayList<HttpMessageConverter<?>>();
|
||||
List<HttpMessageConverter<?>> converters = new ArrayList<>();
|
||||
converters.add(converter);
|
||||
HttpHeaders responseHeaders = new HttpHeaders();
|
||||
MediaType contentType = MediaType.TEXT_PLAIN;
|
||||
responseHeaders.setContentType(contentType);
|
||||
String expected = "Foo";
|
||||
extractor = new HttpMessageConverterExtractor<String>(String.class, converters);
|
||||
extractor = new HttpMessageConverterExtractor<>(String.class, converters);
|
||||
given(response.getStatusCode()).willReturn(HttpStatus.OK);
|
||||
given(response.getHeaders()).willReturn(responseHeaders);
|
||||
given(response.getBody()).willReturn(new ByteArrayInputStream(expected.getBytes()));
|
||||
@@ -142,12 +142,12 @@ public class HttpMessageConverterExtractorTests {
|
||||
@SuppressWarnings("unchecked")
|
||||
public void cannotRead() throws IOException {
|
||||
HttpMessageConverter<String> converter = mock(HttpMessageConverter.class);
|
||||
List<HttpMessageConverter<?>> converters = new ArrayList<HttpMessageConverter<?>>();
|
||||
List<HttpMessageConverter<?>> converters = new ArrayList<>();
|
||||
converters.add(converter);
|
||||
HttpHeaders responseHeaders = new HttpHeaders();
|
||||
MediaType contentType = MediaType.TEXT_PLAIN;
|
||||
responseHeaders.setContentType(contentType);
|
||||
extractor = new HttpMessageConverterExtractor<String>(String.class, converters);
|
||||
extractor = new HttpMessageConverterExtractor<>(String.class, converters);
|
||||
given(response.getStatusCode()).willReturn(HttpStatus.OK);
|
||||
given(response.getHeaders()).willReturn(responseHeaders);
|
||||
given(response.getBody()).willReturn(new ByteArrayInputStream("Foobar".getBytes()));
|
||||
@@ -181,7 +181,7 @@ public class HttpMessageConverterExtractorTests {
|
||||
|
||||
private List<HttpMessageConverter<?>> createConverterList(
|
||||
HttpMessageConverter<?> converter) {
|
||||
List<HttpMessageConverter<?>> converters = new ArrayList<HttpMessageConverter<?>>(1);
|
||||
List<HttpMessageConverter<?>> converters = new ArrayList<>(1);
|
||||
converters.add(converter);
|
||||
return converters;
|
||||
}
|
||||
|
||||
@@ -113,7 +113,7 @@ public class RestTemplateIntegrationTests extends AbstractJettyServerTestCase {
|
||||
public void postForLocationEntity() throws URISyntaxException {
|
||||
HttpHeaders entityHeaders = new HttpHeaders();
|
||||
entityHeaders.setContentType(new MediaType("text", "plain", Charset.forName("ISO-8859-15")));
|
||||
HttpEntity<String> entity = new HttpEntity<String>(helloWorld, entityHeaders);
|
||||
HttpEntity<String> entity = new HttpEntity<>(helloWorld, entityHeaders);
|
||||
URI location = template.postForLocation(baseUrl + "/{method}", entity, "post");
|
||||
assertEquals("Invalid location", new URI(baseUrl + "/post/1"), location);
|
||||
}
|
||||
@@ -171,7 +171,7 @@ public class RestTemplateIntegrationTests extends AbstractJettyServerTestCase {
|
||||
|
||||
@Test
|
||||
public void multipart() throws UnsupportedEncodingException {
|
||||
MultiValueMap<String, Object> parts = new LinkedMultiValueMap<String, Object>();
|
||||
MultiValueMap<String, Object> parts = new LinkedMultiValueMap<>();
|
||||
parts.add("name 1", "value 1");
|
||||
parts.add("name 2", "value 2+1");
|
||||
parts.add("name 2", "value 2+2");
|
||||
@@ -183,7 +183,7 @@ public class RestTemplateIntegrationTests extends AbstractJettyServerTestCase {
|
||||
|
||||
@Test
|
||||
public void form() throws UnsupportedEncodingException {
|
||||
MultiValueMap<String, String> form = new LinkedMultiValueMap<String, String>();
|
||||
MultiValueMap<String, String> form = new LinkedMultiValueMap<>();
|
||||
form.add("name 1", "value 1");
|
||||
form.add("name 2", "value 2+1");
|
||||
form.add("name 2", "value 2+2");
|
||||
@@ -195,7 +195,7 @@ public class RestTemplateIntegrationTests extends AbstractJettyServerTestCase {
|
||||
public void exchangeGet() throws Exception {
|
||||
HttpHeaders requestHeaders = new HttpHeaders();
|
||||
requestHeaders.set("MyHeader", "MyValue");
|
||||
HttpEntity<String> requestEntity = new HttpEntity<String>(requestHeaders);
|
||||
HttpEntity<String> requestEntity = new HttpEntity<>(requestHeaders);
|
||||
ResponseEntity<String> response =
|
||||
template.exchange(baseUrl + "/{method}", HttpMethod.GET, requestEntity, String.class, "get");
|
||||
assertEquals("Invalid content", helloWorld, response.getBody());
|
||||
@@ -206,7 +206,7 @@ public class RestTemplateIntegrationTests extends AbstractJettyServerTestCase {
|
||||
HttpHeaders requestHeaders = new HttpHeaders();
|
||||
requestHeaders.set("MyHeader", "MyValue");
|
||||
requestHeaders.setContentType(MediaType.TEXT_PLAIN);
|
||||
HttpEntity<String> requestEntity = new HttpEntity<String>(helloWorld, requestHeaders);
|
||||
HttpEntity<String> requestEntity = new HttpEntity<>(helloWorld, requestHeaders);
|
||||
HttpEntity<Void> result = template.exchange(baseUrl + "/{method}", HttpMethod.POST, requestEntity, Void.class, "post");
|
||||
assertEquals("Invalid location", new URI(baseUrl + "/post/1"), result.getHeaders().getLocation());
|
||||
assertFalse(result.hasBody());
|
||||
@@ -220,7 +220,7 @@ public class RestTemplateIntegrationTests extends AbstractJettyServerTestCase {
|
||||
bean.setWith1("with");
|
||||
bean.setWith2("with");
|
||||
bean.setWithout("without");
|
||||
HttpEntity<MySampleBean> entity = new HttpEntity<MySampleBean>(bean, entityHeaders);
|
||||
HttpEntity<MySampleBean> entity = new HttpEntity<>(bean, entityHeaders);
|
||||
String s = template.postForObject(baseUrl + "/jsonpost", entity, String.class);
|
||||
assertTrue(s.contains("\"with1\":\"with\""));
|
||||
assertTrue(s.contains("\"with2\":\"with\""));
|
||||
@@ -234,7 +234,7 @@ public class RestTemplateIntegrationTests extends AbstractJettyServerTestCase {
|
||||
MySampleBean bean = new MySampleBean("with", "with", "without");
|
||||
MappingJacksonValue jacksonValue = new MappingJacksonValue(bean);
|
||||
jacksonValue.setSerializationView(MyJacksonView1.class);
|
||||
HttpEntity<MappingJacksonValue> entity = new HttpEntity<MappingJacksonValue>(jacksonValue, entityHeaders);
|
||||
HttpEntity<MappingJacksonValue> entity = new HttpEntity<>(jacksonValue, entityHeaders);
|
||||
String s = template.postForObject(baseUrl + "/jsonpost", entity, String.class);
|
||||
assertTrue(s.contains("\"with1\":\"with\""));
|
||||
assertFalse(s.contains("\"with2\":\"with\""));
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2002-2013 the original author or authors.
|
||||
* Copyright 2002-2016 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.
|
||||
@@ -34,7 +34,7 @@ public class DeferredResultTests {
|
||||
public void setResult() {
|
||||
DeferredResultHandler handler = mock(DeferredResultHandler.class);
|
||||
|
||||
DeferredResult<String> result = new DeferredResult<String>();
|
||||
DeferredResult<String> result = new DeferredResult<>();
|
||||
result.setResultHandler(handler);
|
||||
|
||||
assertTrue(result.setResult("hello"));
|
||||
@@ -45,7 +45,7 @@ public class DeferredResultTests {
|
||||
public void setResultTwice() {
|
||||
DeferredResultHandler handler = mock(DeferredResultHandler.class);
|
||||
|
||||
DeferredResult<String> result = new DeferredResult<String>();
|
||||
DeferredResult<String> result = new DeferredResult<>();
|
||||
result.setResultHandler(handler);
|
||||
|
||||
assertTrue(result.setResult("hello"));
|
||||
@@ -58,7 +58,7 @@ public class DeferredResultTests {
|
||||
public void isSetOrExpired() {
|
||||
DeferredResultHandler handler = mock(DeferredResultHandler.class);
|
||||
|
||||
DeferredResult<String> result = new DeferredResult<String>();
|
||||
DeferredResult<String> result = new DeferredResult<>();
|
||||
result.setResultHandler(handler);
|
||||
|
||||
assertFalse(result.isSetOrExpired());
|
||||
@@ -74,7 +74,7 @@ public class DeferredResultTests {
|
||||
public void hasResult() {
|
||||
DeferredResultHandler handler = mock(DeferredResultHandler.class);
|
||||
|
||||
DeferredResult<String> result = new DeferredResult<String>();
|
||||
DeferredResult<String> result = new DeferredResult<>();
|
||||
result.setResultHandler(handler);
|
||||
|
||||
assertFalse(result.hasResult());
|
||||
@@ -89,7 +89,7 @@ public class DeferredResultTests {
|
||||
public void onCompletion() throws Exception {
|
||||
final StringBuilder sb = new StringBuilder();
|
||||
|
||||
DeferredResult<String> result = new DeferredResult<String>();
|
||||
DeferredResult<String> result = new DeferredResult<>();
|
||||
result.onCompletion(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
@@ -109,7 +109,7 @@ public class DeferredResultTests {
|
||||
|
||||
DeferredResultHandler handler = mock(DeferredResultHandler.class);
|
||||
|
||||
DeferredResult<String> result = new DeferredResult<String>(null, "timeout result");
|
||||
DeferredResult<String> result = new DeferredResult<>(null, "timeout result");
|
||||
result.setResultHandler(handler);
|
||||
result.onTimeout(new Runnable() {
|
||||
@Override
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2002-2013 the original author or authors.
|
||||
* Copyright 2002-2016 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.
|
||||
@@ -233,7 +233,7 @@ public class WebAsyncManagerTests {
|
||||
given(this.asyncWebRequest.getNativeRequest(HttpServletRequest.class)).willReturn(this.servletRequest);
|
||||
|
||||
@SuppressWarnings("unchecked")
|
||||
WebAsyncTask<Object> asyncTask = new WebAsyncTask<Object>(1000L, executor, mock(Callable.class));
|
||||
WebAsyncTask<Object> asyncTask = new WebAsyncTask<>(1000L, executor, mock(Callable.class));
|
||||
this.asyncManager.startCallableProcessing(asyncTask);
|
||||
|
||||
verify(executor).submit((Runnable) notNull());
|
||||
@@ -256,7 +256,7 @@ public class WebAsyncManagerTests {
|
||||
|
||||
@Test
|
||||
public void startDeferredResultProcessing() throws Exception {
|
||||
DeferredResult<String> deferredResult = new DeferredResult<String>(1000L);
|
||||
DeferredResult<String> deferredResult = new DeferredResult<>(1000L);
|
||||
String concurrentResult = "abc";
|
||||
|
||||
DeferredResultProcessingInterceptor interceptor = mock(DeferredResultProcessingInterceptor.class);
|
||||
@@ -278,7 +278,7 @@ public class WebAsyncManagerTests {
|
||||
|
||||
@Test
|
||||
public void startDeferredResultProcessingBeforeConcurrentHandlingException() throws Exception {
|
||||
DeferredResult<Integer> deferredResult = new DeferredResult<Integer>();
|
||||
DeferredResult<Integer> deferredResult = new DeferredResult<>();
|
||||
Exception exception = new Exception();
|
||||
|
||||
DeferredResultProcessingInterceptor interceptor = mock(DeferredResultProcessingInterceptor.class);
|
||||
@@ -303,7 +303,7 @@ public class WebAsyncManagerTests {
|
||||
@Test
|
||||
public void startDeferredResultProcessingPreProcessException() throws Exception {
|
||||
|
||||
DeferredResult<Integer> deferredResult = new DeferredResult<Integer>();
|
||||
DeferredResult<Integer> deferredResult = new DeferredResult<>();
|
||||
Exception exception = new Exception();
|
||||
|
||||
DeferredResultProcessingInterceptor interceptor = mock(DeferredResultProcessingInterceptor.class);
|
||||
@@ -323,7 +323,7 @@ public class WebAsyncManagerTests {
|
||||
|
||||
@Test
|
||||
public void startDeferredResultProcessingPostProcessException() throws Exception {
|
||||
DeferredResult<Integer> deferredResult = new DeferredResult<Integer>();
|
||||
DeferredResult<Integer> deferredResult = new DeferredResult<>();
|
||||
Exception exception = new Exception();
|
||||
|
||||
DeferredResultProcessingInterceptor interceptor = mock(DeferredResultProcessingInterceptor.class);
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2002-2013 the original author or authors.
|
||||
* Copyright 2002-2016 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.
|
||||
@@ -91,7 +91,7 @@ public class WebAsyncManagerTimeoutTests {
|
||||
public void startCallableProcessingTimeoutAndResumeThroughCallback() throws Exception {
|
||||
|
||||
StubCallable callable = new StubCallable();
|
||||
WebAsyncTask<Object> webAsyncTask = new WebAsyncTask<Object>(callable);
|
||||
WebAsyncTask<Object> webAsyncTask = new WebAsyncTask<>(callable);
|
||||
webAsyncTask.onTimeout(new Callable<Object>() {
|
||||
@Override
|
||||
public Object call() throws Exception {
|
||||
@@ -152,7 +152,7 @@ public class WebAsyncManagerTimeoutTests {
|
||||
@Test
|
||||
public void startDeferredResultProcessingTimeoutAndComplete() throws Exception {
|
||||
|
||||
DeferredResult<Integer> deferredResult = new DeferredResult<Integer>();
|
||||
DeferredResult<Integer> deferredResult = new DeferredResult<>();
|
||||
|
||||
DeferredResultProcessingInterceptor interceptor = mock(DeferredResultProcessingInterceptor.class);
|
||||
given(interceptor.handleTimeout(this.asyncWebRequest, deferredResult)).willReturn(true);
|
||||
@@ -175,7 +175,7 @@ public class WebAsyncManagerTimeoutTests {
|
||||
@Test
|
||||
public void startDeferredResultProcessingTimeoutAndResumeWithDefaultResult() throws Exception {
|
||||
|
||||
DeferredResult<Integer> deferredResult = new DeferredResult<Integer>(null, 23);
|
||||
DeferredResult<Integer> deferredResult = new DeferredResult<>(null, 23);
|
||||
this.asyncManager.startDeferredResultProcessing(deferredResult);
|
||||
|
||||
AsyncEvent event = null;
|
||||
@@ -189,7 +189,7 @@ public class WebAsyncManagerTimeoutTests {
|
||||
@Test
|
||||
public void startDeferredResultProcessingTimeoutAndResumeThroughCallback() throws Exception {
|
||||
|
||||
final DeferredResult<Integer> deferredResult = new DeferredResult<Integer>();
|
||||
final DeferredResult<Integer> deferredResult = new DeferredResult<>();
|
||||
deferredResult.onTimeout(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
@@ -210,7 +210,7 @@ public class WebAsyncManagerTimeoutTests {
|
||||
@Test
|
||||
public void startDeferredResultProcessingTimeoutAndResumeThroughInterceptor() throws Exception {
|
||||
|
||||
DeferredResult<Integer> deferredResult = new DeferredResult<Integer>();
|
||||
DeferredResult<Integer> deferredResult = new DeferredResult<>();
|
||||
|
||||
DeferredResultProcessingInterceptor interceptor = new DeferredResultProcessingInterceptorAdapter() {
|
||||
@Override
|
||||
@@ -234,7 +234,7 @@ public class WebAsyncManagerTimeoutTests {
|
||||
@Test
|
||||
public void startDeferredResultProcessingAfterTimeoutException() throws Exception {
|
||||
|
||||
DeferredResult<Integer> deferredResult = new DeferredResult<Integer>();
|
||||
DeferredResult<Integer> deferredResult = new DeferredResult<>();
|
||||
final Exception exception = new Exception();
|
||||
|
||||
DeferredResultProcessingInterceptor interceptor = new DeferredResultProcessingInterceptorAdapter() {
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2002-2015 the original author or authors.
|
||||
* Copyright 2002-2016 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.
|
||||
@@ -120,7 +120,7 @@ public class ModelFactoryOrderingTests {
|
||||
|
||||
Class<?> type = controller.getClass();
|
||||
Set<Method> methods = MethodIntrospector.selectMethods(type, METHOD_FILTER);
|
||||
List<InvocableHandlerMethod> modelMethods = new ArrayList<InvocableHandlerMethod>();
|
||||
List<InvocableHandlerMethod> modelMethods = new ArrayList<>();
|
||||
for (Method method : methods) {
|
||||
InvocableHandlerMethod modelMethod = new InvocableHandlerMethod(controller, method);
|
||||
modelMethod.setHandlerMethodArgumentResolvers(resolvers);
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2002-2015 the original author or authors.
|
||||
* Copyright 2002-2016 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.
|
||||
@@ -104,7 +104,7 @@ public class RequestHeaderMapMethodArgumentResolverTests {
|
||||
request.addHeader(name, value1);
|
||||
request.addHeader(name, value2);
|
||||
|
||||
MultiValueMap<String, String> expected = new LinkedMultiValueMap<String, String>(1);
|
||||
MultiValueMap<String, String> expected = new LinkedMultiValueMap<>(1);
|
||||
expected.add(name, value1);
|
||||
expected.add(name, value2);
|
||||
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2002-2015 the original author or authors.
|
||||
* Copyright 2002-2016 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.
|
||||
@@ -101,7 +101,7 @@ public class RequestParamMapMethodArgumentResolverTests {
|
||||
String value2 = "baz";
|
||||
request.addParameter(name, new String[]{value1, value2});
|
||||
|
||||
MultiValueMap<String, String> expected = new LinkedMultiValueMap<String, String>(1);
|
||||
MultiValueMap<String, String> expected = new LinkedMultiValueMap<>(1);
|
||||
expected.add(name, value1);
|
||||
expected.add(name, value2);
|
||||
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2002-2015 the original author or authors.
|
||||
* Copyright 2002-2016 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.
|
||||
@@ -64,14 +64,14 @@ public class SessionAttributesHandlerTests {
|
||||
sessionAttributeStore.storeAttribute(request, "attr4", new TestBean());
|
||||
|
||||
assertEquals("Named attributes (attr1, attr2) should be 'known' right away",
|
||||
new HashSet<String>(asList("attr1", "attr2")),
|
||||
new HashSet<>(asList("attr1", "attr2")),
|
||||
sessionAttributesHandler.retrieveAttributes(request).keySet());
|
||||
|
||||
// Resolve 'attr3' by type
|
||||
sessionAttributesHandler.isHandlerSessionAttribute("attr3", TestBean.class);
|
||||
|
||||
assertEquals("Named attributes (attr1, attr2) and resolved attribute (att3) should be 'known'",
|
||||
new HashSet<String>(asList("attr1", "attr2", "attr3")),
|
||||
new HashSet<>(asList("attr1", "attr2", "attr3")),
|
||||
sessionAttributesHandler.retrieveAttributes(request).keySet());
|
||||
}
|
||||
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2002-2015 the original author or authors.
|
||||
* Copyright 2002-2016 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.
|
||||
@@ -43,7 +43,7 @@ public class CompositeUriComponentsContributorTests {
|
||||
@Test
|
||||
public void supportsParameter() {
|
||||
|
||||
List<HandlerMethodArgumentResolver> resolvers = new ArrayList<HandlerMethodArgumentResolver>();
|
||||
List<HandlerMethodArgumentResolver> resolvers = new ArrayList<>();
|
||||
resolvers.add(new RequestParamMethodArgumentResolver(false));
|
||||
resolvers.add(new RequestHeaderMethodArgumentResolver(null));
|
||||
resolvers.add(new RequestParamMethodArgumentResolver(true));
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2002-2012 the original author or authors.
|
||||
* Copyright 2002-2016 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.
|
||||
@@ -35,7 +35,7 @@ public class StubArgumentResolver implements HandlerMethodArgumentResolver {
|
||||
|
||||
private final Object stubValue;
|
||||
|
||||
private List<MethodParameter> resolvedParameters = new ArrayList<MethodParameter>();
|
||||
private List<MethodParameter> resolvedParameters = new ArrayList<>();
|
||||
|
||||
public StubArgumentResolver(Class<?> supportedParameterType, Object stubValue) {
|
||||
this.parameterType = supportedParameterType;
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2002-2015 the original author or authors.
|
||||
* Copyright 2002-2016 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.
|
||||
@@ -116,7 +116,7 @@ public class CommonsMultipartResolverTests {
|
||||
}
|
||||
|
||||
private void doTestParameters(MultipartHttpServletRequest request) {
|
||||
Set<String> parameterNames = new HashSet<String>();
|
||||
Set<String> parameterNames = new HashSet<>();
|
||||
Enumeration<String> parameterEnum = request.getParameterNames();
|
||||
while (parameterEnum.hasMoreElements()) {
|
||||
parameterNames.add(parameterEnum.nextElement());
|
||||
@@ -137,8 +137,8 @@ public class CommonsMultipartResolverTests {
|
||||
assertEquals("value4", request.getParameter("field4"));
|
||||
assertEquals("getValue", request.getParameter("getField"));
|
||||
|
||||
List<String> parameterMapKeys = new ArrayList<String>();
|
||||
List<Object> parameterMapValues = new ArrayList<Object>();
|
||||
List<String> parameterMapKeys = new ArrayList<>();
|
||||
List<Object> parameterMapValues = new ArrayList<>();
|
||||
for (Object o : request.getParameterMap().keySet()) {
|
||||
String key = (String) o;
|
||||
parameterMapKeys.add(key);
|
||||
@@ -165,7 +165,7 @@ public class CommonsMultipartResolverTests {
|
||||
}
|
||||
|
||||
private void doTestFiles(MultipartHttpServletRequest request) throws IOException {
|
||||
Set<String> fileNames = new HashSet<String>();
|
||||
Set<String> fileNames = new HashSet<>();
|
||||
Iterator<String> fileIter = request.getFileNames();
|
||||
while (fileIter.hasNext()) {
|
||||
fileNames.add(fileIter.next());
|
||||
@@ -284,7 +284,7 @@ public class CommonsMultipartResolverTests {
|
||||
final MultipartFilter filter = new MultipartFilter();
|
||||
filter.init(filterConfig);
|
||||
|
||||
final List<MultipartFile> files = new ArrayList<MultipartFile>();
|
||||
final List<MultipartFile> files = new ArrayList<>();
|
||||
final FilterChain filterChain = new FilterChain() {
|
||||
@Override
|
||||
public void doFilter(ServletRequest servletRequest, ServletResponse servletResponse) {
|
||||
@@ -322,7 +322,7 @@ public class CommonsMultipartResolverTests {
|
||||
MockFilterConfig filterConfig = new MockFilterConfig(wac.getServletContext(), "filter");
|
||||
filterConfig.addInitParameter("multipartResolverBeanName", "myMultipartResolver");
|
||||
|
||||
final List<MultipartFile> files = new ArrayList<MultipartFile>();
|
||||
final List<MultipartFile> files = new ArrayList<>();
|
||||
FilterChain filterChain = new FilterChain() {
|
||||
@Override
|
||||
public void doFilter(ServletRequest originalRequest, ServletResponse response) {
|
||||
@@ -377,7 +377,7 @@ public class CommonsMultipartResolverTests {
|
||||
if (request instanceof MultipartHttpServletRequest) {
|
||||
throw new IllegalStateException("Already a multipart request");
|
||||
}
|
||||
List<FileItem> fileItems = new ArrayList<FileItem>();
|
||||
List<FileItem> fileItems = new ArrayList<>();
|
||||
MockFileItem fileItem1 = new MockFileItem(
|
||||
"field1", "type1", empty ? "" : "field1.txt", empty ? "" : "text1");
|
||||
MockFileItem fileItem1x = new MockFileItem(
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2002-2014 the original author or authors.
|
||||
* Copyright 2002-2016 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.
|
||||
@@ -92,7 +92,7 @@ public class HtmlCharacterEntityReferencesTests {
|
||||
|
||||
private Map<Integer, String> getReferenceCharacterMap() {
|
||||
CharacterEntityResourceIterator entityIterator = new CharacterEntityResourceIterator();
|
||||
Map<Integer, String> referencedCharactersMap = new HashMap<Integer, String>();
|
||||
Map<Integer, String> referencedCharactersMap = new HashMap<>();
|
||||
while (entityIterator.hasNext()) {
|
||||
int character = entityIterator.getReferredCharacter();
|
||||
String entityName = entityIterator.nextEntry();
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2002-2015 the original author or authors.
|
||||
* Copyright 2002-2016 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.
|
||||
@@ -157,7 +157,7 @@ public class UriComponentsBuilderTests {
|
||||
assertEquals(80, result.getPort());
|
||||
assertEquals("/javase/6/docs/api/java/util/BitSet.html", result.getPath());
|
||||
assertEquals("foo=bar", result.getQuery());
|
||||
MultiValueMap<String, String> expectedQueryParams = new LinkedMultiValueMap<String, String>(1);
|
||||
MultiValueMap<String, String> expectedQueryParams = new LinkedMultiValueMap<>(1);
|
||||
expectedQueryParams.add("foo", "bar");
|
||||
assertEquals(expectedQueryParams, result.getQueryParams());
|
||||
assertEquals("and(java.util.BitSet)", result.getFragment());
|
||||
@@ -550,7 +550,7 @@ public class UriComponentsBuilderTests {
|
||||
UriComponents result = builder.queryParam("baz", "qux", 42).build();
|
||||
|
||||
assertEquals("baz=qux&baz=42", result.getQuery());
|
||||
MultiValueMap<String, String> expectedQueryParams = new LinkedMultiValueMap<String, String>(2);
|
||||
MultiValueMap<String, String> expectedQueryParams = new LinkedMultiValueMap<>(2);
|
||||
expectedQueryParams.add("baz", "qux");
|
||||
expectedQueryParams.add("baz", "42");
|
||||
assertEquals(expectedQueryParams, result.getQueryParams());
|
||||
@@ -562,7 +562,7 @@ public class UriComponentsBuilderTests {
|
||||
UriComponents result = builder.queryParam("baz").build();
|
||||
|
||||
assertEquals("baz", result.getQuery());
|
||||
MultiValueMap<String, String> expectedQueryParams = new LinkedMultiValueMap<String, String>(2);
|
||||
MultiValueMap<String, String> expectedQueryParams = new LinkedMultiValueMap<>(2);
|
||||
expectedQueryParams.add("baz", null);
|
||||
assertEquals(expectedQueryParams, result.getQueryParams());
|
||||
}
|
||||
@@ -587,7 +587,7 @@ public class UriComponentsBuilderTests {
|
||||
UriComponents result = UriComponentsBuilder.fromPath("/{foo}").buildAndExpand("fooValue");
|
||||
assertEquals("/fooValue", result.toUriString());
|
||||
|
||||
Map<String, String> values = new HashMap<String, String>();
|
||||
Map<String, String> values = new HashMap<>();
|
||||
values.put("foo", "fooValue");
|
||||
values.put("bar", "barValue");
|
||||
result = UriComponentsBuilder.fromPath("/{foo}/{bar}").buildAndExpand(values);
|
||||
@@ -599,7 +599,7 @@ public class UriComponentsBuilderTests {
|
||||
UriComponents result = UriComponentsBuilder.fromUriString("mailto:{user}@{domain}").buildAndExpand("foo", "example.com");
|
||||
assertEquals("mailto:foo@example.com", result.toUriString());
|
||||
|
||||
Map<String, String> values = new HashMap<String, String>();
|
||||
Map<String, String> values = new HashMap<>();
|
||||
values.put("user", "foo");
|
||||
values.put("domain", "example.com");
|
||||
UriComponentsBuilder.fromUriString("mailto:{user}@{domain}").buildAndExpand(values);
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2002-2015 the original author or authors.
|
||||
* Copyright 2002-2016 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,7 +42,7 @@ public class WebUtilsTests {
|
||||
|
||||
@Test
|
||||
public void findParameterValue() {
|
||||
Map<String, Object> params = new HashMap<String, Object>();
|
||||
Map<String, Object> params = new HashMap<>();
|
||||
params.put("myKey1", "myValue1");
|
||||
params.put("myKey2_myValue2", "xxx");
|
||||
params.put("myKey3_myValue3.x", "xxx");
|
||||
|
||||
Reference in New Issue
Block a user