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.
|
||||
@@ -157,7 +157,7 @@ public class MockHttpServletRequestTests {
|
||||
public void setMultipleParameters() {
|
||||
request.setParameter("key1", "value1");
|
||||
request.setParameter("key2", "value2");
|
||||
Map<String, Object> params = new HashMap<String, Object>(2);
|
||||
Map<String, Object> params = new HashMap<>(2);
|
||||
params.put("key1", "newValue1");
|
||||
params.put("key3", new String[] { "value3A", "value3B" });
|
||||
request.setParameters(params);
|
||||
@@ -175,7 +175,7 @@ public class MockHttpServletRequestTests {
|
||||
public void addMultipleParameters() {
|
||||
request.setParameter("key1", "value1");
|
||||
request.setParameter("key2", "value2");
|
||||
Map<String, Object> params = new HashMap<String, Object>(2);
|
||||
Map<String, Object> params = new HashMap<>(2);
|
||||
params.put("key1", "newValue1");
|
||||
params.put("key3", new String[] { "value3A", "value3B" });
|
||||
request.addParameters(params);
|
||||
@@ -193,7 +193,7 @@ public class MockHttpServletRequestTests {
|
||||
@Test
|
||||
public void removeAllParameters() {
|
||||
request.setParameter("key1", "value1");
|
||||
Map<String, Object> params = new HashMap<String, Object>(2);
|
||||
Map<String, Object> params = new HashMap<>(2);
|
||||
params.put("key2", "value2");
|
||||
params.put("key3", new String[] { "value3A", "value3B" });
|
||||
request.addParameters(params);
|
||||
@@ -245,7 +245,7 @@ public class MockHttpServletRequestTests {
|
||||
|
||||
@Test(expected = IllegalArgumentException.class)
|
||||
public void setPreferredLocalesWithEmptyList() {
|
||||
request.setPreferredLocales(new ArrayList<Locale>());
|
||||
request.setPreferredLocales(new ArrayList<>());
|
||||
}
|
||||
|
||||
@Test
|
||||
|
||||
@@ -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.
|
||||
@@ -62,7 +62,7 @@ public class MockMultipartHttpServletRequestTests {
|
||||
}
|
||||
|
||||
private void doTestMultipartHttpServletRequest(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());
|
||||
@@ -73,7 +73,7 @@ public class MockMultipartHttpServletRequestTests {
|
||||
MultipartFile file1 = request.getFile("file1");
|
||||
MultipartFile file2 = request.getFile("file2");
|
||||
Map<String, MultipartFile> fileMap = request.getFileMap();
|
||||
List<String> fileMapKeys = new LinkedList<String>(fileMap.keySet());
|
||||
List<String> fileMapKeys = new LinkedList<>(fileMap.keySet());
|
||||
assertEquals(2, fileMapKeys.size());
|
||||
assertEquals(file1, fileMap.get("file1"));
|
||||
assertEquals(file2, fileMap.get("file2"));
|
||||
|
||||
@@ -172,12 +172,12 @@ public class MergedContextConfigurationTests {
|
||||
@Test
|
||||
public void hashCodeWithSameInitializers() {
|
||||
Set<Class<? extends ApplicationContextInitializer<? extends ConfigurableApplicationContext>>> initializerClasses1 =
|
||||
new HashSet<Class<? extends ApplicationContextInitializer<? extends ConfigurableApplicationContext>>>();
|
||||
new HashSet<>();
|
||||
initializerClasses1.add(FooInitializer.class);
|
||||
initializerClasses1.add(BarInitializer.class);
|
||||
|
||||
Set<Class<? extends ApplicationContextInitializer<? extends ConfigurableApplicationContext>>> initializerClasses2 =
|
||||
new HashSet<Class<? extends ApplicationContextInitializer<? extends ConfigurableApplicationContext>>>();
|
||||
new HashSet<>();
|
||||
initializerClasses2.add(BarInitializer.class);
|
||||
initializerClasses2.add(FooInitializer.class);
|
||||
|
||||
@@ -191,11 +191,11 @@ public class MergedContextConfigurationTests {
|
||||
@Test
|
||||
public void hashCodeWithDifferentInitializers() {
|
||||
Set<Class<? extends ApplicationContextInitializer<? extends ConfigurableApplicationContext>>> initializerClasses1 =
|
||||
new HashSet<Class<? extends ApplicationContextInitializer<? extends ConfigurableApplicationContext>>>();
|
||||
new HashSet<>();
|
||||
initializerClasses1.add(FooInitializer.class);
|
||||
|
||||
Set<Class<? extends ApplicationContextInitializer<? extends ConfigurableApplicationContext>>> initializerClasses2 =
|
||||
new HashSet<Class<? extends ApplicationContextInitializer<? extends ConfigurableApplicationContext>>>();
|
||||
new HashSet<>();
|
||||
initializerClasses2.add(BarInitializer.class);
|
||||
|
||||
MergedContextConfiguration mergedConfig1 = new MergedContextConfiguration(getClass(),
|
||||
@@ -369,12 +369,12 @@ public class MergedContextConfigurationTests {
|
||||
@Test
|
||||
public void equalsWithSameInitializers() {
|
||||
Set<Class<? extends ApplicationContextInitializer<? extends ConfigurableApplicationContext>>> initializerClasses1 =
|
||||
new HashSet<Class<? extends ApplicationContextInitializer<? extends ConfigurableApplicationContext>>>();
|
||||
new HashSet<>();
|
||||
initializerClasses1.add(FooInitializer.class);
|
||||
initializerClasses1.add(BarInitializer.class);
|
||||
|
||||
Set<Class<? extends ApplicationContextInitializer<? extends ConfigurableApplicationContext>>> initializerClasses2 =
|
||||
new HashSet<Class<? extends ApplicationContextInitializer<? extends ConfigurableApplicationContext>>>();
|
||||
new HashSet<>();
|
||||
initializerClasses2.add(BarInitializer.class);
|
||||
initializerClasses2.add(FooInitializer.class);
|
||||
|
||||
@@ -388,11 +388,11 @@ public class MergedContextConfigurationTests {
|
||||
@Test
|
||||
public void equalsWithDifferentInitializers() {
|
||||
Set<Class<? extends ApplicationContextInitializer<? extends ConfigurableApplicationContext>>> initializerClasses1 =
|
||||
new HashSet<Class<? extends ApplicationContextInitializer<? extends ConfigurableApplicationContext>>>();
|
||||
new HashSet<>();
|
||||
initializerClasses1.add(FooInitializer.class);
|
||||
|
||||
Set<Class<? extends ApplicationContextInitializer<? extends ConfigurableApplicationContext>>> initializerClasses2 =
|
||||
new HashSet<Class<? extends ApplicationContextInitializer<? extends ConfigurableApplicationContext>>>();
|
||||
new HashSet<>();
|
||||
initializerClasses2.add(BarInitializer.class);
|
||||
|
||||
MergedContextConfiguration mergedConfig1 = new MergedContextConfiguration(getClass(),
|
||||
|
||||
@@ -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.
|
||||
@@ -48,8 +48,8 @@ public class TestContextManagerTests {
|
||||
private static final String SECOND = "vidi";
|
||||
private static final String THIRD = "vici";
|
||||
|
||||
private static final List<String> afterTestMethodCalls = new ArrayList<String>();
|
||||
private static final List<String> beforeTestMethodCalls = new ArrayList<String>();
|
||||
private static final List<String> afterTestMethodCalls = new ArrayList<>();
|
||||
private static final List<String> beforeTestMethodCalls = new ArrayList<>();
|
||||
|
||||
protected static final Log logger = LogFactory.getLog(TestContextManagerTests.class);
|
||||
|
||||
@@ -72,10 +72,10 @@ public class TestContextManagerTests {
|
||||
List<String> expectedAfterTestMethodCalls, final String usageContext) {
|
||||
|
||||
if (expectedBeforeTestMethodCalls == null) {
|
||||
expectedBeforeTestMethodCalls = new ArrayList<String>();
|
||||
expectedBeforeTestMethodCalls = new ArrayList<>();
|
||||
}
|
||||
if (expectedAfterTestMethodCalls == null) {
|
||||
expectedAfterTestMethodCalls = new ArrayList<String>();
|
||||
expectedAfterTestMethodCalls = new ArrayList<>();
|
||||
}
|
||||
|
||||
if (logger.isDebugEnabled()) {
|
||||
|
||||
@@ -50,7 +50,7 @@ public class ExpectedExceptionSpringRunnerTests {
|
||||
// Should Pass.
|
||||
@Test(expected = IndexOutOfBoundsException.class)
|
||||
public void verifyJUnitExpectedException() {
|
||||
new ArrayList<Object>().get(1);
|
||||
new ArrayList<>().get(1);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2002-2007 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.
|
||||
@@ -71,7 +71,7 @@ public class StandardJUnit4FeaturesTests {
|
||||
|
||||
@Test(expected = IndexOutOfBoundsException.class)
|
||||
public void expectingAnIndexOutOfBoundsException() {
|
||||
new ArrayList<Object>().get(1);
|
||||
new ArrayList<>().get(1);
|
||||
}
|
||||
|
||||
@Test
|
||||
|
||||
@@ -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.
|
||||
@@ -93,9 +93,9 @@ public class AnnotatedConfigClassesWithoutAtConfigurationTests {
|
||||
assertNotNull(enigma);
|
||||
assertNotNull(lifecycleBean);
|
||||
assertTrue(lifecycleBean.isInitialized());
|
||||
Set<String> names = new HashSet<String>();
|
||||
Set<String> names = new HashSet<>();
|
||||
names.add(enigma.toString());
|
||||
names.add(lifecycleBean.getName());
|
||||
assertEquals(names, new HashSet<String>(Arrays.asList("enigma #1", "enigma #2")));
|
||||
assertEquals(names, new HashSet<>(Arrays.asList("enigma #1", "enigma #2")));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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.
|
||||
@@ -378,7 +378,7 @@ public class ActiveProfilesUtilsTests extends AbstractContextConfigurationUtilsT
|
||||
|
||||
@Override
|
||||
public String[] resolve(Class<?> testClass) {
|
||||
List<String> profiles = new ArrayList<String>(Arrays.asList(super.resolve(testClass)));
|
||||
List<String> profiles = new ArrayList<>(Arrays.asList(super.resolve(testClass)));
|
||||
profiles.add("foo");
|
||||
return StringUtils.toStringArray(profiles);
|
||||
}
|
||||
|
||||
@@ -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.
|
||||
@@ -52,7 +52,7 @@ public class ContentRequestMatchersIntegrationTests {
|
||||
|
||||
@Before
|
||||
public void setup() {
|
||||
List<HttpMessageConverter<?>> converters = new ArrayList<HttpMessageConverter<?>>();
|
||||
List<HttpMessageConverter<?>> converters = new ArrayList<>();
|
||||
converters.add(new StringHttpMessageConverter());
|
||||
converters.add(new MappingJackson2HttpMessageConverter());
|
||||
|
||||
|
||||
@@ -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 @@ public class HeaderRequestMatchersIntegrationTests {
|
||||
|
||||
@Before
|
||||
public void setup() {
|
||||
List<HttpMessageConverter<?>> converters = new ArrayList<HttpMessageConverter<?>>();
|
||||
List<HttpMessageConverter<?>> converters = new ArrayList<>();
|
||||
converters.add(new StringHttpMessageConverter());
|
||||
converters.add(new MappingJackson2HttpMessageConverter());
|
||||
|
||||
|
||||
@@ -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,7 +45,7 @@ import static org.springframework.test.web.client.response.MockRestResponseCreat
|
||||
*/
|
||||
public class JsonPathRequestMatchersIntegrationTests {
|
||||
|
||||
private static final MultiValueMap<String, Person> people = new LinkedMultiValueMap<String, Person>();
|
||||
private static final MultiValueMap<String, Person> people = new LinkedMultiValueMap<>();
|
||||
|
||||
static {
|
||||
people.add("composers", new Person("Johann Sebastian Bach"));
|
||||
|
||||
@@ -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.
|
||||
@@ -75,7 +75,7 @@ public class XmlContentRequestMatchersIntegrationTests {
|
||||
|
||||
this.people = new PeopleWrapper(composers);
|
||||
|
||||
List<HttpMessageConverter<?>> converters = new ArrayList<HttpMessageConverter<?>>();
|
||||
List<HttpMessageConverter<?>> converters = new ArrayList<>();
|
||||
converters.add(new Jaxb2RootElementHttpMessageConverter());
|
||||
|
||||
this.restTemplate = new RestTemplate();
|
||||
|
||||
@@ -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.
|
||||
@@ -74,7 +74,7 @@ public class XpathRequestMatchersIntegrationTests {
|
||||
|
||||
this.people = new PeopleWrapper(composers, performers);
|
||||
|
||||
List<HttpMessageConverter<?>> converters = new ArrayList<HttpMessageConverter<?>>();
|
||||
List<HttpMessageConverter<?>> converters = new ArrayList<>();
|
||||
converters.add(new Jaxb2RootElementHttpMessageConverter());
|
||||
|
||||
this.restTemplate = new RestTemplate();
|
||||
|
||||
@@ -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.
|
||||
@@ -75,7 +75,7 @@ public class PrintingResultHandlerTests {
|
||||
HttpHeaders headers = new HttpHeaders();
|
||||
headers.set("header", "headerValue");
|
||||
|
||||
MultiValueMap<String, String> params = new LinkedMultiValueMap<String, String>();
|
||||
MultiValueMap<String, String> params = new LinkedMultiValueMap<>();
|
||||
params.add("param", "paramValue");
|
||||
|
||||
assertValue("MockHttpServletRequest", "HTTP Method", this.request.getMethod());
|
||||
@@ -243,12 +243,12 @@ public class PrintingResultHandlerTests {
|
||||
|
||||
private String printedHeading;
|
||||
|
||||
private Map<String, Map<String, Object>> printedValues = new HashMap<String, Map<String, Object>>();
|
||||
private Map<String, Map<String, Object>> printedValues = new HashMap<>();
|
||||
|
||||
@Override
|
||||
public void printHeading(String heading) {
|
||||
this.printedHeading = heading;
|
||||
this.printedValues.put(heading, new HashMap<String, Object>());
|
||||
this.printedValues.put(heading, new HashMap<>());
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -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.
|
||||
@@ -57,7 +57,7 @@ public class StatusResultMatchersTests {
|
||||
@Test
|
||||
public void testHttpStatusCodeResultMatchers() throws Exception {
|
||||
|
||||
List<AssertionError> failures = new ArrayList<AssertionError>();
|
||||
List<AssertionError> failures = new ArrayList<>();
|
||||
|
||||
for (HttpStatus status : HttpStatus.values()) {
|
||||
MockHttpServletResponse response = new MockHttpServletResponse();
|
||||
|
||||
@@ -173,10 +173,10 @@ public class AsyncTests {
|
||||
private static class AsyncController {
|
||||
|
||||
private final Collection<DeferredResult<Person>> deferredResults =
|
||||
new CopyOnWriteArrayList<DeferredResult<Person>>();
|
||||
new CopyOnWriteArrayList<>();
|
||||
|
||||
private final Collection<ListenableFutureTask<Person>> futureTasks =
|
||||
new CopyOnWriteArrayList<ListenableFutureTask<Person>>();
|
||||
new CopyOnWriteArrayList<>();
|
||||
|
||||
|
||||
@RequestMapping(params = "callable")
|
||||
@@ -186,21 +186,21 @@ public class AsyncTests {
|
||||
|
||||
@RequestMapping(params = "deferredResult")
|
||||
public DeferredResult<Person> getDeferredResult() {
|
||||
DeferredResult<Person> deferredResult = new DeferredResult<Person>();
|
||||
DeferredResult<Person> deferredResult = new DeferredResult<>();
|
||||
this.deferredResults.add(deferredResult);
|
||||
return deferredResult;
|
||||
}
|
||||
|
||||
@RequestMapping(params = "deferredResultWithImmediateValue")
|
||||
public DeferredResult<Person> getDeferredResultWithImmediateValue() {
|
||||
DeferredResult<Person> deferredResult = new DeferredResult<Person>();
|
||||
DeferredResult<Person> deferredResult = new DeferredResult<>();
|
||||
deferredResult.setResult(new Person("Joe"));
|
||||
return deferredResult;
|
||||
}
|
||||
|
||||
@RequestMapping(params = "deferredResultWithDelayedError")
|
||||
public DeferredResult<Person> getDeferredResultWithDelayedError() {
|
||||
final DeferredResult<Person> deferredResult = new DeferredResult<Person>();
|
||||
final DeferredResult<Person> deferredResult = new DeferredResult<>();
|
||||
new Thread() {
|
||||
public void run() {
|
||||
try {
|
||||
@@ -217,14 +217,14 @@ public class AsyncTests {
|
||||
|
||||
@RequestMapping(params = "listenableFuture")
|
||||
public ListenableFuture<Person> getListenableFuture() {
|
||||
ListenableFutureTask<Person> futureTask = new ListenableFutureTask<Person>(() -> new Person("Joe"));
|
||||
ListenableFutureTask<Person> futureTask = new ListenableFutureTask<>(() -> new Person("Joe"));
|
||||
this.futureTasks.add(futureTask);
|
||||
return futureTask;
|
||||
}
|
||||
|
||||
@RequestMapping(params = "completableFutureWithImmediateValue")
|
||||
public CompletableFuture<Person> getCompletableFutureWithImmediateValue() {
|
||||
CompletableFuture<Person> future = new CompletableFuture<Person>();
|
||||
CompletableFuture<Person> future = new CompletableFuture<>();
|
||||
future.complete(new Person("Joe"));
|
||||
return future;
|
||||
}
|
||||
|
||||
@@ -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.
|
||||
@@ -89,7 +89,7 @@ public class ViewResolutionTests {
|
||||
Jaxb2Marshaller marshaller = new Jaxb2Marshaller();
|
||||
marshaller.setClassesToBeBound(Person.class);
|
||||
|
||||
List<View> viewList = new ArrayList<View>();
|
||||
List<View> viewList = new ArrayList<>();
|
||||
viewList.add(new MappingJackson2JsonView());
|
||||
viewList.add(new MarshallingView(marshaller));
|
||||
|
||||
|
||||
@@ -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.
|
||||
@@ -121,7 +121,7 @@ public class JsonPathAssertionTests {
|
||||
|
||||
@RequestMapping("/music/people")
|
||||
public MultiValueMap<String, Person> get() {
|
||||
MultiValueMap<String, Person> map = new LinkedMultiValueMap<String, Person>();
|
||||
MultiValueMap<String, Person> map = new LinkedMultiValueMap<>();
|
||||
|
||||
map.add("composers", new Person("Johann Sebastian Bach"));
|
||||
map.add("composers", new Person("Johannes Brahms"));
|
||||
|
||||
Reference in New Issue
Block a user