This commit is contained in:
Stephane Nicoll
2017-12-13 09:46:41 +01:00
parent fb7cc21d80
commit 7f2af8b209
4 changed files with 85 additions and 109 deletions

View File

@@ -39,41 +39,41 @@ import static org.assertj.core.api.Assertions.assertThat;
public class SpringBootContextLoaderTests {
@Test
public void environmentPropertiesSimple() throws Exception {
public void environmentPropertiesSimple() {
Map<String, Object> config = getEnvironmentProperties(SimpleConfig.class);
assertKey(config, "key", "myValue");
assertKey(config, "anotherKey", "anotherValue");
}
@Test
public void environmentPropertiesSimpleNonAlias() throws Exception {
public void environmentPropertiesSimpleNonAlias() {
Map<String, Object> config = getEnvironmentProperties(SimpleConfigNonAlias.class);
assertKey(config, "key", "myValue");
assertKey(config, "anotherKey", "anotherValue");
}
@Test
public void environmentPropertiesOverrideDefaults() throws Exception {
public void environmentPropertiesOverrideDefaults() {
Map<String, Object> config = getEnvironmentProperties(OverrideConfig.class);
assertKey(config, "server.port", "2345");
}
@Test
public void environmentPropertiesAppend() throws Exception {
public void environmentPropertiesAppend() {
Map<String, Object> config = getEnvironmentProperties(AppendConfig.class);
assertKey(config, "key", "myValue");
assertKey(config, "otherKey", "otherValue");
}
@Test
public void environmentPropertiesSeparatorInValue() throws Exception {
public void environmentPropertiesSeparatorInValue() {
Map<String, Object> config = getEnvironmentProperties(SameSeparatorInValue.class);
assertKey(config, "key", "my=Value");
assertKey(config, "anotherKey", "another:Value");
}
@Test
public void environmentPropertiesAnotherSeparatorInValue() throws Exception {
public void environmentPropertiesAnotherSeparatorInValue() {
Map<String, Object> config = getEnvironmentProperties(
AnotherSeparatorInValue.class);
assertKey(config, "key", "my:Value");
@@ -82,7 +82,7 @@ public class SpringBootContextLoaderTests {
@Test
@Ignore
public void environmentPropertiesNewLineInValue() throws Exception {
public void environmentPropertiesNewLineInValue() {
// gh-4384
Map<String, Object> config = getEnvironmentProperties(NewLineInValue.class);
assertKey(config, "key", "myValue");

View File

@@ -112,22 +112,22 @@ public class JsonContentAssertTests {
}
@Test
public void isEqualToWhenInputStreamIsMatchingShouldPass() throws Exception {
public void isEqualToWhenInputStreamIsMatchingShouldPass() {
assertThat(forJson(SOURCE)).isEqualTo(createInputStream(LENIENT_SAME));
}
@Test(expected = AssertionError.class)
public void isEqualToWhenInputStreamIsNotMatchingShouldFail() throws Exception {
public void isEqualToWhenInputStreamIsNotMatchingShouldFail() {
assertThat(forJson(SOURCE)).isEqualTo(createInputStream(DIFFERENT));
}
@Test
public void isEqualToWhenResourceIsMatchingShouldPass() throws Exception {
public void isEqualToWhenResourceIsMatchingShouldPass() {
assertThat(forJson(SOURCE)).isEqualTo(createResource(LENIENT_SAME));
}
@Test(expected = AssertionError.class)
public void isEqualToWhenResourceIsNotMatchingShouldFail() throws Exception {
public void isEqualToWhenResourceIsNotMatchingShouldFail() {
assertThat(forJson(SOURCE)).isEqualTo(createResource(DIFFERENT));
}
@@ -187,22 +187,22 @@ public class JsonContentAssertTests {
}
@Test
public void isEqualToJsonWhenInputStreamIsMatchingShouldPass() throws Exception {
public void isEqualToJsonWhenInputStreamIsMatchingShouldPass() {
assertThat(forJson(SOURCE)).isEqualToJson(createInputStream(LENIENT_SAME));
}
@Test(expected = AssertionError.class)
public void isEqualToJsonWhenInputStreamIsNotMatchingShouldFail() throws Exception {
public void isEqualToJsonWhenInputStreamIsNotMatchingShouldFail() {
assertThat(forJson(SOURCE)).isEqualToJson(createInputStream(DIFFERENT));
}
@Test
public void isEqualToJsonWhenResourceIsMatchingShouldPass() throws Exception {
public void isEqualToJsonWhenResourceIsMatchingShouldPass() {
assertThat(forJson(SOURCE)).isEqualToJson(createResource(LENIENT_SAME));
}
@Test(expected = AssertionError.class)
public void isEqualToJsonWhenResourceIsNotMatchingShouldFail() throws Exception {
public void isEqualToJsonWhenResourceIsNotMatchingShouldFail() {
assertThat(forJson(SOURCE)).isEqualToJson(createResource(DIFFERENT));
}
@@ -258,26 +258,23 @@ public class JsonContentAssertTests {
}
@Test
public void isStrictlyEqualToJsonWhenInputStreamIsMatchingShouldPass()
throws Exception {
public void isStrictlyEqualToJsonWhenInputStreamIsMatchingShouldPass() {
assertThat(forJson(SOURCE)).isStrictlyEqualToJson(createInputStream(SOURCE));
}
@Test(expected = AssertionError.class)
public void isStrictlyEqualToJsonWhenInputStreamIsNotMatchingShouldFail()
throws Exception {
public void isStrictlyEqualToJsonWhenInputStreamIsNotMatchingShouldFail() {
assertThat(forJson(SOURCE))
.isStrictlyEqualToJson(createInputStream(LENIENT_SAME));
}
@Test
public void isStrictlyEqualToJsonWhenResourceIsMatchingShouldPass() throws Exception {
public void isStrictlyEqualToJsonWhenResourceIsMatchingShouldPass() {
assertThat(forJson(SOURCE)).isStrictlyEqualToJson(createResource(SOURCE));
}
@Test(expected = AssertionError.class)
public void isStrictlyEqualToJsonWhenResourceIsNotMatchingShouldFail()
throws Exception {
public void isStrictlyEqualToJsonWhenResourceIsNotMatchingShouldFail() {
assertThat(forJson(SOURCE)).isStrictlyEqualToJson(createResource(LENIENT_SAME));
}
@@ -341,29 +338,25 @@ public class JsonContentAssertTests {
}
@Test
public void isEqualToJsonWhenInputStreamIsMatchingAndLenientShouldPass()
throws Exception {
public void isEqualToJsonWhenInputStreamIsMatchingAndLenientShouldPass() {
assertThat(forJson(SOURCE)).isEqualToJson(createInputStream(LENIENT_SAME),
JSONCompareMode.LENIENT);
}
@Test(expected = AssertionError.class)
public void isEqualToJsonWhenInputStreamIsNotMatchingAndLenientShouldFail()
throws Exception {
public void isEqualToJsonWhenInputStreamIsNotMatchingAndLenientShouldFail() {
assertThat(forJson(SOURCE)).isEqualToJson(createInputStream(DIFFERENT),
JSONCompareMode.LENIENT);
}
@Test
public void isEqualToJsonWhenResourceIsMatchingAndLenientShouldPass()
throws Exception {
public void isEqualToJsonWhenResourceIsMatchingAndLenientShouldPass() {
assertThat(forJson(SOURCE)).isEqualToJson(createResource(LENIENT_SAME),
JSONCompareMode.LENIENT);
}
@Test(expected = AssertionError.class)
public void isEqualToJsonWhenResourceIsNotMatchingAndLenientShouldFail()
throws Exception {
public void isEqualToJsonWhenResourceIsNotMatchingAndLenientShouldFail() {
assertThat(forJson(SOURCE)).isEqualToJson(createResource(DIFFERENT),
JSONCompareMode.LENIENT);
}
@@ -423,29 +416,25 @@ public class JsonContentAssertTests {
}
@Test
public void isEqualToJsonWhenInputStreamIsMatchingAndComparatorShouldPass()
throws Exception {
public void isEqualToJsonWhenInputStreamIsMatchingAndComparatorShouldPass() {
assertThat(forJson(SOURCE)).isEqualToJson(createInputStream(LENIENT_SAME),
COMPARATOR);
}
@Test(expected = AssertionError.class)
public void isEqualToJsonWhenInputStreamIsNotMatchingAndComparatorShouldFail()
throws Exception {
public void isEqualToJsonWhenInputStreamIsNotMatchingAndComparatorShouldFail() {
assertThat(forJson(SOURCE)).isEqualToJson(createInputStream(DIFFERENT),
COMPARATOR);
}
@Test
public void isEqualToJsonWhenResourceIsMatchingAndComparatorShouldPass()
throws Exception {
public void isEqualToJsonWhenResourceIsMatchingAndComparatorShouldPass() {
assertThat(forJson(SOURCE)).isEqualToJson(createResource(LENIENT_SAME),
COMPARATOR);
}
@Test(expected = AssertionError.class)
public void isEqualToJsonWhenResourceIsNotMatchingAndComparatorShouldFail()
throws Exception {
public void isEqualToJsonWhenResourceIsNotMatchingAndComparatorShouldFail() {
assertThat(forJson(SOURCE)).isEqualToJson(createResource(DIFFERENT), COMPARATOR);
}
@@ -495,22 +484,22 @@ public class JsonContentAssertTests {
}
@Test(expected = AssertionError.class)
public void isNotEqualToWhenInputStreamIsMatchingShouldFail() throws Exception {
public void isNotEqualToWhenInputStreamIsMatchingShouldFail() {
assertThat(forJson(SOURCE)).isNotEqualTo(createInputStream(LENIENT_SAME));
}
@Test
public void isNotEqualToWhenInputStreamIsNotMatchingShouldPass() throws Exception {
public void isNotEqualToWhenInputStreamIsNotMatchingShouldPass() {
assertThat(forJson(SOURCE)).isNotEqualTo(createInputStream(DIFFERENT));
}
@Test(expected = AssertionError.class)
public void isNotEqualToWhenResourceIsMatchingShouldFail() throws Exception {
public void isNotEqualToWhenResourceIsMatchingShouldFail() {
assertThat(forJson(SOURCE)).isNotEqualTo(createResource(LENIENT_SAME));
}
@Test
public void isNotEqualToWhenResourceIsNotMatchingShouldPass() throws Exception {
public void isNotEqualToWhenResourceIsNotMatchingShouldPass() {
assertThat(forJson(SOURCE)).isNotEqualTo(createResource(DIFFERENT));
}
@@ -570,23 +559,22 @@ public class JsonContentAssertTests {
}
@Test(expected = AssertionError.class)
public void isNotEqualToJsonWhenInputStreamIsMatchingShouldFail() throws Exception {
public void isNotEqualToJsonWhenInputStreamIsMatchingShouldFail() {
assertThat(forJson(SOURCE)).isNotEqualToJson(createInputStream(LENIENT_SAME));
}
@Test
public void isNotEqualToJsonWhenInputStreamIsNotMatchingShouldPass()
throws Exception {
public void isNotEqualToJsonWhenInputStreamIsNotMatchingShouldPass() {
assertThat(forJson(SOURCE)).isNotEqualToJson(createInputStream(DIFFERENT));
}
@Test(expected = AssertionError.class)
public void isNotEqualToJsonWhenResourceIsMatchingShouldFail() throws Exception {
public void isNotEqualToJsonWhenResourceIsMatchingShouldFail() {
assertThat(forJson(SOURCE)).isNotEqualToJson(createResource(LENIENT_SAME));
}
@Test
public void isNotEqualToJsonWhenResourceIsNotMatchingShouldPass() throws Exception {
public void isNotEqualToJsonWhenResourceIsNotMatchingShouldPass() {
assertThat(forJson(SOURCE)).isNotEqualToJson(createResource(DIFFERENT));
}
@@ -643,27 +631,23 @@ public class JsonContentAssertTests {
}
@Test(expected = AssertionError.class)
public void isNotStrictlyEqualToJsonWhenInputStreamIsMatchingShouldFail()
throws Exception {
public void isNotStrictlyEqualToJsonWhenInputStreamIsMatchingShouldFail() {
assertThat(forJson(SOURCE)).isNotStrictlyEqualToJson(createInputStream(SOURCE));
}
@Test
public void isNotStrictlyEqualToJsonWhenInputStreamIsNotMatchingShouldPass()
throws Exception {
public void isNotStrictlyEqualToJsonWhenInputStreamIsNotMatchingShouldPass() {
assertThat(forJson(SOURCE))
.isNotStrictlyEqualToJson(createInputStream(LENIENT_SAME));
}
@Test(expected = AssertionError.class)
public void isNotStrictlyEqualToJsonWhenResourceIsMatchingShouldFail()
throws Exception {
public void isNotStrictlyEqualToJsonWhenResourceIsMatchingShouldFail() {
assertThat(forJson(SOURCE)).isNotStrictlyEqualToJson(createResource(SOURCE));
}
@Test
public void isNotStrictlyEqualToJsonWhenResourceIsNotMatchingShouldPass()
throws Exception {
public void isNotStrictlyEqualToJsonWhenResourceIsNotMatchingShouldPass() {
assertThat(forJson(SOURCE))
.isNotStrictlyEqualToJson(createResource(LENIENT_SAME));
}
@@ -730,29 +714,25 @@ public class JsonContentAssertTests {
}
@Test(expected = AssertionError.class)
public void isNotEqualToJsonWhenInputStreamIsMatchingAndLenientShouldFail()
throws Exception {
public void isNotEqualToJsonWhenInputStreamIsMatchingAndLenientShouldFail() {
assertThat(forJson(SOURCE)).isNotEqualToJson(createInputStream(LENIENT_SAME),
JSONCompareMode.LENIENT);
}
@Test
public void isNotEqualToJsonWhenInputStreamIsNotMatchingAndLenientShouldPass()
throws Exception {
public void isNotEqualToJsonWhenInputStreamIsNotMatchingAndLenientShouldPass() {
assertThat(forJson(SOURCE)).isNotEqualToJson(createInputStream(DIFFERENT),
JSONCompareMode.LENIENT);
}
@Test(expected = AssertionError.class)
public void isNotEqualToJsonWhenResourceIsMatchingAndLenientShouldFail()
throws Exception {
public void isNotEqualToJsonWhenResourceIsMatchingAndLenientShouldFail() {
assertThat(forJson(SOURCE)).isNotEqualToJson(createResource(LENIENT_SAME),
JSONCompareMode.LENIENT);
}
@Test
public void isNotEqualToJsonWhenResourceIsNotMatchingAndLenientShouldPass()
throws Exception {
public void isNotEqualToJsonWhenResourceIsNotMatchingAndLenientShouldPass() {
assertThat(forJson(SOURCE)).isNotEqualToJson(createResource(DIFFERENT),
JSONCompareMode.LENIENT);
}
@@ -813,29 +793,25 @@ public class JsonContentAssertTests {
}
@Test(expected = AssertionError.class)
public void isNotEqualToJsonWhenInputStreamIsMatchingAndComparatorShouldFail()
throws Exception {
public void isNotEqualToJsonWhenInputStreamIsMatchingAndComparatorShouldFail() {
assertThat(forJson(SOURCE)).isNotEqualToJson(createInputStream(LENIENT_SAME),
COMPARATOR);
}
@Test
public void isNotEqualToJsonWhenInputStreamIsNotMatchingAndComparatorShouldPass()
throws Exception {
public void isNotEqualToJsonWhenInputStreamIsNotMatchingAndComparatorShouldPass() {
assertThat(forJson(SOURCE)).isNotEqualToJson(createInputStream(DIFFERENT),
COMPARATOR);
}
@Test(expected = AssertionError.class)
public void isNotEqualToJsonWhenResourceIsMatchingAndComparatorShouldFail()
throws Exception {
public void isNotEqualToJsonWhenResourceIsMatchingAndComparatorShouldFail() {
assertThat(forJson(SOURCE)).isNotEqualToJson(createResource(LENIENT_SAME),
COMPARATOR);
}
@Test
public void isNotEqualToJsonWhenResourceIsNotMatchingAndComparatorShouldPass()
throws Exception {
public void isNotEqualToJsonWhenResourceIsNotMatchingAndComparatorShouldPass() {
assertThat(forJson(SOURCE)).isNotEqualToJson(createResource(DIFFERENT),
COMPARATOR);
}

View File

@@ -48,7 +48,7 @@ public class MockBeanForBeanFactoryIntegrationTests {
@Test
@SuppressWarnings({ "unchecked", "rawtypes" })
public void testName() throws Exception {
public void testName() {
TestBean testBean = mock(TestBean.class);
given(testBean.hello()).willReturn("amock");
given(this.testFactoryBean.getObjectType()).willReturn((Class) TestBean.class);

View File

@@ -107,13 +107,13 @@ public class ConfigurationMetadataAnnotationProcessorTests {
}
@Test
public void notAnnotated() throws Exception {
public void notAnnotated() {
ConfigurationMetadata metadata = compile(NotAnnotated.class);
assertThat(metadata.getItems()).isEmpty();
}
@Test
public void simpleProperties() throws Exception {
public void simpleProperties() {
ConfigurationMetadata metadata = compile(SimpleProperties.class);
assertThat(metadata)
.has(Metadata.withGroup("simple").fromSource(SimpleProperties.class));
@@ -130,7 +130,7 @@ public class ConfigurationMetadataAnnotationProcessorTests {
}
@Test
public void simplePrefixValueProperties() throws Exception {
public void simplePrefixValueProperties() {
ConfigurationMetadata metadata = compile(SimplePrefixValueProperties.class);
assertThat(metadata).has(Metadata.withGroup("simple")
.fromSource(SimplePrefixValueProperties.class));
@@ -139,7 +139,7 @@ public class ConfigurationMetadataAnnotationProcessorTests {
}
@Test
public void simpleTypeProperties() throws Exception {
public void simpleTypeProperties() {
ConfigurationMetadata metadata = compile(SimpleTypeProperties.class);
assertThat(metadata).has(
Metadata.withGroup("simple.type").fromSource(SimpleTypeProperties.class));
@@ -186,7 +186,7 @@ public class ConfigurationMetadataAnnotationProcessorTests {
}
@Test
public void hierarchicalProperties() throws Exception {
public void hierarchicalProperties() {
ConfigurationMetadata metadata = compile(HierarchicalProperties.class);
assertThat(metadata).has(Metadata.withGroup("hierarchical")
.fromSource(HierarchicalProperties.class));
@@ -201,7 +201,7 @@ public class ConfigurationMetadataAnnotationProcessorTests {
@Test
@SuppressWarnings("deprecation")
public void deprecatedProperties() throws Exception {
public void deprecatedProperties() {
Class<?> type = org.springframework.boot.configurationsample.simple.DeprecatedProperties.class;
ConfigurationMetadata metadata = compile(type);
assertThat(metadata).has(Metadata.withGroup("deprecated").fromSource(type));
@@ -213,7 +213,7 @@ public class ConfigurationMetadataAnnotationProcessorTests {
}
@Test
public void singleDeprecatedProperty() throws Exception {
public void singleDeprecatedProperty() {
Class<?> type = DeprecatedSingleProperty.class;
ConfigurationMetadata metadata = compile(type);
assertThat(metadata).has(Metadata.withGroup("singledeprecated").fromSource(type));
@@ -226,7 +226,7 @@ public class ConfigurationMetadataAnnotationProcessorTests {
}
@Test
public void deprecatedOnUnrelatedSetter() throws Exception {
public void deprecatedOnUnrelatedSetter() {
Class<?> type = DeprecatedUnrelatedMethodPojo.class;
ConfigurationMetadata metadata = compile(type);
assertThat(metadata).has(Metadata.withGroup("not.deprecated").fromSource(type));
@@ -239,7 +239,7 @@ public class ConfigurationMetadataAnnotationProcessorTests {
}
@Test
public void boxingOnSetter() throws IOException {
public void boxingOnSetter() {
Class<?> type = BoxingPojo.class;
ConfigurationMetadata metadata = compile(type);
assertThat(metadata).has(Metadata.withGroup("boxing").fromSource(type));
@@ -250,7 +250,7 @@ public class ConfigurationMetadataAnnotationProcessorTests {
}
@Test
public void parseCollectionConfig() throws Exception {
public void parseCollectionConfig() {
ConfigurationMetadata metadata = compile(SimpleCollectionProperties.class);
// getter and setter
assertThat(metadata).has(Metadata.withProperty("collection.integers-to-names",
@@ -269,7 +269,7 @@ public class ConfigurationMetadataAnnotationProcessorTests {
}
@Test
public void simpleMethodConfig() throws Exception {
public void simpleMethodConfig() {
ConfigurationMetadata metadata = compile(SimpleMethodConfig.class);
assertThat(metadata)
.has(Metadata.withGroup("foo").fromSource(SimpleMethodConfig.class));
@@ -280,7 +280,7 @@ public class ConfigurationMetadataAnnotationProcessorTests {
}
@Test
public void invalidMethodConfig() throws Exception {
public void invalidMethodConfig() {
ConfigurationMetadata metadata = compile(InvalidMethodConfig.class);
assertThat(metadata).has(Metadata.withProperty("something.name", String.class)
.fromSource(InvalidMethodConfig.class));
@@ -288,7 +288,7 @@ public class ConfigurationMetadataAnnotationProcessorTests {
}
@Test
public void methodAndClassConfig() throws Exception {
public void methodAndClassConfig() {
ConfigurationMetadata metadata = compile(MethodAndClassConfig.class);
assertThat(metadata).has(Metadata.withProperty("conflict.name", String.class)
.fromSource(MethodAndClassConfig.Foo.class));
@@ -299,13 +299,13 @@ public class ConfigurationMetadataAnnotationProcessorTests {
}
@Test
public void emptyTypeMethodConfig() throws Exception {
public void emptyTypeMethodConfig() {
ConfigurationMetadata metadata = compile(EmptyTypeMethodConfig.class);
assertThat(metadata).isNotEqualTo(Metadata.withProperty("something.foo"));
}
@Test
public void deprecatedMethodConfig() throws Exception {
public void deprecatedMethodConfig() {
Class<DeprecatedMethodConfig> type = DeprecatedMethodConfig.class;
ConfigurationMetadata metadata = compile(type);
assertThat(metadata).has(Metadata.withGroup("foo").fromSource(type));
@@ -319,7 +319,7 @@ public class ConfigurationMetadataAnnotationProcessorTests {
@Test
@SuppressWarnings("deprecation")
public void deprecatedMethodConfigOnClass() throws Exception {
public void deprecatedMethodConfigOnClass() {
Class<?> type = org.springframework.boot.configurationsample.method.DeprecatedClassMethodConfig.class;
ConfigurationMetadata metadata = compile(type);
assertThat(metadata).has(Metadata.withGroup("foo").fromSource(type));
@@ -335,13 +335,13 @@ public class ConfigurationMetadataAnnotationProcessorTests {
}
@Test
public void innerClassRootConfig() throws Exception {
public void innerClassRootConfig() {
ConfigurationMetadata metadata = compile(InnerClassRootConfig.class);
assertThat(metadata).has(Metadata.withProperty("config.name"));
}
@Test
public void innerClassProperties() throws Exception {
public void innerClassProperties() {
ConfigurationMetadata metadata = compile(InnerClassProperties.class);
assertThat(metadata)
.has(Metadata.withGroup("config").fromSource(InnerClassProperties.class));
@@ -363,7 +363,7 @@ public class ConfigurationMetadataAnnotationProcessorTests {
}
@Test
public void innerClassPropertiesHierarchical() throws Exception {
public void innerClassPropertiesHierarchical() {
ConfigurationMetadata metadata = compile(InnerClassHierarchicalProperties.class);
assertThat(metadata).has(Metadata.withGroup("config.foo")
.ofType(InnerClassHierarchicalProperties.Foo.class));
@@ -376,7 +376,7 @@ public class ConfigurationMetadataAnnotationProcessorTests {
}
@Test
public void innerClassAnnotatedGetterConfig() throws Exception {
public void innerClassAnnotatedGetterConfig() {
ConfigurationMetadata metadata = compile(InnerClassAnnotatedGetterConfig.class);
assertThat(metadata).has(Metadata.withProperty("specific.value"));
assertThat(metadata).has(Metadata.withProperty("foo.name"));
@@ -384,7 +384,7 @@ public class ConfigurationMetadataAnnotationProcessorTests {
}
@Test
public void nestedClassChildProperties() throws Exception {
public void nestedClassChildProperties() {
ConfigurationMetadata metadata = compile(ClassWithNestedProperties.class);
assertThat(metadata).has(Metadata.withGroup("nestedChildProps")
.fromSource(ClassWithNestedProperties.NestedChildClass.class));
@@ -403,13 +403,13 @@ public class ConfigurationMetadataAnnotationProcessorTests {
}
@Test
public void builderPojo() throws IOException {
public void builderPojo() {
ConfigurationMetadata metadata = compile(BuilderPojo.class);
assertThat(metadata).has(Metadata.withProperty("builder.name"));
}
@Test
public void excludedTypesPojo() throws IOException {
public void excludedTypesPojo() {
ConfigurationMetadata metadata = compile(ExcludedTypesPojo.class);
assertThat(metadata).has(Metadata.withProperty("excluded.name"));
assertThat(metadata).isNotEqualTo(Metadata.withProperty("excluded.class-loader"));
@@ -420,14 +420,14 @@ public class ConfigurationMetadataAnnotationProcessorTests {
}
@Test
public void invalidAccessor() throws IOException {
public void invalidAccessor() {
ConfigurationMetadata metadata = compile(InvalidAccessorProperties.class);
assertThat(metadata).has(Metadata.withGroup("config"));
assertThat(metadata.getItems()).hasSize(1);
}
@Test
public void doubleRegistration() throws IOException {
public void doubleRegistration() {
ConfigurationMetadata metadata = compile(DoubleRegistrationProperties.class);
assertThat(metadata).has(Metadata.withGroup("one"));
assertThat(metadata).has(Metadata.withGroup("two"));
@@ -437,14 +437,14 @@ public class ConfigurationMetadataAnnotationProcessorTests {
}
@Test
public void invalidDoubleRegistration() throws IOException {
public void invalidDoubleRegistration() {
this.thrown.expect(IllegalStateException.class);
this.thrown.expectMessage("Compilation failed");
compile(InvalidDoubleRegistrationProperties.class);
}
@Test
public void genericTypes() throws IOException {
public void genericTypes() {
ConfigurationMetadata metadata = compile(GenericConfig.class);
assertThat(metadata).has(Metadata.withGroup("generic").ofType(
"org.springframework.boot.configurationsample.specific.GenericConfig"));
@@ -470,26 +470,26 @@ public class ConfigurationMetadataAnnotationProcessorTests {
}
@Test
public void lombokDataProperties() throws Exception {
public void lombokDataProperties() {
ConfigurationMetadata metadata = compile(LombokSimpleDataProperties.class);
assertSimpleLombokProperties(metadata, LombokSimpleDataProperties.class, "data");
}
@Test
public void lombokSimpleProperties() throws Exception {
public void lombokSimpleProperties() {
ConfigurationMetadata metadata = compile(LombokSimpleProperties.class);
assertSimpleLombokProperties(metadata, LombokSimpleProperties.class, "simple");
}
@Test
public void lombokExplicitProperties() throws Exception {
public void lombokExplicitProperties() {
ConfigurationMetadata metadata = compile(LombokExplicitProperties.class);
assertSimpleLombokProperties(metadata, LombokExplicitProperties.class,
"explicit");
}
@Test
public void lombokInnerClassProperties() throws Exception {
public void lombokInnerClassProperties() {
ConfigurationMetadata metadata = compile(LombokInnerClassProperties.class);
assertThat(metadata).has(Metadata.withGroup("config")
.fromSource(LombokInnerClassProperties.class));
@@ -517,7 +517,7 @@ public class ConfigurationMetadataAnnotationProcessorTests {
}
@Test
public void lombokInnerClassWithGetterProperties() throws IOException {
public void lombokInnerClassWithGetterProperties() {
ConfigurationMetadata metadata = compile(
LombokInnerClassWithGetterProperties.class);
assertThat(metadata).has(Metadata.withGroup("config")
@@ -531,7 +531,7 @@ public class ConfigurationMetadataAnnotationProcessorTests {
}
@Test
public void simpleEndpoint() throws IOException {
public void simpleEndpoint() {
ConfigurationMetadata metadata = compile(SimpleEndpoint.class);
assertThat(metadata).has(Metadata.withGroup("management.endpoint.simple")
.fromSource(SimpleEndpoint.class));
@@ -541,7 +541,7 @@ public class ConfigurationMetadataAnnotationProcessorTests {
}
@Test
public void disableEndpoint() throws IOException {
public void disableEndpoint() {
ConfigurationMetadata metadata = compile(DisabledEndpoint.class);
assertThat(metadata).has(Metadata.withGroup("management.endpoint.disabled")
.fromSource(DisabledEndpoint.class));
@@ -551,7 +551,7 @@ public class ConfigurationMetadataAnnotationProcessorTests {
}
@Test
public void enabledEndpoint() throws IOException {
public void enabledEndpoint() {
ConfigurationMetadata metadata = compile(EnabledEndpoint.class);
assertThat(metadata).has(Metadata.withGroup("management.endpoint.enabled")
.fromSource(EnabledEndpoint.class));
@@ -561,7 +561,7 @@ public class ConfigurationMetadataAnnotationProcessorTests {
}
@Test
public void customPropertiesEndpoint() throws IOException {
public void customPropertiesEndpoint() {
ConfigurationMetadata metadata = compile(CustomPropertiesEndpoint.class);
assertThat(metadata).has(Metadata.withGroup("management.endpoint.customprops")
.fromSource(CustomPropertiesEndpoint.class));
@@ -574,7 +574,7 @@ public class ConfigurationMetadataAnnotationProcessorTests {
}
@Test
public void specificEndpoint() throws IOException {
public void specificEndpoint() {
ConfigurationMetadata metadata = compile(SpecificEndpoint.class);
assertThat(metadata).has(Metadata.withGroup("management.endpoint.specific")
.fromSource(SpecificEndpoint.class));