Reformat code use Eclipse Mars

This commit is contained in:
Phillip Webb
2015-10-07 23:32:31 -07:00
parent ba7c1fda72
commit 6ab376e2e8
652 changed files with 4151 additions and 3919 deletions

View File

@@ -92,14 +92,12 @@ public class ConfigurationMetadataAnnotationProcessorTests {
public void simpleProperties() throws Exception {
ConfigurationMetadata metadata = compile(SimpleProperties.class);
assertThat(metadata, containsGroup("simple").fromSource(SimpleProperties.class));
assertThat(
metadata,
assertThat(metadata,
containsProperty("simple.the-name", String.class)
.fromSource(SimpleProperties.class)
.withDescription("The name of this simple properties.")
.withDefaultValue(is("boot")).withDeprecated());
assertThat(
metadata,
assertThat(metadata,
containsProperty("simple.flag", Boolean.class)
.fromSource(SimpleProperties.class)
.withDescription("A simple flag.").withDeprecated());
@@ -113,10 +111,8 @@ public class ConfigurationMetadataAnnotationProcessorTests {
ConfigurationMetadata metadata = compile(SimplePrefixValueProperties.class);
assertThat(metadata,
containsGroup("simple").fromSource(SimplePrefixValueProperties.class));
assertThat(
metadata,
containsProperty("simple.name", String.class).fromSource(
SimplePrefixValueProperties.class));
assertThat(metadata, containsProperty("simple.name", String.class)
.fromSource(SimplePrefixValueProperties.class));
}
@Test
@@ -181,69 +177,48 @@ public class ConfigurationMetadataAnnotationProcessorTests {
public void parseCollectionConfig() throws Exception {
ConfigurationMetadata metadata = compile(SimpleCollectionProperties.class);
// getter and setter
assertThat(
metadata,
containsProperty("collection.integers-to-names",
"java.util.Map<java.lang.Integer,java.lang.String>"));
assertThat(
metadata,
containsProperty("collection.longs",
"java.util.Collection<java.lang.Long>"));
assertThat(metadata, containsProperty("collection.integers-to-names",
"java.util.Map<java.lang.Integer,java.lang.String>"));
assertThat(metadata, containsProperty("collection.longs",
"java.util.Collection<java.lang.Long>"));
assertThat(metadata,
containsProperty("collection.floats", "java.util.List<java.lang.Float>"));
// getter only
assertThat(
metadata,
containsProperty("collection.names-to-integers",
"java.util.Map<java.lang.String,java.lang.Integer>"));
assertThat(
metadata,
containsProperty("collection.bytes",
"java.util.Collection<java.lang.Byte>"));
assertThat(
metadata,
containsProperty("collection.doubles", "java.util.List<java.lang.Double>"));
assertThat(metadata, containsProperty("collection.names-to-integers",
"java.util.Map<java.lang.String,java.lang.Integer>"));
assertThat(metadata, containsProperty("collection.bytes",
"java.util.Collection<java.lang.Byte>"));
assertThat(metadata, containsProperty("collection.doubles",
"java.util.List<java.lang.Double>"));
}
@Test
public void simpleMethodConfig() throws Exception {
ConfigurationMetadata metadata = compile(SimpleMethodConfig.class);
assertThat(metadata, containsGroup("foo").fromSource(SimpleMethodConfig.class));
assertThat(
metadata,
containsProperty("foo.name", String.class).fromSource(
SimpleMethodConfig.Foo.class));
assertThat(
metadata,
containsProperty("foo.flag", Boolean.class).fromSource(
SimpleMethodConfig.Foo.class));
assertThat(metadata, containsProperty("foo.name", String.class)
.fromSource(SimpleMethodConfig.Foo.class));
assertThat(metadata, containsProperty("foo.flag", Boolean.class)
.fromSource(SimpleMethodConfig.Foo.class));
}
@Test
public void invalidMethodConfig() throws Exception {
ConfigurationMetadata metadata = compile(InvalidMethodConfig.class);
assertThat(
metadata,
containsProperty("something.name", String.class).fromSource(
InvalidMethodConfig.class));
assertThat(metadata, containsProperty("something.name", String.class)
.fromSource(InvalidMethodConfig.class));
assertThat(metadata, not(containsProperty("invalid.name")));
}
@Test
public void methodAndClassConfig() throws Exception {
ConfigurationMetadata metadata = compile(MethodAndClassConfig.class);
assertThat(
metadata,
containsProperty("conflict.name", String.class).fromSource(
MethodAndClassConfig.Foo.class));
assertThat(
metadata,
containsProperty("conflict.flag", Boolean.class).fromSource(
MethodAndClassConfig.Foo.class));
assertThat(
metadata,
containsProperty("conflict.value", String.class).fromSource(
MethodAndClassConfig.class));
assertThat(metadata, containsProperty("conflict.name", String.class)
.fromSource(MethodAndClassConfig.Foo.class));
assertThat(metadata, containsProperty("conflict.flag", Boolean.class)
.fromSource(MethodAndClassConfig.Foo.class));
assertThat(metadata, containsProperty("conflict.value", String.class)
.fromSource(MethodAndClassConfig.class));
}
@Test
@@ -320,7 +295,8 @@ public class ConfigurationMetadataAnnotationProcessorTests {
@Test
public void lombokExplicitProperties() throws Exception {
ConfigurationMetadata metadata = compile(LombokExplicitProperties.class);
assertSimpleLombokProperties(metadata, LombokExplicitProperties.class, "explicit");
assertSimpleLombokProperties(metadata, LombokExplicitProperties.class,
"explicit");
}
@Test
@@ -347,9 +323,8 @@ public class ConfigurationMetadataAnnotationProcessorTests {
assertThat(metadata, containsProperty("simple.comparator"));
assertThat(metadata,
containsProperty("foo", String.class)
.fromSource(AdditionalMetadata.class));
assertThat(metadata, containsProperty("foo", String.class)
.fromSource(AdditionalMetadata.class));
}
@Test
@@ -411,9 +386,8 @@ public class ConfigurationMetadataAnnotationProcessorTests {
containsProperty("foo.counter").fromSource(FooProperties.class));
assertThat(metadata,
containsProperty("bar.counter").fromSource(BarProperties.class));
assertThat(metadata,
not(containsProperty("bar.counter")
.fromSource(RenamedBarProperties.class)));
assertThat(metadata, not(
containsProperty("bar.counter").fromSource(RenamedBarProperties.class)));
project.delete(BarProperties.class);
project.add(RenamedBarProperties.class);
@@ -430,9 +404,8 @@ public class ConfigurationMetadataAnnotationProcessorTests {
Class<?> source, String prefix) {
assertThat(metadata, containsGroup(prefix).fromSource(source));
assertThat(metadata, not(containsProperty(prefix + ".id")));
assertThat(metadata,
containsProperty(prefix + ".name", String.class).fromSource(source)
.withDescription("Name description."));
assertThat(metadata, containsProperty(prefix + ".name", String.class)
.fromSource(source).withDescription("Name description."));
assertThat(metadata, containsProperty(prefix + ".description"));
assertThat(metadata, containsProperty(prefix + ".counter"));
assertThat(metadata, containsProperty(prefix + ".number").fromSource(source)

View File

@@ -119,12 +119,12 @@ public class ConfigurationMetadataMatchers {
ConfigurationMetadata metadata = (ConfigurationMetadata) item;
ItemMetadata property = getFirstPropertyWithName(metadata, this.name);
if (property == null) {
description.appendText("missing "
+ this.itemType.toString().toLowerCase() + " " + this.name);
description.appendText("missing " + this.itemType.toString().toLowerCase()
+ " " + this.name);
}
else {
description.appendText(
"was " + this.itemType.toString().toLowerCase() + " ")
description
.appendText("was " + this.itemType.toString().toLowerCase() + " ")
.appendValue(property);
}
}
@@ -151,12 +151,14 @@ public class ConfigurationMetadataMatchers {
public ContainsItemMatcher ofType(Class<?> dataType) {
return new ContainsItemMatcher(this.itemType, this.name, dataType.getName(),
this.sourceType, this.description, this.defaultValue, this.deprecated);
this.sourceType, this.description, this.defaultValue,
this.deprecated);
}
public ContainsItemMatcher ofType(String dataType) {
return new ContainsItemMatcher(this.itemType, this.name, dataType,
this.sourceType, this.description, this.defaultValue, this.deprecated);
this.sourceType, this.description, this.defaultValue,
this.deprecated);
}
public ContainsItemMatcher fromSource(Class<?> sourceType) {

View File

@@ -73,9 +73,10 @@ public class TestCompiler {
return getTask(javaFileObjects);
}
private TestCompilationTask getTask(Iterable<? extends JavaFileObject> javaFileObjects) {
return new TestCompilationTask(this.compiler.getTask(null, this.fileManager,
null, null, null, javaFileObjects));
private TestCompilationTask getTask(
Iterable<? extends JavaFileObject> javaFileObjects) {
return new TestCompilationTask(this.compiler.getTask(null, this.fileManager, null,
null, null, javaFileObjects));
}
public File getOutputLocation() {

View File

@@ -34,8 +34,8 @@ import org.springframework.boot.configurationprocessor.metadata.JsonMarshaller;
*/
@SupportedAnnotationTypes({ "*" })
@SupportedSourceVersion(SourceVersion.RELEASE_6)
public class TestConfigurationMetadataAnnotationProcessor extends
ConfigurationMetadataAnnotationProcessor {
public class TestConfigurationMetadataAnnotationProcessor
extends ConfigurationMetadataAnnotationProcessor {
static final String CONFIGURATION_PROPERTIES_ANNOTATION = "org.springframework.boot.configurationsample.ConfigurationProperties";
@@ -66,8 +66,8 @@ public class TestConfigurationMetadataAnnotationProcessor extends
File metadataFile = new File(this.outputLocation,
"META-INF/spring-configuration-metadata.json");
if (metadataFile.isFile()) {
this.metadata = new JsonMarshaller().read(new FileInputStream(
metadataFile));
this.metadata = new JsonMarshaller()
.read(new FileInputStream(metadataFile));
}
else {
this.metadata = new ConfigurationMetadata();

View File

@@ -140,8 +140,8 @@ public class TestProject {
File targetFile = getSourceFile(target);
String contents = getContents(targetFile);
int insertAt = contents.lastIndexOf('}');
String additionalSource = FileCopyUtils.copyToString(new InputStreamReader(
snippetStream));
String additionalSource = FileCopyUtils
.copyToString(new InputStreamReader(snippetStream));
contents = contents.substring(0, insertAt) + additionalSource
+ contents.substring(insertAt);
putContents(targetFile, contents);

View File

@@ -82,8 +82,8 @@ public abstract class AbstractFieldValuesProcessorTests {
equalToObject(new Object[] { "FOO", "BAR" }));
assertThat(values.get("stringArrayNone"), nullValue());
assertThat(values.get("stringEmptyArray"), equalToObject(new Object[0]));
assertThat(values.get("stringArrayConst"), equalToObject(new Object[] { "OK",
"KO" }));
assertThat(values.get("stringArrayConst"),
equalToObject(new Object[] { "OK", "KO" }));
assertThat(values.get("stringArrayConstElements"),
equalToObject(new Object[] { "c" }));
assertThat(values.get("integerArray"), equalToObject(new Object[] { 42, 24 }));
@@ -94,7 +94,8 @@ public abstract class AbstractFieldValuesProcessorTests {
return equalTo(object);
}
@SupportedAnnotationTypes({ "org.springframework.boot.configurationsample.ConfigurationProperties" })
@SupportedAnnotationTypes({
"org.springframework.boot.configurationsample.ConfigurationProperties" })
@SupportedSourceVersion(SourceVersion.RELEASE_6)
private class TestProcessor extends AbstractProcessor {
@@ -114,8 +115,8 @@ public abstract class AbstractFieldValuesProcessorTests {
for (Element element : roundEnv.getElementsAnnotatedWith(annotation)) {
if (element instanceof TypeElement) {
try {
this.values.putAll(this.processor
.getFieldValues((TypeElement) element));
this.values.putAll(
this.processor.getFieldValues((TypeElement) element));
}
catch (Exception ex) {
throw new IllegalStateException(ex);

View File

@@ -28,8 +28,8 @@ import static org.junit.Assume.assumeNoException;
*
* @author Phillip Webb
*/
public class JavaCompilerFieldValuesProcessorTests extends
AbstractFieldValuesProcessorTests {
public class JavaCompilerFieldValuesProcessorTests
extends AbstractFieldValuesProcessorTests {
@Override
protected FieldValuesParser createProcessor(ProcessingEnvironment env) {

View File

@@ -40,7 +40,8 @@ public class ConfigurationMetadataTests {
@Test
public void toDashedCaseWordsSeveralUnderScores() {
assertThat(toDashedCase("Word___With__underscore"), is("word___with__underscore"));
assertThat(toDashedCase("Word___With__underscore"),
is("word___with__underscore"));
}
@Test

View File

@@ -41,12 +41,12 @@ public class JsonMarshallerTests {
ConfigurationMetadata metadata = new ConfigurationMetadata();
metadata.add(ItemMetadata.newProperty("a", "b", StringBuffer.class.getName(),
InputStream.class.getName(), "sourceMethod", "desc", "x", true));
metadata.add(ItemMetadata.newProperty("b.c.d", null, null, null, null, null,
null, false));
metadata.add(ItemMetadata.newProperty("c", null, null, null, null, null, 123,
false));
metadata.add(ItemMetadata.newProperty("d", null, null, null, null, null, true,
metadata.add(ItemMetadata.newProperty("b.c.d", null, null, null, null, null, null,
false));
metadata.add(
ItemMetadata.newProperty("c", null, null, null, null, null, 123, false));
metadata.add(
ItemMetadata.newProperty("d", null, null, null, null, null, true, false));
metadata.add(ItemMetadata.newProperty("e", null, null, null, null, null,
new String[] { "y", "n" }, false));
metadata.add(ItemMetadata.newProperty("f", null, null, null, null, null,
@@ -55,8 +55,8 @@ public class JsonMarshallerTests {
ByteArrayOutputStream outputStream = new ByteArrayOutputStream();
JsonMarshaller marshaller = new JsonMarshaller();
marshaller.write(metadata, outputStream);
ConfigurationMetadata read = marshaller.read(new ByteArrayInputStream(
outputStream.toByteArray()));
ConfigurationMetadata read = marshaller
.read(new ByteArrayInputStream(outputStream.toByteArray()));
assertThat(read,
containsProperty("a.b", StringBuffer.class).fromSource(InputStream.class)
.withDescription("desc").withDefaultValue(is("x"))
@@ -66,8 +66,8 @@ public class JsonMarshallerTests {
assertThat(read, containsProperty("d").withDefaultValue(is(true)));
assertThat(read,
containsProperty("e").withDefaultValue(is(new String[] { "y", "n" })));
assertThat(read,
containsProperty("f").withDefaultValue(is(new boolean[] { true, false })));
assertThat(read, containsProperty("f")
.withDefaultValue(is(new boolean[] { true, false })));
assertThat(read, containsGroup("d"));
}

View File

@@ -21,8 +21,8 @@ package org.springframework.boot.configurationsample.simple;
*
* @author Stephane Nicoll
*/
public abstract class HierarchicalPropertiesParent extends
HierarchicalPropertiesGrandparent {
public abstract class HierarchicalPropertiesParent
extends HierarchicalPropertiesGrandparent {
private String second;