Cleanup and format code

This commit is contained in:
Phillip Webb
2017-03-06 16:44:31 -08:00
parent c7b46e4d1c
commit d8f827d224
649 changed files with 1922 additions and 2003 deletions

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2012-2016 the original author or authors.
* Copyright 2012-2017 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -57,7 +57,7 @@ public class CliTester implements TestRule {
private long timeout = TimeUnit.MINUTES.toMillis(6);
private final List<AbstractCommand> commands = new ArrayList<AbstractCommand>();
private final List<AbstractCommand> commands = new ArrayList<>();
private final String prefix;

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2012-2016 the original author or authors.
* Copyright 2012-2017 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -33,7 +33,7 @@ import static org.assertj.core.api.Assertions.assertThat;
*/
public class SpringApplicationLauncherTests {
private Map<String, String> env = new HashMap<String, String>();
private Map<String, String> env = new HashMap<>();
@After
public void cleanUp() {
@@ -100,7 +100,7 @@ public class SpringApplicationLauncherTests {
private static class TestClassLoader extends ClassLoader {
private Set<String> classes = new HashSet<String>();
private Set<String> classes = new HashSet<>();
TestClassLoader(ClassLoader parent) {
super(parent);

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2012-2016 the original author or authors.
* Copyright 2012-2017 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -139,7 +139,7 @@ public class ResourceMatcherTests {
.find(Arrays.asList(new File("src/test/resources/resource-matcher/one"),
new File("src/test/resources/resource-matcher/two"),
new File("src/test/resources/resource-matcher/three")));
List<String> paths = new ArrayList<String>();
List<String> paths = new ArrayList<>();
for (MatchedResource resource : matchedResources) {
paths.add(resource.getName());
}

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2012-2016 the original author or authors.
* Copyright 2012-2017 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -121,7 +121,7 @@ public class GroovyGrabDependencyResolverTests {
}
public Set<String> getNames(Collection<File> files) {
Set<String> names = new HashSet<String>(files.size());
Set<String> names = new HashSet<>(files.size());
for (File file : files) {
names.add(file.getName());
}

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2012-2016 the original author or authors.
* Copyright 2012-2017 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -118,7 +118,7 @@ public class InstallerTests {
}
private Set<String> getNamesOfFilesInLibExt() {
Set<String> names = new HashSet<String>();
Set<String> names = new HashSet<>();
for (File file : new File("target/lib/ext").listFiles()) {
names.add(file.getName());
}

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2012-2016 the original author or authors.
* Copyright 2012-2017 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -95,7 +95,7 @@ public final class GenericBomAstTransformationTests {
private List<String> getValue() {
Expression expression = findAnnotation().getMember("value");
if (expression instanceof ListExpression) {
List<String> list = new ArrayList<String>();
List<String> list = new ArrayList<>();
for (Expression ex : ((ListExpression) expression).getExpressions()) {
list.add((String) ((ConstantExpression) ex).getValue());
}

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2012-2016 the original author or authors.
* Copyright 2012-2017 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -106,7 +106,7 @@ public class RepositoryConfigurationFactoryTests {
private void assertRepositoryConfiguration(
List<RepositoryConfiguration> configurations, String... expectedNames) {
assertThat(configurations).hasSize(expectedNames.length);
Set<String> actualNames = new HashSet<String>();
Set<String> actualNames = new HashSet<>();
for (RepositoryConfiguration configuration : configurations) {
actualNames.add(configuration.getName());
}

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2012-2016 the original author or authors.
* Copyright 2012-2017 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -51,7 +51,7 @@ public class AetherGrapeEngineTests {
private AetherGrapeEngine createGrapeEngine(
RepositoryConfiguration... additionalRepositories) {
List<RepositoryConfiguration> repositoryConfigurations = new ArrayList<RepositoryConfiguration>();
List<RepositoryConfiguration> repositoryConfigurations = new ArrayList<>();
repositoryConfigurations.add(new RepositoryConfiguration("central",
URI.create("http://repo1.maven.org/maven2"), false));
repositoryConfigurations.addAll(Arrays.asList(additionalRepositories));
@@ -64,7 +64,7 @@ public class AetherGrapeEngineTests {
@Test
public void dependencyResolution() {
Map<String, Object> args = new HashMap<String, Object>();
Map<String, Object> args = new HashMap<>();
createGrapeEngine(this.springMilestones).grab(args,
createDependency("org.springframework", "spring-jdbc", "3.2.4.RELEASE"));
assertThat(this.groovyClassLoader.getURLs()).hasSize(5);
@@ -125,7 +125,7 @@ public class AetherGrapeEngineTests {
@Test
public void dependencyResolutionWithExclusions() {
Map<String, Object> args = new HashMap<String, Object>();
Map<String, Object> args = new HashMap<>();
args.put("excludes",
Arrays.asList(createExclusion("org.springframework", "spring-core")));
@@ -138,7 +138,7 @@ public class AetherGrapeEngineTests {
@Test
public void nonTransitiveDependencyResolution() {
Map<String, Object> args = new HashMap<String, Object>();
Map<String, Object> args = new HashMap<>();
createGrapeEngine().grab(args, createDependency("org.springframework",
"spring-jdbc", "3.2.4.RELEASE", false));
@@ -148,7 +148,7 @@ public class AetherGrapeEngineTests {
@Test
public void dependencyResolutionWithCustomClassLoader() {
Map<String, Object> args = new HashMap<String, Object>();
Map<String, Object> args = new HashMap<>();
GroovyClassLoader customClassLoader = new GroovyClassLoader();
args.put("classLoader", customClassLoader);
@@ -161,7 +161,7 @@ public class AetherGrapeEngineTests {
@Test
public void resolutionWithCustomResolver() {
Map<String, Object> args = new HashMap<String, Object>();
Map<String, Object> args = new HashMap<>();
AetherGrapeEngine grapeEngine = this.createGrapeEngine();
grapeEngine
.addResolver(createResolver("restlet.org", "http://maven.restlet.org"));
@@ -180,7 +180,7 @@ public class AetherGrapeEngineTests {
@Test
public void pomDependencyResolutionViaType() {
Map<String, Object> args = new HashMap<String, Object>();
Map<String, Object> args = new HashMap<>();
Map<String, Object> dependency = createDependency("org.springframework",
"spring-framework-bom", "4.0.5.RELEASE");
dependency.put("type", "pom");
@@ -192,7 +192,7 @@ public class AetherGrapeEngineTests {
@Test
public void pomDependencyResolutionViaExt() {
Map<String, Object> args = new HashMap<String, Object>();
Map<String, Object> args = new HashMap<>();
Map<String, Object> dependency = createDependency("org.springframework",
"spring-framework-bom", "4.0.5.RELEASE");
dependency.put("ext", "pom");
@@ -204,7 +204,7 @@ public class AetherGrapeEngineTests {
@Test
public void resolutionWithClassifier() {
Map<String, Object> args = new HashMap<String, Object>();
Map<String, Object> args = new HashMap<>();
Map<String, Object> dependency = createDependency("org.springframework",
"spring-jdbc", "3.2.4.RELEASE", false);
@@ -218,7 +218,7 @@ public class AetherGrapeEngineTests {
private Map<String, Object> createDependency(String group, String module,
String version) {
Map<String, Object> dependency = new HashMap<String, Object>();
Map<String, Object> dependency = new HashMap<>();
dependency.put("group", group);
dependency.put("module", module);
dependency.put("version", version);
@@ -233,14 +233,14 @@ public class AetherGrapeEngineTests {
}
private Map<String, Object> createResolver(String name, String url) {
Map<String, Object> resolver = new HashMap<String, Object>();
Map<String, Object> resolver = new HashMap<>();
resolver.put("name", name);
resolver.put("root", url);
return resolver;
}
private Map<String, Object> createExclusion(String group, String module) {
Map<String, Object> exclusion = new HashMap<String, Object>();
Map<String, Object> exclusion = new HashMap<>();
exclusion.put("group", group);
exclusion.put("module", module);
return exclusion;

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2012-2016 the original author or authors.
* Copyright 2012-2017 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -39,7 +39,7 @@ public final class SystemProperties {
*/
public static void doWithSystemProperties(Runnable action,
String... systemPropertyPairs) {
Map<String, String> originalValues = new HashMap<String, String>();
Map<String, String> originalValues = new HashMap<>();
for (String pair : systemPropertyPairs) {
String[] components = pair.split(":");
String key = components[0];