Commit 7f2af8b2 authored by Stephane Nicoll's avatar Stephane Nicoll

Polish

parent fb7cc21d
...@@ -39,41 +39,41 @@ import static org.assertj.core.api.Assertions.assertThat; ...@@ -39,41 +39,41 @@ import static org.assertj.core.api.Assertions.assertThat;
public class SpringBootContextLoaderTests { public class SpringBootContextLoaderTests {
@Test @Test
public void environmentPropertiesSimple() throws Exception { public void environmentPropertiesSimple() {
Map<String, Object> config = getEnvironmentProperties(SimpleConfig.class); Map<String, Object> config = getEnvironmentProperties(SimpleConfig.class);
assertKey(config, "key", "myValue"); assertKey(config, "key", "myValue");
assertKey(config, "anotherKey", "anotherValue"); assertKey(config, "anotherKey", "anotherValue");
} }
@Test @Test
public void environmentPropertiesSimpleNonAlias() throws Exception { public void environmentPropertiesSimpleNonAlias() {
Map<String, Object> config = getEnvironmentProperties(SimpleConfigNonAlias.class); Map<String, Object> config = getEnvironmentProperties(SimpleConfigNonAlias.class);
assertKey(config, "key", "myValue"); assertKey(config, "key", "myValue");
assertKey(config, "anotherKey", "anotherValue"); assertKey(config, "anotherKey", "anotherValue");
} }
@Test @Test
public void environmentPropertiesOverrideDefaults() throws Exception { public void environmentPropertiesOverrideDefaults() {
Map<String, Object> config = getEnvironmentProperties(OverrideConfig.class); Map<String, Object> config = getEnvironmentProperties(OverrideConfig.class);
assertKey(config, "server.port", "2345"); assertKey(config, "server.port", "2345");
} }
@Test @Test
public void environmentPropertiesAppend() throws Exception { public void environmentPropertiesAppend() {
Map<String, Object> config = getEnvironmentProperties(AppendConfig.class); Map<String, Object> config = getEnvironmentProperties(AppendConfig.class);
assertKey(config, "key", "myValue"); assertKey(config, "key", "myValue");
assertKey(config, "otherKey", "otherValue"); assertKey(config, "otherKey", "otherValue");
} }
@Test @Test
public void environmentPropertiesSeparatorInValue() throws Exception { public void environmentPropertiesSeparatorInValue() {
Map<String, Object> config = getEnvironmentProperties(SameSeparatorInValue.class); Map<String, Object> config = getEnvironmentProperties(SameSeparatorInValue.class);
assertKey(config, "key", "my=Value"); assertKey(config, "key", "my=Value");
assertKey(config, "anotherKey", "another:Value"); assertKey(config, "anotherKey", "another:Value");
} }
@Test @Test
public void environmentPropertiesAnotherSeparatorInValue() throws Exception { public void environmentPropertiesAnotherSeparatorInValue() {
Map<String, Object> config = getEnvironmentProperties( Map<String, Object> config = getEnvironmentProperties(
AnotherSeparatorInValue.class); AnotherSeparatorInValue.class);
assertKey(config, "key", "my:Value"); assertKey(config, "key", "my:Value");
...@@ -82,7 +82,7 @@ public class SpringBootContextLoaderTests { ...@@ -82,7 +82,7 @@ public class SpringBootContextLoaderTests {
@Test @Test
@Ignore @Ignore
public void environmentPropertiesNewLineInValue() throws Exception { public void environmentPropertiesNewLineInValue() {
// gh-4384 // gh-4384
Map<String, Object> config = getEnvironmentProperties(NewLineInValue.class); Map<String, Object> config = getEnvironmentProperties(NewLineInValue.class);
assertKey(config, "key", "myValue"); assertKey(config, "key", "myValue");
......
...@@ -112,22 +112,22 @@ public class JsonContentAssertTests { ...@@ -112,22 +112,22 @@ public class JsonContentAssertTests {
} }
@Test @Test
public void isEqualToWhenInputStreamIsMatchingShouldPass() throws Exception { public void isEqualToWhenInputStreamIsMatchingShouldPass() {
assertThat(forJson(SOURCE)).isEqualTo(createInputStream(LENIENT_SAME)); assertThat(forJson(SOURCE)).isEqualTo(createInputStream(LENIENT_SAME));
} }
@Test(expected = AssertionError.class) @Test(expected = AssertionError.class)
public void isEqualToWhenInputStreamIsNotMatchingShouldFail() throws Exception { public void isEqualToWhenInputStreamIsNotMatchingShouldFail() {
assertThat(forJson(SOURCE)).isEqualTo(createInputStream(DIFFERENT)); assertThat(forJson(SOURCE)).isEqualTo(createInputStream(DIFFERENT));
} }
@Test @Test
public void isEqualToWhenResourceIsMatchingShouldPass() throws Exception { public void isEqualToWhenResourceIsMatchingShouldPass() {
assertThat(forJson(SOURCE)).isEqualTo(createResource(LENIENT_SAME)); assertThat(forJson(SOURCE)).isEqualTo(createResource(LENIENT_SAME));
} }
@Test(expected = AssertionError.class) @Test(expected = AssertionError.class)
public void isEqualToWhenResourceIsNotMatchingShouldFail() throws Exception { public void isEqualToWhenResourceIsNotMatchingShouldFail() {
assertThat(forJson(SOURCE)).isEqualTo(createResource(DIFFERENT)); assertThat(forJson(SOURCE)).isEqualTo(createResource(DIFFERENT));
} }
...@@ -187,22 +187,22 @@ public class JsonContentAssertTests { ...@@ -187,22 +187,22 @@ public class JsonContentAssertTests {
} }
@Test @Test
public void isEqualToJsonWhenInputStreamIsMatchingShouldPass() throws Exception { public void isEqualToJsonWhenInputStreamIsMatchingShouldPass() {
assertThat(forJson(SOURCE)).isEqualToJson(createInputStream(LENIENT_SAME)); assertThat(forJson(SOURCE)).isEqualToJson(createInputStream(LENIENT_SAME));
} }
@Test(expected = AssertionError.class) @Test(expected = AssertionError.class)
public void isEqualToJsonWhenInputStreamIsNotMatchingShouldFail() throws Exception { public void isEqualToJsonWhenInputStreamIsNotMatchingShouldFail() {
assertThat(forJson(SOURCE)).isEqualToJson(createInputStream(DIFFERENT)); assertThat(forJson(SOURCE)).isEqualToJson(createInputStream(DIFFERENT));
} }
@Test @Test
public void isEqualToJsonWhenResourceIsMatchingShouldPass() throws Exception { public void isEqualToJsonWhenResourceIsMatchingShouldPass() {
assertThat(forJson(SOURCE)).isEqualToJson(createResource(LENIENT_SAME)); assertThat(forJson(SOURCE)).isEqualToJson(createResource(LENIENT_SAME));
} }
@Test(expected = AssertionError.class) @Test(expected = AssertionError.class)
public void isEqualToJsonWhenResourceIsNotMatchingShouldFail() throws Exception { public void isEqualToJsonWhenResourceIsNotMatchingShouldFail() {
assertThat(forJson(SOURCE)).isEqualToJson(createResource(DIFFERENT)); assertThat(forJson(SOURCE)).isEqualToJson(createResource(DIFFERENT));
} }
...@@ -258,26 +258,23 @@ public class JsonContentAssertTests { ...@@ -258,26 +258,23 @@ public class JsonContentAssertTests {
} }
@Test @Test
public void isStrictlyEqualToJsonWhenInputStreamIsMatchingShouldPass() public void isStrictlyEqualToJsonWhenInputStreamIsMatchingShouldPass() {
throws Exception {
assertThat(forJson(SOURCE)).isStrictlyEqualToJson(createInputStream(SOURCE)); assertThat(forJson(SOURCE)).isStrictlyEqualToJson(createInputStream(SOURCE));
} }
@Test(expected = AssertionError.class) @Test(expected = AssertionError.class)
public void isStrictlyEqualToJsonWhenInputStreamIsNotMatchingShouldFail() public void isStrictlyEqualToJsonWhenInputStreamIsNotMatchingShouldFail() {
throws Exception {
assertThat(forJson(SOURCE)) assertThat(forJson(SOURCE))
.isStrictlyEqualToJson(createInputStream(LENIENT_SAME)); .isStrictlyEqualToJson(createInputStream(LENIENT_SAME));
} }
@Test @Test
public void isStrictlyEqualToJsonWhenResourceIsMatchingShouldPass() throws Exception { public void isStrictlyEqualToJsonWhenResourceIsMatchingShouldPass() {
assertThat(forJson(SOURCE)).isStrictlyEqualToJson(createResource(SOURCE)); assertThat(forJson(SOURCE)).isStrictlyEqualToJson(createResource(SOURCE));
} }
@Test(expected = AssertionError.class) @Test(expected = AssertionError.class)
public void isStrictlyEqualToJsonWhenResourceIsNotMatchingShouldFail() public void isStrictlyEqualToJsonWhenResourceIsNotMatchingShouldFail() {
throws Exception {
assertThat(forJson(SOURCE)).isStrictlyEqualToJson(createResource(LENIENT_SAME)); assertThat(forJson(SOURCE)).isStrictlyEqualToJson(createResource(LENIENT_SAME));
} }
...@@ -341,29 +338,25 @@ public class JsonContentAssertTests { ...@@ -341,29 +338,25 @@ public class JsonContentAssertTests {
} }
@Test @Test
public void isEqualToJsonWhenInputStreamIsMatchingAndLenientShouldPass() public void isEqualToJsonWhenInputStreamIsMatchingAndLenientShouldPass() {
throws Exception {
assertThat(forJson(SOURCE)).isEqualToJson(createInputStream(LENIENT_SAME), assertThat(forJson(SOURCE)).isEqualToJson(createInputStream(LENIENT_SAME),
JSONCompareMode.LENIENT); JSONCompareMode.LENIENT);
} }
@Test(expected = AssertionError.class) @Test(expected = AssertionError.class)
public void isEqualToJsonWhenInputStreamIsNotMatchingAndLenientShouldFail() public void isEqualToJsonWhenInputStreamIsNotMatchingAndLenientShouldFail() {
throws Exception {
assertThat(forJson(SOURCE)).isEqualToJson(createInputStream(DIFFERENT), assertThat(forJson(SOURCE)).isEqualToJson(createInputStream(DIFFERENT),
JSONCompareMode.LENIENT); JSONCompareMode.LENIENT);
} }
@Test @Test
public void isEqualToJsonWhenResourceIsMatchingAndLenientShouldPass() public void isEqualToJsonWhenResourceIsMatchingAndLenientShouldPass() {
throws Exception {
assertThat(forJson(SOURCE)).isEqualToJson(createResource(LENIENT_SAME), assertThat(forJson(SOURCE)).isEqualToJson(createResource(LENIENT_SAME),
JSONCompareMode.LENIENT); JSONCompareMode.LENIENT);
} }
@Test(expected = AssertionError.class) @Test(expected = AssertionError.class)
public void isEqualToJsonWhenResourceIsNotMatchingAndLenientShouldFail() public void isEqualToJsonWhenResourceIsNotMatchingAndLenientShouldFail() {
throws Exception {
assertThat(forJson(SOURCE)).isEqualToJson(createResource(DIFFERENT), assertThat(forJson(SOURCE)).isEqualToJson(createResource(DIFFERENT),
JSONCompareMode.LENIENT); JSONCompareMode.LENIENT);
} }
...@@ -423,29 +416,25 @@ public class JsonContentAssertTests { ...@@ -423,29 +416,25 @@ public class JsonContentAssertTests {
} }
@Test @Test
public void isEqualToJsonWhenInputStreamIsMatchingAndComparatorShouldPass() public void isEqualToJsonWhenInputStreamIsMatchingAndComparatorShouldPass() {
throws Exception {
assertThat(forJson(SOURCE)).isEqualToJson(createInputStream(LENIENT_SAME), assertThat(forJson(SOURCE)).isEqualToJson(createInputStream(LENIENT_SAME),
COMPARATOR); COMPARATOR);
} }
@Test(expected = AssertionError.class) @Test(expected = AssertionError.class)
public void isEqualToJsonWhenInputStreamIsNotMatchingAndComparatorShouldFail() public void isEqualToJsonWhenInputStreamIsNotMatchingAndComparatorShouldFail() {
throws Exception {
assertThat(forJson(SOURCE)).isEqualToJson(createInputStream(DIFFERENT), assertThat(forJson(SOURCE)).isEqualToJson(createInputStream(DIFFERENT),
COMPARATOR); COMPARATOR);
} }
@Test @Test
public void isEqualToJsonWhenResourceIsMatchingAndComparatorShouldPass() public void isEqualToJsonWhenResourceIsMatchingAndComparatorShouldPass() {
throws Exception {
assertThat(forJson(SOURCE)).isEqualToJson(createResource(LENIENT_SAME), assertThat(forJson(SOURCE)).isEqualToJson(createResource(LENIENT_SAME),
COMPARATOR); COMPARATOR);
} }
@Test(expected = AssertionError.class) @Test(expected = AssertionError.class)
public void isEqualToJsonWhenResourceIsNotMatchingAndComparatorShouldFail() public void isEqualToJsonWhenResourceIsNotMatchingAndComparatorShouldFail() {
throws Exception {
assertThat(forJson(SOURCE)).isEqualToJson(createResource(DIFFERENT), COMPARATOR); assertThat(forJson(SOURCE)).isEqualToJson(createResource(DIFFERENT), COMPARATOR);
} }
...@@ -495,22 +484,22 @@ public class JsonContentAssertTests { ...@@ -495,22 +484,22 @@ public class JsonContentAssertTests {
} }
@Test(expected = AssertionError.class) @Test(expected = AssertionError.class)
public void isNotEqualToWhenInputStreamIsMatchingShouldFail() throws Exception { public void isNotEqualToWhenInputStreamIsMatchingShouldFail() {
assertThat(forJson(SOURCE)).isNotEqualTo(createInputStream(LENIENT_SAME)); assertThat(forJson(SOURCE)).isNotEqualTo(createInputStream(LENIENT_SAME));
} }
@Test @Test
public void isNotEqualToWhenInputStreamIsNotMatchingShouldPass() throws Exception { public void isNotEqualToWhenInputStreamIsNotMatchingShouldPass() {
assertThat(forJson(SOURCE)).isNotEqualTo(createInputStream(DIFFERENT)); assertThat(forJson(SOURCE)).isNotEqualTo(createInputStream(DIFFERENT));
} }
@Test(expected = AssertionError.class) @Test(expected = AssertionError.class)
public void isNotEqualToWhenResourceIsMatchingShouldFail() throws Exception { public void isNotEqualToWhenResourceIsMatchingShouldFail() {
assertThat(forJson(SOURCE)).isNotEqualTo(createResource(LENIENT_SAME)); assertThat(forJson(SOURCE)).isNotEqualTo(createResource(LENIENT_SAME));
} }
@Test @Test
public void isNotEqualToWhenResourceIsNotMatchingShouldPass() throws Exception { public void isNotEqualToWhenResourceIsNotMatchingShouldPass() {
assertThat(forJson(SOURCE)).isNotEqualTo(createResource(DIFFERENT)); assertThat(forJson(SOURCE)).isNotEqualTo(createResource(DIFFERENT));
} }
...@@ -570,23 +559,22 @@ public class JsonContentAssertTests { ...@@ -570,23 +559,22 @@ public class JsonContentAssertTests {
} }
@Test(expected = AssertionError.class) @Test(expected = AssertionError.class)
public void isNotEqualToJsonWhenInputStreamIsMatchingShouldFail() throws Exception { public void isNotEqualToJsonWhenInputStreamIsMatchingShouldFail() {
assertThat(forJson(SOURCE)).isNotEqualToJson(createInputStream(LENIENT_SAME)); assertThat(forJson(SOURCE)).isNotEqualToJson(createInputStream(LENIENT_SAME));
} }
@Test @Test
public void isNotEqualToJsonWhenInputStreamIsNotMatchingShouldPass() public void isNotEqualToJsonWhenInputStreamIsNotMatchingShouldPass() {
throws Exception {
assertThat(forJson(SOURCE)).isNotEqualToJson(createInputStream(DIFFERENT)); assertThat(forJson(SOURCE)).isNotEqualToJson(createInputStream(DIFFERENT));
} }
@Test(expected = AssertionError.class) @Test(expected = AssertionError.class)
public void isNotEqualToJsonWhenResourceIsMatchingShouldFail() throws Exception { public void isNotEqualToJsonWhenResourceIsMatchingShouldFail() {
assertThat(forJson(SOURCE)).isNotEqualToJson(createResource(LENIENT_SAME)); assertThat(forJson(SOURCE)).isNotEqualToJson(createResource(LENIENT_SAME));
} }
@Test @Test
public void isNotEqualToJsonWhenResourceIsNotMatchingShouldPass() throws Exception { public void isNotEqualToJsonWhenResourceIsNotMatchingShouldPass() {
assertThat(forJson(SOURCE)).isNotEqualToJson(createResource(DIFFERENT)); assertThat(forJson(SOURCE)).isNotEqualToJson(createResource(DIFFERENT));
} }
...@@ -643,27 +631,23 @@ public class JsonContentAssertTests { ...@@ -643,27 +631,23 @@ public class JsonContentAssertTests {
} }
@Test(expected = AssertionError.class) @Test(expected = AssertionError.class)
public void isNotStrictlyEqualToJsonWhenInputStreamIsMatchingShouldFail() public void isNotStrictlyEqualToJsonWhenInputStreamIsMatchingShouldFail() {
throws Exception {
assertThat(forJson(SOURCE)).isNotStrictlyEqualToJson(createInputStream(SOURCE)); assertThat(forJson(SOURCE)).isNotStrictlyEqualToJson(createInputStream(SOURCE));
} }
@Test @Test
public void isNotStrictlyEqualToJsonWhenInputStreamIsNotMatchingShouldPass() public void isNotStrictlyEqualToJsonWhenInputStreamIsNotMatchingShouldPass() {
throws Exception {
assertThat(forJson(SOURCE)) assertThat(forJson(SOURCE))
.isNotStrictlyEqualToJson(createInputStream(LENIENT_SAME)); .isNotStrictlyEqualToJson(createInputStream(LENIENT_SAME));
} }
@Test(expected = AssertionError.class) @Test(expected = AssertionError.class)
public void isNotStrictlyEqualToJsonWhenResourceIsMatchingShouldFail() public void isNotStrictlyEqualToJsonWhenResourceIsMatchingShouldFail() {
throws Exception {
assertThat(forJson(SOURCE)).isNotStrictlyEqualToJson(createResource(SOURCE)); assertThat(forJson(SOURCE)).isNotStrictlyEqualToJson(createResource(SOURCE));
} }
@Test @Test
public void isNotStrictlyEqualToJsonWhenResourceIsNotMatchingShouldPass() public void isNotStrictlyEqualToJsonWhenResourceIsNotMatchingShouldPass() {
throws Exception {
assertThat(forJson(SOURCE)) assertThat(forJson(SOURCE))
.isNotStrictlyEqualToJson(createResource(LENIENT_SAME)); .isNotStrictlyEqualToJson(createResource(LENIENT_SAME));
} }
...@@ -730,29 +714,25 @@ public class JsonContentAssertTests { ...@@ -730,29 +714,25 @@ public class JsonContentAssertTests {
} }
@Test(expected = AssertionError.class) @Test(expected = AssertionError.class)
public void isNotEqualToJsonWhenInputStreamIsMatchingAndLenientShouldFail() public void isNotEqualToJsonWhenInputStreamIsMatchingAndLenientShouldFail() {
throws Exception {
assertThat(forJson(SOURCE)).isNotEqualToJson(createInputStream(LENIENT_SAME), assertThat(forJson(SOURCE)).isNotEqualToJson(createInputStream(LENIENT_SAME),
JSONCompareMode.LENIENT); JSONCompareMode.LENIENT);
} }
@Test @Test
public void isNotEqualToJsonWhenInputStreamIsNotMatchingAndLenientShouldPass() public void isNotEqualToJsonWhenInputStreamIsNotMatchingAndLenientShouldPass() {
throws Exception {
assertThat(forJson(SOURCE)).isNotEqualToJson(createInputStream(DIFFERENT), assertThat(forJson(SOURCE)).isNotEqualToJson(createInputStream(DIFFERENT),
JSONCompareMode.LENIENT); JSONCompareMode.LENIENT);
} }
@Test(expected = AssertionError.class) @Test(expected = AssertionError.class)
public void isNotEqualToJsonWhenResourceIsMatchingAndLenientShouldFail() public void isNotEqualToJsonWhenResourceIsMatchingAndLenientShouldFail() {
throws Exception {
assertThat(forJson(SOURCE)).isNotEqualToJson(createResource(LENIENT_SAME), assertThat(forJson(SOURCE)).isNotEqualToJson(createResource(LENIENT_SAME),
JSONCompareMode.LENIENT); JSONCompareMode.LENIENT);
} }
@Test @Test
public void isNotEqualToJsonWhenResourceIsNotMatchingAndLenientShouldPass() public void isNotEqualToJsonWhenResourceIsNotMatchingAndLenientShouldPass() {
throws Exception {
assertThat(forJson(SOURCE)).isNotEqualToJson(createResource(DIFFERENT), assertThat(forJson(SOURCE)).isNotEqualToJson(createResource(DIFFERENT),
JSONCompareMode.LENIENT); JSONCompareMode.LENIENT);
} }
...@@ -813,29 +793,25 @@ public class JsonContentAssertTests { ...@@ -813,29 +793,25 @@ public class JsonContentAssertTests {
} }
@Test(expected = AssertionError.class) @Test(expected = AssertionError.class)
public void isNotEqualToJsonWhenInputStreamIsMatchingAndComparatorShouldFail() public void isNotEqualToJsonWhenInputStreamIsMatchingAndComparatorShouldFail() {
throws Exception {
assertThat(forJson(SOURCE)).isNotEqualToJson(createInputStream(LENIENT_SAME), assertThat(forJson(SOURCE)).isNotEqualToJson(createInputStream(LENIENT_SAME),
COMPARATOR); COMPARATOR);
} }
@Test @Test
public void isNotEqualToJsonWhenInputStreamIsNotMatchingAndComparatorShouldPass() public void isNotEqualToJsonWhenInputStreamIsNotMatchingAndComparatorShouldPass() {
throws Exception {
assertThat(forJson(SOURCE)).isNotEqualToJson(createInputStream(DIFFERENT), assertThat(forJson(SOURCE)).isNotEqualToJson(createInputStream(DIFFERENT),
COMPARATOR); COMPARATOR);
} }
@Test(expected = AssertionError.class) @Test(expected = AssertionError.class)
public void isNotEqualToJsonWhenResourceIsMatchingAndComparatorShouldFail() public void isNotEqualToJsonWhenResourceIsMatchingAndComparatorShouldFail() {
throws Exception {
assertThat(forJson(SOURCE)).isNotEqualToJson(createResource(LENIENT_SAME), assertThat(forJson(SOURCE)).isNotEqualToJson(createResource(LENIENT_SAME),
COMPARATOR); COMPARATOR);
} }
@Test @Test
public void isNotEqualToJsonWhenResourceIsNotMatchingAndComparatorShouldPass() public void isNotEqualToJsonWhenResourceIsNotMatchingAndComparatorShouldPass() {
throws Exception {
assertThat(forJson(SOURCE)).isNotEqualToJson(createResource(DIFFERENT), assertThat(forJson(SOURCE)).isNotEqualToJson(createResource(DIFFERENT),
COMPARATOR); COMPARATOR);
} }
......
...@@ -48,7 +48,7 @@ public class MockBeanForBeanFactoryIntegrationTests { ...@@ -48,7 +48,7 @@ public class MockBeanForBeanFactoryIntegrationTests {
@Test @Test
@SuppressWarnings({ "unchecked", "rawtypes" }) @SuppressWarnings({ "unchecked", "rawtypes" })
public void testName() throws Exception { public void testName() {
TestBean testBean = mock(TestBean.class); TestBean testBean = mock(TestBean.class);
given(testBean.hello()).willReturn("amock"); given(testBean.hello()).willReturn("amock");
given(this.testFactoryBean.getObjectType()).willReturn((Class) TestBean.class); given(this.testFactoryBean.getObjectType()).willReturn((Class) TestBean.class);
......
...@@ -107,13 +107,13 @@ public class ConfigurationMetadataAnnotationProcessorTests { ...@@ -107,13 +107,13 @@ public class ConfigurationMetadataAnnotationProcessorTests {
} }
@Test @Test
public void notAnnotated() throws Exception { public void notAnnotated() {
ConfigurationMetadata metadata = compile(NotAnnotated.class); ConfigurationMetadata metadata = compile(NotAnnotated.class);
assertThat(metadata.getItems()).isEmpty(); assertThat(metadata.getItems()).isEmpty();
} }
@Test @Test
public void simpleProperties() throws Exception { public void simpleProperties() {
ConfigurationMetadata metadata = compile(SimpleProperties.class); ConfigurationMetadata metadata = compile(SimpleProperties.class);
assertThat(metadata) assertThat(metadata)
.has(Metadata.withGroup("simple").fromSource(SimpleProperties.class)); .has(Metadata.withGroup("simple").fromSource(SimpleProperties.class));
...@@ -130,7 +130,7 @@ public class ConfigurationMetadataAnnotationProcessorTests { ...@@ -130,7 +130,7 @@ public class ConfigurationMetadataAnnotationProcessorTests {
} }
@Test @Test
public void simplePrefixValueProperties() throws Exception { public void simplePrefixValueProperties() {
ConfigurationMetadata metadata = compile(SimplePrefixValueProperties.class); ConfigurationMetadata metadata = compile(SimplePrefixValueProperties.class);
assertThat(metadata).has(Metadata.withGroup("simple") assertThat(metadata).has(Metadata.withGroup("simple")
.fromSource(SimplePrefixValueProperties.class)); .fromSource(SimplePrefixValueProperties.class));
...@@ -139,7 +139,7 @@ public class ConfigurationMetadataAnnotationProcessorTests { ...@@ -139,7 +139,7 @@ public class ConfigurationMetadataAnnotationProcessorTests {
} }
@Test @Test
public void simpleTypeProperties() throws Exception { public void simpleTypeProperties() {
ConfigurationMetadata metadata = compile(SimpleTypeProperties.class); ConfigurationMetadata metadata = compile(SimpleTypeProperties.class);
assertThat(metadata).has( assertThat(metadata).has(
Metadata.withGroup("simple.type").fromSource(SimpleTypeProperties.class)); Metadata.withGroup("simple.type").fromSource(SimpleTypeProperties.class));
...@@ -186,7 +186,7 @@ public class ConfigurationMetadataAnnotationProcessorTests { ...@@ -186,7 +186,7 @@ public class ConfigurationMetadataAnnotationProcessorTests {
} }
@Test @Test
public void hierarchicalProperties() throws Exception { public void hierarchicalProperties() {
ConfigurationMetadata metadata = compile(HierarchicalProperties.class); ConfigurationMetadata metadata = compile(HierarchicalProperties.class);
assertThat(metadata).has(Metadata.withGroup("hierarchical") assertThat(metadata).has(Metadata.withGroup("hierarchical")
.fromSource(HierarchicalProperties.class)); .fromSource(HierarchicalProperties.class));
...@@ -201,7 +201,7 @@ public class ConfigurationMetadataAnnotationProcessorTests { ...@@ -201,7 +201,7 @@ public class ConfigurationMetadataAnnotationProcessorTests {
@Test @Test
@SuppressWarnings("deprecation") @SuppressWarnings("deprecation")
public void deprecatedProperties() throws Exception { public void deprecatedProperties() {
Class<?> type = org.springframework.boot.configurationsample.simple.DeprecatedProperties.class; Class<?> type = org.springframework.boot.configurationsample.simple.DeprecatedProperties.class;
ConfigurationMetadata metadata = compile(type); ConfigurationMetadata metadata = compile(type);
assertThat(metadata).has(Metadata.withGroup("deprecated").fromSource(type)); assertThat(metadata).has(Metadata.withGroup("deprecated").fromSource(type));
...@@ -213,7 +213,7 @@ public class ConfigurationMetadataAnnotationProcessorTests { ...@@ -213,7 +213,7 @@ public class ConfigurationMetadataAnnotationProcessorTests {
} }
@Test @Test
public void singleDeprecatedProperty() throws Exception { public void singleDeprecatedProperty() {
Class<?> type = DeprecatedSingleProperty.class; Class<?> type = DeprecatedSingleProperty.class;
ConfigurationMetadata metadata = compile(type); ConfigurationMetadata metadata = compile(type);
assertThat(metadata).has(Metadata.withGroup("singledeprecated").fromSource(type)); assertThat(metadata).has(Metadata.withGroup("singledeprecated").fromSource(type));
...@@ -226,7 +226,7 @@ public class ConfigurationMetadataAnnotationProcessorTests { ...@@ -226,7 +226,7 @@ public class ConfigurationMetadataAnnotationProcessorTests {
} }
@Test @Test
public void deprecatedOnUnrelatedSetter() throws Exception { public void deprecatedOnUnrelatedSetter() {
Class<?> type = DeprecatedUnrelatedMethodPojo.class; Class<?> type = DeprecatedUnrelatedMethodPojo.class;
ConfigurationMetadata metadata = compile(type); ConfigurationMetadata metadata = compile(type);
assertThat(metadata).has(Metadata.withGroup("not.deprecated").fromSource(type)); assertThat(metadata).has(Metadata.withGroup("not.deprecated").fromSource(type));
...@@ -239,7 +239,7 @@ public class ConfigurationMetadataAnnotationProcessorTests { ...@@ -239,7 +239,7 @@ public class ConfigurationMetadataAnnotationProcessorTests {
} }
@Test @Test
public void boxingOnSetter() throws IOException { public void boxingOnSetter() {
Class<?> type = BoxingPojo.class; Class<?> type = BoxingPojo.class;
ConfigurationMetadata metadata = compile(type); ConfigurationMetadata metadata = compile(type);
assertThat(metadata).has(Metadata.withGroup("boxing").fromSource(type)); assertThat(metadata).has(Metadata.withGroup("boxing").fromSource(type));
...@@ -250,7 +250,7 @@ public class ConfigurationMetadataAnnotationProcessorTests { ...@@ -250,7 +250,7 @@ public class ConfigurationMetadataAnnotationProcessorTests {
} }
@Test @Test
public void parseCollectionConfig() throws Exception { public void parseCollectionConfig() {
ConfigurationMetadata metadata = compile(SimpleCollectionProperties.class); ConfigurationMetadata metadata = compile(SimpleCollectionProperties.class);
// getter and setter // getter and setter
assertThat(metadata).has(Metadata.withProperty("collection.integers-to-names", assertThat(metadata).has(Metadata.withProperty("collection.integers-to-names",
...@@ -269,7 +269,7 @@ public class ConfigurationMetadataAnnotationProcessorTests { ...@@ -269,7 +269,7 @@ public class ConfigurationMetadataAnnotationProcessorTests {
} }
@Test @Test
public void simpleMethodConfig() throws Exception { public void simpleMethodConfig() {
ConfigurationMetadata metadata = compile(SimpleMethodConfig.class); ConfigurationMetadata metadata = compile(SimpleMethodConfig.class);
assertThat(metadata) assertThat(metadata)
.has(Metadata.withGroup("foo").fromSource(SimpleMethodConfig.class)); .has(Metadata.withGroup("foo").fromSource(SimpleMethodConfig.class));
...@@ -280,7 +280,7 @@ public class ConfigurationMetadataAnnotationProcessorTests { ...@@ -280,7 +280,7 @@ public class ConfigurationMetadataAnnotationProcessorTests {
} }
@Test @Test
public void invalidMethodConfig() throws Exception { public void invalidMethodConfig() {
ConfigurationMetadata metadata = compile(InvalidMethodConfig.class); ConfigurationMetadata metadata = compile(InvalidMethodConfig.class);
assertThat(metadata).has(Metadata.withProperty("something.name", String.class) assertThat(metadata).has(Metadata.withProperty("something.name", String.class)
.fromSource(InvalidMethodConfig.class)); .fromSource(InvalidMethodConfig.class));
...@@ -288,7 +288,7 @@ public class ConfigurationMetadataAnnotationProcessorTests { ...@@ -288,7 +288,7 @@ public class ConfigurationMetadataAnnotationProcessorTests {
} }
@Test @Test
public void methodAndClassConfig() throws Exception { public void methodAndClassConfig() {
ConfigurationMetadata metadata = compile(MethodAndClassConfig.class); ConfigurationMetadata metadata = compile(MethodAndClassConfig.class);
assertThat(metadata).has(Metadata.withProperty("conflict.name", String.class) assertThat(metadata).has(Metadata.withProperty("conflict.name", String.class)
.fromSource(MethodAndClassConfig.Foo.class)); .fromSource(MethodAndClassConfig.Foo.class));
...@@ -299,13 +299,13 @@ public class ConfigurationMetadataAnnotationProcessorTests { ...@@ -299,13 +299,13 @@ public class ConfigurationMetadataAnnotationProcessorTests {
} }
@Test @Test
public void emptyTypeMethodConfig() throws Exception { public void emptyTypeMethodConfig() {
ConfigurationMetadata metadata = compile(EmptyTypeMethodConfig.class); ConfigurationMetadata metadata = compile(EmptyTypeMethodConfig.class);
assertThat(metadata).isNotEqualTo(Metadata.withProperty("something.foo")); assertThat(metadata).isNotEqualTo(Metadata.withProperty("something.foo"));
} }
@Test @Test
public void deprecatedMethodConfig() throws Exception { public void deprecatedMethodConfig() {
Class<DeprecatedMethodConfig> type = DeprecatedMethodConfig.class; Class<DeprecatedMethodConfig> type = DeprecatedMethodConfig.class;
ConfigurationMetadata metadata = compile(type); ConfigurationMetadata metadata = compile(type);
assertThat(metadata).has(Metadata.withGroup("foo").fromSource(type)); assertThat(metadata).has(Metadata.withGroup("foo").fromSource(type));
...@@ -319,7 +319,7 @@ public class ConfigurationMetadataAnnotationProcessorTests { ...@@ -319,7 +319,7 @@ public class ConfigurationMetadataAnnotationProcessorTests {
@Test @Test
@SuppressWarnings("deprecation") @SuppressWarnings("deprecation")
public void deprecatedMethodConfigOnClass() throws Exception { public void deprecatedMethodConfigOnClass() {
Class<?> type = org.springframework.boot.configurationsample.method.DeprecatedClassMethodConfig.class; Class<?> type = org.springframework.boot.configurationsample.method.DeprecatedClassMethodConfig.class;
ConfigurationMetadata metadata = compile(type); ConfigurationMetadata metadata = compile(type);
assertThat(metadata).has(Metadata.withGroup("foo").fromSource(type)); assertThat(metadata).has(Metadata.withGroup("foo").fromSource(type));
...@@ -335,13 +335,13 @@ public class ConfigurationMetadataAnnotationProcessorTests { ...@@ -335,13 +335,13 @@ public class ConfigurationMetadataAnnotationProcessorTests {
} }
@Test @Test
public void innerClassRootConfig() throws Exception { public void innerClassRootConfig() {
ConfigurationMetadata metadata = compile(InnerClassRootConfig.class); ConfigurationMetadata metadata = compile(InnerClassRootConfig.class);
assertThat(metadata).has(Metadata.withProperty("config.name")); assertThat(metadata).has(Metadata.withProperty("config.name"));
} }
@Test @Test
public void innerClassProperties() throws Exception { public void innerClassProperties() {
ConfigurationMetadata metadata = compile(InnerClassProperties.class); ConfigurationMetadata metadata = compile(InnerClassProperties.class);
assertThat(metadata) assertThat(metadata)
.has(Metadata.withGroup("config").fromSource(InnerClassProperties.class)); .has(Metadata.withGroup("config").fromSource(InnerClassProperties.class));
...@@ -363,7 +363,7 @@ public class ConfigurationMetadataAnnotationProcessorTests { ...@@ -363,7 +363,7 @@ public class ConfigurationMetadataAnnotationProcessorTests {
} }
@Test @Test
public void innerClassPropertiesHierarchical() throws Exception { public void innerClassPropertiesHierarchical() {
ConfigurationMetadata metadata = compile(InnerClassHierarchicalProperties.class); ConfigurationMetadata metadata = compile(InnerClassHierarchicalProperties.class);
assertThat(metadata).has(Metadata.withGroup("config.foo") assertThat(metadata).has(Metadata.withGroup("config.foo")
.ofType(InnerClassHierarchicalProperties.Foo.class)); .ofType(InnerClassHierarchicalProperties.Foo.class));
...@@ -376,7 +376,7 @@ public class ConfigurationMetadataAnnotationProcessorTests { ...@@ -376,7 +376,7 @@ public class ConfigurationMetadataAnnotationProcessorTests {
} }
@Test @Test
public void innerClassAnnotatedGetterConfig() throws Exception { public void innerClassAnnotatedGetterConfig() {
ConfigurationMetadata metadata = compile(InnerClassAnnotatedGetterConfig.class); ConfigurationMetadata metadata = compile(InnerClassAnnotatedGetterConfig.class);
assertThat(metadata).has(Metadata.withProperty("specific.value")); assertThat(metadata).has(Metadata.withProperty("specific.value"));
assertThat(metadata).has(Metadata.withProperty("foo.name")); assertThat(metadata).has(Metadata.withProperty("foo.name"));
...@@ -384,7 +384,7 @@ public class ConfigurationMetadataAnnotationProcessorTests { ...@@ -384,7 +384,7 @@ public class ConfigurationMetadataAnnotationProcessorTests {
} }
@Test @Test
public void nestedClassChildProperties() throws Exception { public void nestedClassChildProperties() {
ConfigurationMetadata metadata = compile(ClassWithNestedProperties.class); ConfigurationMetadata metadata = compile(ClassWithNestedProperties.class);
assertThat(metadata).has(Metadata.withGroup("nestedChildProps") assertThat(metadata).has(Metadata.withGroup("nestedChildProps")
.fromSource(ClassWithNestedProperties.NestedChildClass.class)); .fromSource(ClassWithNestedProperties.NestedChildClass.class));
...@@ -403,13 +403,13 @@ public class ConfigurationMetadataAnnotationProcessorTests { ...@@ -403,13 +403,13 @@ public class ConfigurationMetadataAnnotationProcessorTests {
} }
@Test @Test
public void builderPojo() throws IOException { public void builderPojo() {
ConfigurationMetadata metadata = compile(BuilderPojo.class); ConfigurationMetadata metadata = compile(BuilderPojo.class);
assertThat(metadata).has(Metadata.withProperty("builder.name")); assertThat(metadata).has(Metadata.withProperty("builder.name"));
} }
@Test @Test
public void excludedTypesPojo() throws IOException { public void excludedTypesPojo() {
ConfigurationMetadata metadata = compile(ExcludedTypesPojo.class); ConfigurationMetadata metadata = compile(ExcludedTypesPojo.class);
assertThat(metadata).has(Metadata.withProperty("excluded.name")); assertThat(metadata).has(Metadata.withProperty("excluded.name"));
assertThat(metadata).isNotEqualTo(Metadata.withProperty("excluded.class-loader")); assertThat(metadata).isNotEqualTo(Metadata.withProperty("excluded.class-loader"));
...@@ -420,14 +420,14 @@ public class ConfigurationMetadataAnnotationProcessorTests { ...@@ -420,14 +420,14 @@ public class ConfigurationMetadataAnnotationProcessorTests {
} }
@Test @Test
public void invalidAccessor() throws IOException { public void invalidAccessor() {
ConfigurationMetadata metadata = compile(InvalidAccessorProperties.class); ConfigurationMetadata metadata = compile(InvalidAccessorProperties.class);
assertThat(metadata).has(Metadata.withGroup("config")); assertThat(metadata).has(Metadata.withGroup("config"));
assertThat(metadata.getItems()).hasSize(1); assertThat(metadata.getItems()).hasSize(1);
} }
@Test @Test
public void doubleRegistration() throws IOException { public void doubleRegistration() {
ConfigurationMetadata metadata = compile(DoubleRegistrationProperties.class); ConfigurationMetadata metadata = compile(DoubleRegistrationProperties.class);
assertThat(metadata).has(Metadata.withGroup("one")); assertThat(metadata).has(Metadata.withGroup("one"));
assertThat(metadata).has(Metadata.withGroup("two")); assertThat(metadata).has(Metadata.withGroup("two"));
...@@ -437,14 +437,14 @@ public class ConfigurationMetadataAnnotationProcessorTests { ...@@ -437,14 +437,14 @@ public class ConfigurationMetadataAnnotationProcessorTests {
} }
@Test @Test
public void invalidDoubleRegistration() throws IOException { public void invalidDoubleRegistration() {
this.thrown.expect(IllegalStateException.class); this.thrown.expect(IllegalStateException.class);
this.thrown.expectMessage("Compilation failed"); this.thrown.expectMessage("Compilation failed");
compile(InvalidDoubleRegistrationProperties.class); compile(InvalidDoubleRegistrationProperties.class);
} }
@Test @Test
public void genericTypes() throws IOException { public void genericTypes() {
ConfigurationMetadata metadata = compile(GenericConfig.class); ConfigurationMetadata metadata = compile(GenericConfig.class);
assertThat(metadata).has(Metadata.withGroup("generic").ofType( assertThat(metadata).has(Metadata.withGroup("generic").ofType(
"org.springframework.boot.configurationsample.specific.GenericConfig")); "org.springframework.boot.configurationsample.specific.GenericConfig"));
...@@ -470,26 +470,26 @@ public class ConfigurationMetadataAnnotationProcessorTests { ...@@ -470,26 +470,26 @@ public class ConfigurationMetadataAnnotationProcessorTests {
} }
@Test @Test
public void lombokDataProperties() throws Exception { public void lombokDataProperties() {
ConfigurationMetadata metadata = compile(LombokSimpleDataProperties.class); ConfigurationMetadata metadata = compile(LombokSimpleDataProperties.class);
assertSimpleLombokProperties(metadata, LombokSimpleDataProperties.class, "data"); assertSimpleLombokProperties(metadata, LombokSimpleDataProperties.class, "data");
} }
@Test @Test
public void lombokSimpleProperties() throws Exception { public void lombokSimpleProperties() {
ConfigurationMetadata metadata = compile(LombokSimpleProperties.class); ConfigurationMetadata metadata = compile(LombokSimpleProperties.class);
assertSimpleLombokProperties(metadata, LombokSimpleProperties.class, "simple"); assertSimpleLombokProperties(metadata, LombokSimpleProperties.class, "simple");
} }
@Test @Test
public void lombokExplicitProperties() throws Exception { public void lombokExplicitProperties() {
ConfigurationMetadata metadata = compile(LombokExplicitProperties.class); ConfigurationMetadata metadata = compile(LombokExplicitProperties.class);
assertSimpleLombokProperties(metadata, LombokExplicitProperties.class, assertSimpleLombokProperties(metadata, LombokExplicitProperties.class,
"explicit"); "explicit");
} }
@Test @Test
public void lombokInnerClassProperties() throws Exception { public void lombokInnerClassProperties() {
ConfigurationMetadata metadata = compile(LombokInnerClassProperties.class); ConfigurationMetadata metadata = compile(LombokInnerClassProperties.class);
assertThat(metadata).has(Metadata.withGroup("config") assertThat(metadata).has(Metadata.withGroup("config")
.fromSource(LombokInnerClassProperties.class)); .fromSource(LombokInnerClassProperties.class));
...@@ -517,7 +517,7 @@ public class ConfigurationMetadataAnnotationProcessorTests { ...@@ -517,7 +517,7 @@ public class ConfigurationMetadataAnnotationProcessorTests {
} }
@Test @Test
public void lombokInnerClassWithGetterProperties() throws IOException { public void lombokInnerClassWithGetterProperties() {
ConfigurationMetadata metadata = compile( ConfigurationMetadata metadata = compile(
LombokInnerClassWithGetterProperties.class); LombokInnerClassWithGetterProperties.class);
assertThat(metadata).has(Metadata.withGroup("config") assertThat(metadata).has(Metadata.withGroup("config")
...@@ -531,7 +531,7 @@ public class ConfigurationMetadataAnnotationProcessorTests { ...@@ -531,7 +531,7 @@ public class ConfigurationMetadataAnnotationProcessorTests {
} }
@Test @Test
public void simpleEndpoint() throws IOException { public void simpleEndpoint() {
ConfigurationMetadata metadata = compile(SimpleEndpoint.class); ConfigurationMetadata metadata = compile(SimpleEndpoint.class);
assertThat(metadata).has(Metadata.withGroup("management.endpoint.simple") assertThat(metadata).has(Metadata.withGroup("management.endpoint.simple")
.fromSource(SimpleEndpoint.class)); .fromSource(SimpleEndpoint.class));
...@@ -541,7 +541,7 @@ public class ConfigurationMetadataAnnotationProcessorTests { ...@@ -541,7 +541,7 @@ public class ConfigurationMetadataAnnotationProcessorTests {
} }
@Test @Test
public void disableEndpoint() throws IOException { public void disableEndpoint() {
ConfigurationMetadata metadata = compile(DisabledEndpoint.class); ConfigurationMetadata metadata = compile(DisabledEndpoint.class);
assertThat(metadata).has(Metadata.withGroup("management.endpoint.disabled") assertThat(metadata).has(Metadata.withGroup("management.endpoint.disabled")
.fromSource(DisabledEndpoint.class)); .fromSource(DisabledEndpoint.class));
...@@ -551,7 +551,7 @@ public class ConfigurationMetadataAnnotationProcessorTests { ...@@ -551,7 +551,7 @@ public class ConfigurationMetadataAnnotationProcessorTests {
} }
@Test @Test
public void enabledEndpoint() throws IOException { public void enabledEndpoint() {
ConfigurationMetadata metadata = compile(EnabledEndpoint.class); ConfigurationMetadata metadata = compile(EnabledEndpoint.class);
assertThat(metadata).has(Metadata.withGroup("management.endpoint.enabled") assertThat(metadata).has(Metadata.withGroup("management.endpoint.enabled")
.fromSource(EnabledEndpoint.class)); .fromSource(EnabledEndpoint.class));
...@@ -561,7 +561,7 @@ public class ConfigurationMetadataAnnotationProcessorTests { ...@@ -561,7 +561,7 @@ public class ConfigurationMetadataAnnotationProcessorTests {
} }
@Test @Test
public void customPropertiesEndpoint() throws IOException { public void customPropertiesEndpoint() {
ConfigurationMetadata metadata = compile(CustomPropertiesEndpoint.class); ConfigurationMetadata metadata = compile(CustomPropertiesEndpoint.class);
assertThat(metadata).has(Metadata.withGroup("management.endpoint.customprops") assertThat(metadata).has(Metadata.withGroup("management.endpoint.customprops")
.fromSource(CustomPropertiesEndpoint.class)); .fromSource(CustomPropertiesEndpoint.class));
...@@ -574,7 +574,7 @@ public class ConfigurationMetadataAnnotationProcessorTests { ...@@ -574,7 +574,7 @@ public class ConfigurationMetadataAnnotationProcessorTests {
} }
@Test @Test
public void specificEndpoint() throws IOException { public void specificEndpoint() {
ConfigurationMetadata metadata = compile(SpecificEndpoint.class); ConfigurationMetadata metadata = compile(SpecificEndpoint.class);
assertThat(metadata).has(Metadata.withGroup("management.endpoint.specific") assertThat(metadata).has(Metadata.withGroup("management.endpoint.specific")
.fromSource(SpecificEndpoint.class)); .fromSource(SpecificEndpoint.class));
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment