Move tests to JUnit 5 wherever possible
This commit is contained in:
@@ -16,11 +16,11 @@
|
||||
|
||||
package org.springframework.boot.configurationprocessor;
|
||||
|
||||
import java.io.File;
|
||||
import java.io.IOException;
|
||||
|
||||
import org.junit.Before;
|
||||
import org.junit.Rule;
|
||||
import org.junit.rules.TemporaryFolder;
|
||||
import org.junit.jupiter.api.BeforeEach;
|
||||
import org.junit.jupiter.api.io.TempDir;
|
||||
|
||||
import org.springframework.boot.configurationprocessor.metadata.ConfigurationMetadata;
|
||||
import org.springframework.boot.configurationprocessor.test.TestConfigurationMetadataAnnotationProcessor;
|
||||
@@ -33,14 +33,14 @@ import org.springframework.boot.testsupport.compiler.TestCompiler;
|
||||
*/
|
||||
public abstract class AbstractMetadataGenerationTests {
|
||||
|
||||
@Rule
|
||||
public TemporaryFolder temporaryFolder = new TemporaryFolder();
|
||||
@TempDir
|
||||
File tempDir;
|
||||
|
||||
private TestCompiler compiler;
|
||||
|
||||
@Before
|
||||
@BeforeEach
|
||||
public void createCompiler() throws IOException {
|
||||
this.compiler = new TestCompiler(this.temporaryFolder);
|
||||
this.compiler = new TestCompiler(this.tempDir);
|
||||
}
|
||||
|
||||
protected TestCompiler getCompiler() {
|
||||
|
||||
@@ -16,7 +16,7 @@
|
||||
|
||||
package org.springframework.boot.configurationprocessor;
|
||||
|
||||
import org.junit.Test;
|
||||
import org.junit.jupiter.api.Test;
|
||||
|
||||
import org.springframework.boot.configurationprocessor.metadata.ConfigurationMetadata;
|
||||
import org.springframework.boot.configurationprocessor.metadata.Metadata;
|
||||
@@ -62,16 +62,16 @@ import static org.assertj.core.api.Assertions.assertThatIllegalStateException;
|
||||
* @author Kris De Volder
|
||||
* @author Jonas Keßler
|
||||
*/
|
||||
public class ConfigurationMetadataAnnotationProcessorTests extends AbstractMetadataGenerationTests {
|
||||
class ConfigurationMetadataAnnotationProcessorTests extends AbstractMetadataGenerationTests {
|
||||
|
||||
@Test
|
||||
public void notAnnotated() {
|
||||
void notAnnotated() {
|
||||
ConfigurationMetadata metadata = compile(NotAnnotated.class);
|
||||
assertThat(metadata.getItems()).isEmpty();
|
||||
}
|
||||
|
||||
@Test
|
||||
public void simpleProperties() {
|
||||
void simpleProperties() {
|
||||
ConfigurationMetadata metadata = compile(SimpleProperties.class);
|
||||
assertThat(metadata).has(Metadata.withGroup("simple").fromSource(SimpleProperties.class));
|
||||
assertThat(metadata).has(Metadata.withProperty("simple.the-name", String.class)
|
||||
@@ -85,7 +85,7 @@ public class ConfigurationMetadataAnnotationProcessorTests extends AbstractMetad
|
||||
}
|
||||
|
||||
@Test
|
||||
public void simplePrefixValueProperties() {
|
||||
void simplePrefixValueProperties() {
|
||||
ConfigurationMetadata metadata = compile(SimplePrefixValueProperties.class);
|
||||
assertThat(metadata).has(Metadata.withGroup("simple").fromSource(SimplePrefixValueProperties.class));
|
||||
assertThat(metadata)
|
||||
@@ -93,7 +93,7 @@ public class ConfigurationMetadataAnnotationProcessorTests extends AbstractMetad
|
||||
}
|
||||
|
||||
@Test
|
||||
public void simpleTypeProperties() {
|
||||
void simpleTypeProperties() {
|
||||
ConfigurationMetadata metadata = compile(SimpleTypeProperties.class);
|
||||
assertThat(metadata).has(Metadata.withGroup("simple.type").fromSource(SimpleTypeProperties.class));
|
||||
assertThat(metadata).has(Metadata.withProperty("simple.type.my-string", String.class));
|
||||
@@ -122,7 +122,7 @@ public class ConfigurationMetadataAnnotationProcessorTests extends AbstractMetad
|
||||
}
|
||||
|
||||
@Test
|
||||
public void hierarchicalProperties() {
|
||||
void hierarchicalProperties() {
|
||||
ConfigurationMetadata metadata = compile(HierarchicalProperties.class, HierarchicalPropertiesParent.class,
|
||||
HierarchicalPropertiesGrandparent.class);
|
||||
assertThat(metadata).has(Metadata.withGroup("hierarchical").fromSource(HierarchicalProperties.class));
|
||||
@@ -135,7 +135,7 @@ public class ConfigurationMetadataAnnotationProcessorTests extends AbstractMetad
|
||||
}
|
||||
|
||||
@Test
|
||||
public void descriptionProperties() {
|
||||
void descriptionProperties() {
|
||||
ConfigurationMetadata metadata = compile(DescriptionProperties.class);
|
||||
assertThat(metadata).has(Metadata.withGroup("description").fromSource(DescriptionProperties.class));
|
||||
assertThat(metadata).has(Metadata.withProperty("description.simple", String.class)
|
||||
@@ -147,7 +147,7 @@ public class ConfigurationMetadataAnnotationProcessorTests extends AbstractMetad
|
||||
|
||||
@Test
|
||||
@SuppressWarnings("deprecation")
|
||||
public void deprecatedProperties() {
|
||||
void deprecatedProperties() {
|
||||
Class<?> type = org.springframework.boot.configurationsample.simple.DeprecatedProperties.class;
|
||||
ConfigurationMetadata metadata = compile(type);
|
||||
assertThat(metadata).has(Metadata.withGroup("deprecated").fromSource(type));
|
||||
@@ -158,7 +158,7 @@ public class ConfigurationMetadataAnnotationProcessorTests extends AbstractMetad
|
||||
}
|
||||
|
||||
@Test
|
||||
public void singleDeprecatedProperty() {
|
||||
void singleDeprecatedProperty() {
|
||||
Class<?> type = DeprecatedSingleProperty.class;
|
||||
ConfigurationMetadata metadata = compile(type);
|
||||
assertThat(metadata).has(Metadata.withGroup("singledeprecated").fromSource(type));
|
||||
@@ -168,7 +168,7 @@ public class ConfigurationMetadataAnnotationProcessorTests extends AbstractMetad
|
||||
}
|
||||
|
||||
@Test
|
||||
public void deprecatedOnUnrelatedSetter() {
|
||||
void deprecatedOnUnrelatedSetter() {
|
||||
Class<?> type = DeprecatedUnrelatedMethodPojo.class;
|
||||
ConfigurationMetadata metadata = compile(type);
|
||||
assertThat(metadata).has(Metadata.withGroup("not.deprecated").fromSource(type));
|
||||
@@ -179,7 +179,7 @@ public class ConfigurationMetadataAnnotationProcessorTests extends AbstractMetad
|
||||
}
|
||||
|
||||
@Test
|
||||
public void boxingOnSetter() {
|
||||
void boxingOnSetter() {
|
||||
Class<?> type = BoxingPojo.class;
|
||||
ConfigurationMetadata metadata = compile(type);
|
||||
assertThat(metadata).has(Metadata.withGroup("boxing").fromSource(type));
|
||||
@@ -189,7 +189,7 @@ public class ConfigurationMetadataAnnotationProcessorTests extends AbstractMetad
|
||||
}
|
||||
|
||||
@Test
|
||||
public void parseCollectionConfig() {
|
||||
void parseCollectionConfig() {
|
||||
ConfigurationMetadata metadata = compile(SimpleCollectionProperties.class);
|
||||
// getter and setter
|
||||
assertThat(metadata).has(Metadata.withProperty("collection.integers-to-names",
|
||||
@@ -206,7 +206,7 @@ public class ConfigurationMetadataAnnotationProcessorTests extends AbstractMetad
|
||||
}
|
||||
|
||||
@Test
|
||||
public void parseArrayConfig() throws Exception {
|
||||
void parseArrayConfig() throws Exception {
|
||||
ConfigurationMetadata metadata = compile(SimpleArrayProperties.class);
|
||||
assertThat(metadata).has(Metadata.withGroup("array").ofType(SimpleArrayProperties.class));
|
||||
assertThat(metadata).has(Metadata.withProperty("array.primitive", "java.lang.Integer[]"));
|
||||
@@ -219,7 +219,7 @@ public class ConfigurationMetadataAnnotationProcessorTests extends AbstractMetad
|
||||
}
|
||||
|
||||
@Test
|
||||
public void annotatedGetter() {
|
||||
void annotatedGetter() {
|
||||
ConfigurationMetadata metadata = compile(AnnotatedGetter.class);
|
||||
assertThat(metadata).has(Metadata.withGroup("specific").fromSource(AnnotatedGetter.class));
|
||||
assertThat(metadata)
|
||||
@@ -227,7 +227,7 @@ public class ConfigurationMetadataAnnotationProcessorTests extends AbstractMetad
|
||||
}
|
||||
|
||||
@Test
|
||||
public void staticAccessor() {
|
||||
void staticAccessor() {
|
||||
ConfigurationMetadata metadata = compile(StaticAccessor.class);
|
||||
assertThat(metadata).has(Metadata.withGroup("specific").fromSource(StaticAccessor.class));
|
||||
assertThat(metadata).has(Metadata.withProperty("specific.counter", Integer.class)
|
||||
@@ -238,13 +238,13 @@ public class ConfigurationMetadataAnnotationProcessorTests extends AbstractMetad
|
||||
}
|
||||
|
||||
@Test
|
||||
public void innerClassRootConfig() {
|
||||
void innerClassRootConfig() {
|
||||
ConfigurationMetadata metadata = compile(InnerClassRootConfig.class);
|
||||
assertThat(metadata).has(Metadata.withProperty("config.name"));
|
||||
}
|
||||
|
||||
@Test
|
||||
public void innerClassProperties() {
|
||||
void innerClassProperties() {
|
||||
ConfigurationMetadata metadata = compile(InnerClassProperties.class);
|
||||
assertThat(metadata).has(Metadata.withGroup("config").fromSource(InnerClassProperties.class));
|
||||
assertThat(metadata).has(Metadata.withGroup("config.first").ofType(InnerClassProperties.Foo.class)
|
||||
@@ -263,7 +263,7 @@ public class ConfigurationMetadataAnnotationProcessorTests extends AbstractMetad
|
||||
}
|
||||
|
||||
@Test
|
||||
public void innerClassPropertiesHierarchical() {
|
||||
void innerClassPropertiesHierarchical() {
|
||||
ConfigurationMetadata metadata = compile(InnerClassHierarchicalProperties.class);
|
||||
assertThat(metadata).has(Metadata.withGroup("config.foo").ofType(InnerClassHierarchicalProperties.Foo.class));
|
||||
assertThat(metadata)
|
||||
@@ -275,7 +275,7 @@ public class ConfigurationMetadataAnnotationProcessorTests extends AbstractMetad
|
||||
}
|
||||
|
||||
@Test
|
||||
public void innerClassAnnotatedGetterConfig() {
|
||||
void innerClassAnnotatedGetterConfig() {
|
||||
ConfigurationMetadata metadata = compile(InnerClassAnnotatedGetterConfig.class);
|
||||
assertThat(metadata).has(Metadata.withProperty("specific.value"));
|
||||
assertThat(metadata).has(Metadata.withProperty("foo.name"));
|
||||
@@ -283,7 +283,7 @@ public class ConfigurationMetadataAnnotationProcessorTests extends AbstractMetad
|
||||
}
|
||||
|
||||
@Test
|
||||
public void nestedClassChildProperties() {
|
||||
void nestedClassChildProperties() {
|
||||
ConfigurationMetadata metadata = compile(ClassWithNestedProperties.class);
|
||||
assertThat(metadata).has(
|
||||
Metadata.withGroup("nestedChildProps").fromSource(ClassWithNestedProperties.NestedChildClass.class));
|
||||
@@ -294,13 +294,13 @@ public class ConfigurationMetadataAnnotationProcessorTests extends AbstractMetad
|
||||
}
|
||||
|
||||
@Test
|
||||
public void builderPojo() {
|
||||
void builderPojo() {
|
||||
ConfigurationMetadata metadata = compile(BuilderPojo.class);
|
||||
assertThat(metadata).has(Metadata.withProperty("builder.name"));
|
||||
}
|
||||
|
||||
@Test
|
||||
public void excludedTypesPojo() {
|
||||
void excludedTypesPojo() {
|
||||
ConfigurationMetadata metadata = compile(ExcludedTypesPojo.class);
|
||||
assertThat(metadata).has(Metadata.withProperty("excluded.name"));
|
||||
assertThat(metadata).isNotEqualTo(Metadata.withProperty("excluded.class-loader"));
|
||||
@@ -311,14 +311,14 @@ public class ConfigurationMetadataAnnotationProcessorTests extends AbstractMetad
|
||||
}
|
||||
|
||||
@Test
|
||||
public void invalidAccessor() {
|
||||
void invalidAccessor() {
|
||||
ConfigurationMetadata metadata = compile(InvalidAccessorProperties.class);
|
||||
assertThat(metadata).has(Metadata.withGroup("config"));
|
||||
assertThat(metadata.getItems()).hasSize(1);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void doubleRegistration() {
|
||||
void doubleRegistration() {
|
||||
ConfigurationMetadata metadata = compile(DoubleRegistrationProperties.class);
|
||||
assertThat(metadata).has(Metadata.withGroup("one"));
|
||||
assertThat(metadata).has(Metadata.withGroup("two"));
|
||||
@@ -328,25 +328,25 @@ public class ConfigurationMetadataAnnotationProcessorTests extends AbstractMetad
|
||||
}
|
||||
|
||||
@Test
|
||||
public void invalidDoubleRegistration() {
|
||||
void invalidDoubleRegistration() {
|
||||
assertThatIllegalStateException().isThrownBy(() -> compile(InvalidDoubleRegistrationProperties.class))
|
||||
.withMessageContaining("Compilation failed");
|
||||
}
|
||||
|
||||
@Test
|
||||
public void constructorParameterPropertyWithInvalidDefaultValueOnNumber() {
|
||||
void constructorParameterPropertyWithInvalidDefaultValueOnNumber() {
|
||||
assertThatIllegalStateException().isThrownBy(() -> compile(InvalidDefaultValueNumberProperties.class))
|
||||
.withMessageContaining("Compilation failed");
|
||||
}
|
||||
|
||||
@Test
|
||||
public void constructorParameterPropertyWithInvalidDefaultValueOnFloatingPoint() {
|
||||
void constructorParameterPropertyWithInvalidDefaultValueOnFloatingPoint() {
|
||||
assertThatIllegalStateException().isThrownBy(() -> compile(InvalidDefaultValueFloatingPointProperties.class))
|
||||
.withMessageContaining("Compilation failed");
|
||||
}
|
||||
|
||||
@Test
|
||||
public void constructorParameterPropertyWithInvalidDefaultValueOnCharacter() {
|
||||
void constructorParameterPropertyWithInvalidDefaultValueOnCharacter() {
|
||||
assertThatIllegalStateException().isThrownBy(() -> compile(InvalidDefaultValueCharacterProperties.class))
|
||||
.withMessageContaining("Compilation failed");
|
||||
}
|
||||
|
||||
@@ -26,7 +26,7 @@ import javax.lang.model.element.TypeElement;
|
||||
import javax.lang.model.element.VariableElement;
|
||||
import javax.lang.model.util.ElementFilter;
|
||||
|
||||
import org.junit.Test;
|
||||
import org.junit.jupiter.api.Test;
|
||||
|
||||
import org.springframework.boot.configurationsample.immutable.ImmutableCollectionProperties;
|
||||
import org.springframework.boot.configurationsample.immutable.ImmutableInnerClassProperties;
|
||||
@@ -42,10 +42,10 @@ import static org.assertj.core.api.Assertions.assertThat;
|
||||
*
|
||||
* @author Stephane Nicoll
|
||||
*/
|
||||
public class ConstructorParameterPropertyDescriptorTests extends PropertyDescriptorTests {
|
||||
class ConstructorParameterPropertyDescriptorTests extends PropertyDescriptorTests {
|
||||
|
||||
@Test
|
||||
public void constructorParameterSimpleProperty() throws IOException {
|
||||
void constructorParameterSimpleProperty() throws IOException {
|
||||
process(ImmutableSimpleProperties.class, (roundEnv, metadataEnv) -> {
|
||||
TypeElement ownerElement = roundEnv.getRootElement(ImmutableSimpleProperties.class);
|
||||
ConstructorParameterPropertyDescriptor property = createPropertyDescriptor(ownerElement, "theName");
|
||||
@@ -58,7 +58,7 @@ public class ConstructorParameterPropertyDescriptorTests extends PropertyDescrip
|
||||
}
|
||||
|
||||
@Test
|
||||
public void constructorParameterNestedPropertySameClass() throws IOException {
|
||||
void constructorParameterNestedPropertySameClass() throws IOException {
|
||||
process(ImmutableInnerClassProperties.class, (roundEnv, metadataEnv) -> {
|
||||
TypeElement ownerElement = roundEnv.getRootElement(ImmutableInnerClassProperties.class);
|
||||
ConstructorParameterPropertyDescriptor property = createPropertyDescriptor(ownerElement, "first");
|
||||
@@ -71,7 +71,7 @@ public class ConstructorParameterPropertyDescriptorTests extends PropertyDescrip
|
||||
}
|
||||
|
||||
@Test
|
||||
public void constructorParameterNestedPropertyWithAnnotation() throws IOException {
|
||||
void constructorParameterNestedPropertyWithAnnotation() throws IOException {
|
||||
process(ImmutableInnerClassProperties.class, (roundEnv, metadataEnv) -> {
|
||||
TypeElement ownerElement = roundEnv.getRootElement(ImmutableInnerClassProperties.class);
|
||||
ConstructorParameterPropertyDescriptor property = createPropertyDescriptor(ownerElement, "third");
|
||||
@@ -84,7 +84,7 @@ public class ConstructorParameterPropertyDescriptorTests extends PropertyDescrip
|
||||
}
|
||||
|
||||
@Test
|
||||
public void constructorParameterSimplePropertyWithNoAccessorShouldBeExposed() throws IOException {
|
||||
void constructorParameterSimplePropertyWithNoAccessorShouldBeExposed() throws IOException {
|
||||
process(ImmutableSimpleProperties.class, (roundEnv, metadataEnv) -> {
|
||||
TypeElement ownerElement = roundEnv.getRootElement(ImmutableSimpleProperties.class);
|
||||
ConstructorParameterPropertyDescriptor property = createPropertyDescriptor(ownerElement, "counter");
|
||||
@@ -97,7 +97,7 @@ public class ConstructorParameterPropertyDescriptorTests extends PropertyDescrip
|
||||
}
|
||||
|
||||
@Test
|
||||
public void constructorParameterMetadataSimpleProperty() throws IOException {
|
||||
void constructorParameterMetadataSimpleProperty() throws IOException {
|
||||
process(ImmutableSimpleProperties.class, (roundEnv, metadataEnv) -> {
|
||||
TypeElement ownerElement = roundEnv.getRootElement(ImmutableSimpleProperties.class);
|
||||
ConstructorParameterPropertyDescriptor property = createPropertyDescriptor(ownerElement, "counter");
|
||||
@@ -107,7 +107,7 @@ public class ConstructorParameterPropertyDescriptorTests extends PropertyDescrip
|
||||
}
|
||||
|
||||
@Test
|
||||
public void constructorParameterMetadataNestedGroup() throws IOException {
|
||||
void constructorParameterMetadataNestedGroup() throws IOException {
|
||||
process(ImmutableInnerClassProperties.class, (roundEnv, metadataEnv) -> {
|
||||
TypeElement ownerElement = roundEnv.getRootElement(ImmutableInnerClassProperties.class);
|
||||
ConstructorParameterPropertyDescriptor property = createPropertyDescriptor(ownerElement, "first");
|
||||
@@ -119,7 +119,7 @@ public class ConstructorParameterPropertyDescriptorTests extends PropertyDescrip
|
||||
}
|
||||
|
||||
@Test
|
||||
public void constructorParameterDeprecatedPropertyOnGetter() throws IOException {
|
||||
void constructorParameterDeprecatedPropertyOnGetter() throws IOException {
|
||||
process(ImmutableSimpleProperties.class, (roundEnv, metadataEnv) -> {
|
||||
TypeElement ownerElement = roundEnv.getRootElement(ImmutableSimpleProperties.class);
|
||||
ExecutableElement getter = getMethod(ownerElement, "isFlag");
|
||||
@@ -132,7 +132,7 @@ public class ConstructorParameterPropertyDescriptorTests extends PropertyDescrip
|
||||
}
|
||||
|
||||
@Test
|
||||
public void constructorParameterPropertyWithDescription() throws IOException {
|
||||
void constructorParameterPropertyWithDescription() throws IOException {
|
||||
process(ImmutableSimpleProperties.class, (roundEnv, metadataEnv) -> {
|
||||
TypeElement ownerElement = roundEnv.getRootElement(ImmutableSimpleProperties.class);
|
||||
ConstructorParameterPropertyDescriptor property = createPropertyDescriptor(ownerElement, "theName");
|
||||
@@ -142,7 +142,7 @@ public class ConstructorParameterPropertyDescriptorTests extends PropertyDescrip
|
||||
}
|
||||
|
||||
@Test
|
||||
public void constructorParameterPropertyWithDefaultValue() throws IOException {
|
||||
void constructorParameterPropertyWithDefaultValue() throws IOException {
|
||||
process(ImmutableSimpleProperties.class, (roundEnv, metadataEnv) -> {
|
||||
TypeElement ownerElement = roundEnv.getRootElement(ImmutableSimpleProperties.class);
|
||||
ConstructorParameterPropertyDescriptor property = createPropertyDescriptor(ownerElement, "theName");
|
||||
@@ -151,7 +151,7 @@ public class ConstructorParameterPropertyDescriptorTests extends PropertyDescrip
|
||||
}
|
||||
|
||||
@Test
|
||||
public void constructorParameterPropertyWithPrimitiveTypes() throws IOException {
|
||||
void constructorParameterPropertyWithPrimitiveTypes() throws IOException {
|
||||
process(ImmutablePrimitiveProperties.class, (roundEnv, metadataEnv) -> {
|
||||
TypeElement ownerElement = roundEnv.getRootElement(ImmutablePrimitiveProperties.class);
|
||||
assertItemMetadata(metadataEnv, createPropertyDescriptor(ownerElement, "flag")).hasDefaultValue(false);
|
||||
@@ -166,7 +166,7 @@ public class ConstructorParameterPropertyDescriptorTests extends PropertyDescrip
|
||||
}
|
||||
|
||||
@Test
|
||||
public void constructorParameterPropertyWithPrimitiveTypesAndDefaultValues() throws IOException {
|
||||
void constructorParameterPropertyWithPrimitiveTypesAndDefaultValues() throws IOException {
|
||||
process(ImmutablePrimitiveWithDefaultsProperties.class, (roundEnv, metadataEnv) -> {
|
||||
TypeElement ownerElement = roundEnv.getRootElement(ImmutablePrimitiveWithDefaultsProperties.class);
|
||||
assertItemMetadata(metadataEnv, createPropertyDescriptor(ownerElement, "flag")).hasDefaultValue(true);
|
||||
@@ -181,7 +181,7 @@ public class ConstructorParameterPropertyDescriptorTests extends PropertyDescrip
|
||||
}
|
||||
|
||||
@Test
|
||||
public void constructorParameterPropertyWithPrimitiveWrapperTypesAndDefaultValues() throws IOException {
|
||||
void constructorParameterPropertyWithPrimitiveWrapperTypesAndDefaultValues() throws IOException {
|
||||
process(ImmutablePrimitiveWrapperWithDefaultsProperties.class, (roundEnv, metadataEnv) -> {
|
||||
TypeElement ownerElement = roundEnv.getRootElement(ImmutablePrimitiveWrapperWithDefaultsProperties.class);
|
||||
assertItemMetadata(metadataEnv, createPropertyDescriptor(ownerElement, "flag")).hasDefaultValue(true);
|
||||
@@ -196,7 +196,7 @@ public class ConstructorParameterPropertyDescriptorTests extends PropertyDescrip
|
||||
}
|
||||
|
||||
@Test
|
||||
public void constructorParameterPropertyWithCollectionTypesAndDefaultValues() throws IOException {
|
||||
void constructorParameterPropertyWithCollectionTypesAndDefaultValues() throws IOException {
|
||||
process(ImmutableCollectionProperties.class, (roundEnv, metadataEnv) -> {
|
||||
TypeElement ownerElement = roundEnv.getRootElement(ImmutableCollectionProperties.class);
|
||||
assertItemMetadata(metadataEnv, createPropertyDescriptor(ownerElement, "names")).hasDefaultValue(null);
|
||||
|
||||
@@ -18,7 +18,7 @@ package org.springframework.boot.configurationprocessor;
|
||||
|
||||
import java.time.Duration;
|
||||
|
||||
import org.junit.Test;
|
||||
import org.junit.jupiter.api.Test;
|
||||
|
||||
import org.springframework.boot.configurationprocessor.metadata.ConfigurationMetadata;
|
||||
import org.springframework.boot.configurationprocessor.metadata.Metadata;
|
||||
@@ -37,10 +37,10 @@ import static org.assertj.core.api.Assertions.assertThat;
|
||||
*
|
||||
* @author Stephane Nicoll
|
||||
*/
|
||||
public class EndpointMetadataGenerationTests extends AbstractMetadataGenerationTests {
|
||||
class EndpointMetadataGenerationTests extends AbstractMetadataGenerationTests {
|
||||
|
||||
@Test
|
||||
public void simpleEndpoint() {
|
||||
void simpleEndpoint() {
|
||||
ConfigurationMetadata metadata = compile(SimpleEndpoint.class);
|
||||
assertThat(metadata).has(Metadata.withGroup("management.endpoint.simple").fromSource(SimpleEndpoint.class));
|
||||
assertThat(metadata).has(enabledFlag("simple", true));
|
||||
@@ -49,7 +49,7 @@ public class EndpointMetadataGenerationTests extends AbstractMetadataGenerationT
|
||||
}
|
||||
|
||||
@Test
|
||||
public void disableEndpoint() {
|
||||
void disableEndpoint() {
|
||||
ConfigurationMetadata metadata = compile(DisabledEndpoint.class);
|
||||
assertThat(metadata).has(Metadata.withGroup("management.endpoint.disabled").fromSource(DisabledEndpoint.class));
|
||||
assertThat(metadata).has(enabledFlag("disabled", false));
|
||||
@@ -57,7 +57,7 @@ public class EndpointMetadataGenerationTests extends AbstractMetadataGenerationT
|
||||
}
|
||||
|
||||
@Test
|
||||
public void enabledEndpoint() {
|
||||
void enabledEndpoint() {
|
||||
ConfigurationMetadata metadata = compile(EnabledEndpoint.class);
|
||||
assertThat(metadata).has(Metadata.withGroup("management.endpoint.enabled").fromSource(EnabledEndpoint.class));
|
||||
assertThat(metadata).has(enabledFlag("enabled", true));
|
||||
@@ -65,7 +65,7 @@ public class EndpointMetadataGenerationTests extends AbstractMetadataGenerationT
|
||||
}
|
||||
|
||||
@Test
|
||||
public void customPropertiesEndpoint() {
|
||||
void customPropertiesEndpoint() {
|
||||
ConfigurationMetadata metadata = compile(CustomPropertiesEndpoint.class);
|
||||
assertThat(metadata)
|
||||
.has(Metadata.withGroup("management.endpoint.customprops").fromSource(CustomPropertiesEndpoint.class));
|
||||
@@ -77,7 +77,7 @@ public class EndpointMetadataGenerationTests extends AbstractMetadataGenerationT
|
||||
}
|
||||
|
||||
@Test
|
||||
public void specificEndpoint() {
|
||||
void specificEndpoint() {
|
||||
ConfigurationMetadata metadata = compile(SpecificEndpoint.class);
|
||||
assertThat(metadata).has(Metadata.withGroup("management.endpoint.specific").fromSource(SpecificEndpoint.class));
|
||||
assertThat(metadata).has(enabledFlag("specific", true));
|
||||
@@ -86,7 +86,7 @@ public class EndpointMetadataGenerationTests extends AbstractMetadataGenerationT
|
||||
}
|
||||
|
||||
@Test
|
||||
public void camelCaseEndpoint() {
|
||||
void camelCaseEndpoint() {
|
||||
ConfigurationMetadata metadata = compile(CamelCaseEndpoint.class);
|
||||
assertThat(metadata)
|
||||
.has(Metadata.withGroup("management.endpoint.pascal-case").fromSource(CamelCaseEndpoint.class));
|
||||
@@ -95,8 +95,8 @@ public class EndpointMetadataGenerationTests extends AbstractMetadataGenerationT
|
||||
}
|
||||
|
||||
@Test
|
||||
public void incrementalEndpointBuildChangeGeneralEnabledFlag() throws Exception {
|
||||
TestProject project = new TestProject(this.temporaryFolder, IncrementalEndpoint.class);
|
||||
void incrementalEndpointBuildChangeGeneralEnabledFlag() throws Exception {
|
||||
TestProject project = new TestProject(this.tempDir, IncrementalEndpoint.class);
|
||||
ConfigurationMetadata metadata = project.fullBuild();
|
||||
assertThat(metadata)
|
||||
.has(Metadata.withGroup("management.endpoint.incremental").fromSource(IncrementalEndpoint.class));
|
||||
@@ -114,8 +114,8 @@ public class EndpointMetadataGenerationTests extends AbstractMetadataGenerationT
|
||||
}
|
||||
|
||||
@Test
|
||||
public void incrementalEndpointBuildChangeCacheFlag() throws Exception {
|
||||
TestProject project = new TestProject(this.temporaryFolder, IncrementalEndpoint.class);
|
||||
void incrementalEndpointBuildChangeCacheFlag() throws Exception {
|
||||
TestProject project = new TestProject(this.tempDir, IncrementalEndpoint.class);
|
||||
ConfigurationMetadata metadata = project.fullBuild();
|
||||
assertThat(metadata)
|
||||
.has(Metadata.withGroup("management.endpoint.incremental").fromSource(IncrementalEndpoint.class));
|
||||
@@ -131,8 +131,8 @@ public class EndpointMetadataGenerationTests extends AbstractMetadataGenerationT
|
||||
}
|
||||
|
||||
@Test
|
||||
public void incrementalEndpointBuildEnableSpecificEndpoint() throws Exception {
|
||||
TestProject project = new TestProject(this.temporaryFolder, SpecificEndpoint.class);
|
||||
void incrementalEndpointBuildEnableSpecificEndpoint() throws Exception {
|
||||
TestProject project = new TestProject(this.tempDir, SpecificEndpoint.class);
|
||||
ConfigurationMetadata metadata = project.fullBuild();
|
||||
assertThat(metadata).has(Metadata.withGroup("management.endpoint.specific").fromSource(SpecificEndpoint.class));
|
||||
assertThat(metadata).has(enabledFlag("specific", true));
|
||||
|
||||
@@ -16,7 +16,7 @@
|
||||
|
||||
package org.springframework.boot.configurationprocessor;
|
||||
|
||||
import org.junit.Test;
|
||||
import org.junit.jupiter.api.Test;
|
||||
|
||||
import org.springframework.boot.configurationprocessor.metadata.ConfigurationMetadata;
|
||||
import org.springframework.boot.configurationprocessor.metadata.Metadata;
|
||||
@@ -35,10 +35,10 @@ import static org.assertj.core.api.Assertions.assertThat;
|
||||
*
|
||||
* @author Stephane Nicoll
|
||||
*/
|
||||
public class GenericsMetadataGenerationTests extends AbstractMetadataGenerationTests {
|
||||
class GenericsMetadataGenerationTests extends AbstractMetadataGenerationTests {
|
||||
|
||||
@Test
|
||||
public void simpleGenericProperties() {
|
||||
void simpleGenericProperties() {
|
||||
ConfigurationMetadata metadata = compile(AbstractGenericProperties.class, SimpleGenericProperties.class);
|
||||
assertThat(metadata).has(Metadata.withGroup("generic").fromSource(SimpleGenericProperties.class));
|
||||
assertThat(metadata).has(Metadata.withProperty("generic.name", String.class)
|
||||
@@ -50,7 +50,7 @@ public class GenericsMetadataGenerationTests extends AbstractMetadataGenerationT
|
||||
}
|
||||
|
||||
@Test
|
||||
public void complexGenericProperties() {
|
||||
void complexGenericProperties() {
|
||||
ConfigurationMetadata metadata = compile(ComplexGenericProperties.class);
|
||||
assertThat(metadata).has(Metadata.withGroup("generic").fromSource(ComplexGenericProperties.class));
|
||||
assertThat(metadata).has(Metadata.withGroup("generic.test").ofType(UpperBoundGenericPojo.class)
|
||||
@@ -62,7 +62,7 @@ public class GenericsMetadataGenerationTests extends AbstractMetadataGenerationT
|
||||
}
|
||||
|
||||
@Test
|
||||
public void unresolvedGenericProperties() {
|
||||
void unresolvedGenericProperties() {
|
||||
ConfigurationMetadata metadata = compile(AbstractGenericProperties.class, UnresolvedGenericProperties.class);
|
||||
assertThat(metadata).has(Metadata.withGroup("generic").fromSource(UnresolvedGenericProperties.class));
|
||||
assertThat(metadata).has(Metadata.withProperty("generic.name", String.class)
|
||||
@@ -75,7 +75,7 @@ public class GenericsMetadataGenerationTests extends AbstractMetadataGenerationT
|
||||
}
|
||||
|
||||
@Test
|
||||
public void genericTypes() {
|
||||
void genericTypes() {
|
||||
ConfigurationMetadata metadata = compile(GenericConfig.class);
|
||||
assertThat(metadata).has(Metadata.withGroup("generic")
|
||||
.ofType("org.springframework.boot.configurationsample.generic.GenericConfig"));
|
||||
@@ -100,7 +100,7 @@ public class GenericsMetadataGenerationTests extends AbstractMetadataGenerationT
|
||||
}
|
||||
|
||||
@Test
|
||||
public void wildcardTypes() {
|
||||
void wildcardTypes() {
|
||||
ConfigurationMetadata metadata = compile(WildcardConfig.class);
|
||||
assertThat(metadata).has(Metadata.withGroup("wildcard").ofType(WildcardConfig.class));
|
||||
assertThat(metadata).has(Metadata.withProperty("wildcard.string-to-number")
|
||||
|
||||
@@ -16,7 +16,7 @@
|
||||
|
||||
package org.springframework.boot.configurationprocessor;
|
||||
|
||||
import org.junit.Test;
|
||||
import org.junit.jupiter.api.Test;
|
||||
|
||||
import org.springframework.boot.configurationprocessor.metadata.ConfigurationMetadata;
|
||||
import org.springframework.boot.configurationprocessor.metadata.Metadata;
|
||||
@@ -29,10 +29,10 @@ import static org.assertj.core.api.Assertions.assertThat;
|
||||
*
|
||||
* @author Stephane Nicoll
|
||||
*/
|
||||
public class ImmutablePropertiesMetadataGenerationTests extends AbstractMetadataGenerationTests {
|
||||
class ImmutablePropertiesMetadataGenerationTests extends AbstractMetadataGenerationTests {
|
||||
|
||||
@Test
|
||||
public void immutableSimpleProperties() {
|
||||
void immutableSimpleProperties() {
|
||||
ConfigurationMetadata metadata = compile(ImmutableSimpleProperties.class);
|
||||
assertThat(metadata).has(Metadata.withGroup("immutable").fromSource(ImmutableSimpleProperties.class));
|
||||
assertThat(metadata).has(
|
||||
|
||||
@@ -16,7 +16,7 @@
|
||||
|
||||
package org.springframework.boot.configurationprocessor;
|
||||
|
||||
import org.junit.Test;
|
||||
import org.junit.jupiter.api.Test;
|
||||
|
||||
import org.springframework.boot.configurationprocessor.metadata.ConfigurationMetadata;
|
||||
import org.springframework.boot.configurationprocessor.metadata.Metadata;
|
||||
@@ -31,11 +31,11 @@ import static org.assertj.core.api.Assertions.assertThat;
|
||||
*
|
||||
* @author Stephane Nicoll
|
||||
*/
|
||||
public class IncrementalBuildMetadataGenerationTests extends AbstractMetadataGenerationTests {
|
||||
class IncrementalBuildMetadataGenerationTests extends AbstractMetadataGenerationTests {
|
||||
|
||||
@Test
|
||||
public void incrementalBuild() throws Exception {
|
||||
TestProject project = new TestProject(this.temporaryFolder, FooProperties.class, BarProperties.class);
|
||||
void incrementalBuild() throws Exception {
|
||||
TestProject project = new TestProject(this.tempDir, FooProperties.class, BarProperties.class);
|
||||
assertThat(project.getOutputFile(MetadataStore.METADATA_PATH).exists()).isFalse();
|
||||
ConfigurationMetadata metadata = project.fullBuild();
|
||||
assertThat(project.getOutputFile(MetadataStore.METADATA_PATH).exists()).isTrue();
|
||||
@@ -61,8 +61,8 @@ public class IncrementalBuildMetadataGenerationTests extends AbstractMetadataGen
|
||||
}
|
||||
|
||||
@Test
|
||||
public void incrementalBuildAnnotationRemoved() throws Exception {
|
||||
TestProject project = new TestProject(this.temporaryFolder, FooProperties.class, BarProperties.class);
|
||||
void incrementalBuildAnnotationRemoved() throws Exception {
|
||||
TestProject project = new TestProject(this.tempDir, FooProperties.class, BarProperties.class);
|
||||
ConfigurationMetadata metadata = project.fullBuild();
|
||||
assertThat(metadata).has(Metadata.withProperty("foo.counter").withDefaultValue(0));
|
||||
assertThat(metadata).has(Metadata.withProperty("bar.counter").withDefaultValue(0));
|
||||
@@ -73,8 +73,8 @@ public class IncrementalBuildMetadataGenerationTests extends AbstractMetadataGen
|
||||
}
|
||||
|
||||
@Test
|
||||
public void incrementalBuildTypeRenamed() throws Exception {
|
||||
TestProject project = new TestProject(this.temporaryFolder, FooProperties.class, BarProperties.class);
|
||||
void incrementalBuildTypeRenamed() throws Exception {
|
||||
TestProject project = new TestProject(this.tempDir, FooProperties.class, BarProperties.class);
|
||||
ConfigurationMetadata metadata = project.fullBuild();
|
||||
assertThat(metadata)
|
||||
.has(Metadata.withProperty("foo.counter").fromSource(FooProperties.class).withDefaultValue(0));
|
||||
|
||||
@@ -22,7 +22,7 @@ import javax.lang.model.element.ExecutableElement;
|
||||
import javax.lang.model.element.TypeElement;
|
||||
import javax.lang.model.element.VariableElement;
|
||||
|
||||
import org.junit.Test;
|
||||
import org.junit.jupiter.api.Test;
|
||||
|
||||
import org.springframework.boot.configurationsample.simple.DeprecatedSingleProperty;
|
||||
import org.springframework.boot.configurationsample.simple.SimpleCollectionProperties;
|
||||
@@ -37,10 +37,10 @@ import static org.assertj.core.api.Assertions.assertThat;
|
||||
*
|
||||
* @author Stephane Nicoll
|
||||
*/
|
||||
public class JavaBeanPropertyDescriptorTests extends PropertyDescriptorTests {
|
||||
class JavaBeanPropertyDescriptorTests extends PropertyDescriptorTests {
|
||||
|
||||
@Test
|
||||
public void javaBeanSimpleProperty() throws IOException {
|
||||
void javaBeanSimpleProperty() throws IOException {
|
||||
process(SimpleTypeProperties.class, (roundEnv, metadataEnv) -> {
|
||||
TypeElement ownerElement = roundEnv.getRootElement(SimpleTypeProperties.class);
|
||||
JavaBeanPropertyDescriptor property = createPropertyDescriptor(ownerElement, "myString");
|
||||
@@ -54,7 +54,7 @@ public class JavaBeanPropertyDescriptorTests extends PropertyDescriptorTests {
|
||||
}
|
||||
|
||||
@Test
|
||||
public void javaBeanCollectionProperty() throws IOException {
|
||||
void javaBeanCollectionProperty() throws IOException {
|
||||
process(SimpleCollectionProperties.class, (roundEnv, metadataEnv) -> {
|
||||
TypeElement ownerElement = roundEnv.getRootElement(SimpleCollectionProperties.class);
|
||||
JavaBeanPropertyDescriptor property = createPropertyDescriptor(ownerElement, "doubles");
|
||||
@@ -67,7 +67,7 @@ public class JavaBeanPropertyDescriptorTests extends PropertyDescriptorTests {
|
||||
}
|
||||
|
||||
@Test
|
||||
public void javaBeanNestedPropertySameClass() throws IOException {
|
||||
void javaBeanNestedPropertySameClass() throws IOException {
|
||||
process(InnerClassProperties.class, (roundEnv, metadataEnv) -> {
|
||||
TypeElement ownerElement = roundEnv.getRootElement(InnerClassProperties.class);
|
||||
JavaBeanPropertyDescriptor property = createPropertyDescriptor(ownerElement, "first");
|
||||
@@ -80,7 +80,7 @@ public class JavaBeanPropertyDescriptorTests extends PropertyDescriptorTests {
|
||||
}
|
||||
|
||||
@Test
|
||||
public void javaBeanNestedPropertyWithAnnotation() throws IOException {
|
||||
void javaBeanNestedPropertyWithAnnotation() throws IOException {
|
||||
process(InnerClassProperties.class, (roundEnv, metadataEnv) -> {
|
||||
TypeElement ownerElement = roundEnv.getRootElement(InnerClassProperties.class);
|
||||
JavaBeanPropertyDescriptor property = createPropertyDescriptor(ownerElement, "third");
|
||||
@@ -93,7 +93,7 @@ public class JavaBeanPropertyDescriptorTests extends PropertyDescriptorTests {
|
||||
}
|
||||
|
||||
@Test
|
||||
public void javaBeanSimplePropertyWithOnlyGetterShouldNotBeExposed() throws IOException {
|
||||
void javaBeanSimplePropertyWithOnlyGetterShouldNotBeExposed() throws IOException {
|
||||
process(SimpleProperties.class, (roundEnv, metadataEnv) -> {
|
||||
TypeElement ownerElement = roundEnv.getRootElement(SimpleProperties.class);
|
||||
ExecutableElement getter = getMethod(ownerElement, "getSize");
|
||||
@@ -110,7 +110,7 @@ public class JavaBeanPropertyDescriptorTests extends PropertyDescriptorTests {
|
||||
}
|
||||
|
||||
@Test
|
||||
public void javaBeanSimplePropertyWithOnlySetterShouldNotBeExposed() throws IOException {
|
||||
void javaBeanSimplePropertyWithOnlySetterShouldNotBeExposed() throws IOException {
|
||||
process(SimpleProperties.class, (roundEnv, metadataEnv) -> {
|
||||
TypeElement ownerElement = roundEnv.getRootElement(SimpleProperties.class);
|
||||
VariableElement field = getField(ownerElement, "counter");
|
||||
@@ -126,7 +126,7 @@ public class JavaBeanPropertyDescriptorTests extends PropertyDescriptorTests {
|
||||
}
|
||||
|
||||
@Test
|
||||
public void javaBeanMetadataSimpleProperty() throws IOException {
|
||||
void javaBeanMetadataSimpleProperty() throws IOException {
|
||||
process(SimpleTypeProperties.class, (roundEnv, metadataEnv) -> {
|
||||
TypeElement ownerElement = roundEnv.getRootElement(SimpleTypeProperties.class);
|
||||
JavaBeanPropertyDescriptor property = createPropertyDescriptor(ownerElement, "myString");
|
||||
@@ -136,7 +136,7 @@ public class JavaBeanPropertyDescriptorTests extends PropertyDescriptorTests {
|
||||
}
|
||||
|
||||
@Test
|
||||
public void javaBeanMetadataCollectionProperty() throws IOException {
|
||||
void javaBeanMetadataCollectionProperty() throws IOException {
|
||||
process(SimpleCollectionProperties.class, (roundEnv, metadataEnv) -> {
|
||||
TypeElement ownerElement = roundEnv.getRootElement(SimpleCollectionProperties.class);
|
||||
JavaBeanPropertyDescriptor property = createPropertyDescriptor(ownerElement, "doubles");
|
||||
@@ -147,7 +147,7 @@ public class JavaBeanPropertyDescriptorTests extends PropertyDescriptorTests {
|
||||
}
|
||||
|
||||
@Test
|
||||
public void javaBeanMetadataNestedGroup() throws IOException {
|
||||
void javaBeanMetadataNestedGroup() throws IOException {
|
||||
process(InnerClassProperties.class, (roundEnv, metadataEnv) -> {
|
||||
TypeElement ownerElement = roundEnv.getRootElement(InnerClassProperties.class);
|
||||
JavaBeanPropertyDescriptor property = createPropertyDescriptor(ownerElement, "first");
|
||||
@@ -159,7 +159,7 @@ public class JavaBeanPropertyDescriptorTests extends PropertyDescriptorTests {
|
||||
}
|
||||
|
||||
@Test
|
||||
public void javaBeanMetadataNotACandidatePropertyShouldReturnNull() throws IOException {
|
||||
void javaBeanMetadataNotACandidatePropertyShouldReturnNull() throws IOException {
|
||||
process(SimpleProperties.class, (roundEnv, metadataEnv) -> {
|
||||
TypeElement ownerElement = roundEnv.getRootElement(SimpleProperties.class);
|
||||
VariableElement field = getField(ownerElement, "counter");
|
||||
@@ -171,7 +171,7 @@ public class JavaBeanPropertyDescriptorTests extends PropertyDescriptorTests {
|
||||
|
||||
@Test
|
||||
@SuppressWarnings("deprecation")
|
||||
public void javaBeanDeprecatedPropertyOnClass() throws IOException {
|
||||
void javaBeanDeprecatedPropertyOnClass() throws IOException {
|
||||
process(org.springframework.boot.configurationsample.simple.DeprecatedProperties.class,
|
||||
(roundEnv, metadataEnv) -> {
|
||||
TypeElement ownerElement = roundEnv.getRootElement(
|
||||
@@ -182,7 +182,7 @@ public class JavaBeanPropertyDescriptorTests extends PropertyDescriptorTests {
|
||||
}
|
||||
|
||||
@Test
|
||||
public void javaBeanMetadataDeprecatedPropertyWithAnnotation() throws IOException {
|
||||
void javaBeanMetadataDeprecatedPropertyWithAnnotation() throws IOException {
|
||||
process(DeprecatedSingleProperty.class, (roundEnv, metadataEnv) -> {
|
||||
TypeElement ownerElement = roundEnv.getRootElement(DeprecatedSingleProperty.class);
|
||||
JavaBeanPropertyDescriptor property = createPropertyDescriptor(ownerElement, "name");
|
||||
@@ -192,7 +192,7 @@ public class JavaBeanPropertyDescriptorTests extends PropertyDescriptorTests {
|
||||
}
|
||||
|
||||
@Test
|
||||
public void javaBeanDeprecatedPropertyOnGetter() throws IOException {
|
||||
void javaBeanDeprecatedPropertyOnGetter() throws IOException {
|
||||
process(SimpleProperties.class, (roundEnv, metadataEnv) -> {
|
||||
TypeElement ownerElement = roundEnv.getRootElement(SimpleProperties.class);
|
||||
JavaBeanPropertyDescriptor property = createPropertyDescriptor(ownerElement, "flag", "isFlag", "setFlag");
|
||||
@@ -201,7 +201,7 @@ public class JavaBeanPropertyDescriptorTests extends PropertyDescriptorTests {
|
||||
}
|
||||
|
||||
@Test
|
||||
public void javaBeanDeprecatedPropertyOnSetter() throws IOException {
|
||||
void javaBeanDeprecatedPropertyOnSetter() throws IOException {
|
||||
process(SimpleProperties.class, (roundEnv, metadataEnv) -> {
|
||||
TypeElement ownerElement = roundEnv.getRootElement(SimpleProperties.class);
|
||||
JavaBeanPropertyDescriptor property = createPropertyDescriptor(ownerElement, "theName");
|
||||
@@ -210,7 +210,7 @@ public class JavaBeanPropertyDescriptorTests extends PropertyDescriptorTests {
|
||||
}
|
||||
|
||||
@Test
|
||||
public void javaBeanPropertyWithDescription() throws IOException {
|
||||
void javaBeanPropertyWithDescription() throws IOException {
|
||||
process(SimpleProperties.class, (roundEnv, metadataEnv) -> {
|
||||
TypeElement ownerElement = roundEnv.getRootElement(SimpleProperties.class);
|
||||
JavaBeanPropertyDescriptor property = createPropertyDescriptor(ownerElement, "theName");
|
||||
@@ -220,7 +220,7 @@ public class JavaBeanPropertyDescriptorTests extends PropertyDescriptorTests {
|
||||
}
|
||||
|
||||
@Test
|
||||
public void javaBeanPropertyWithDefaultValue() throws IOException {
|
||||
void javaBeanPropertyWithDefaultValue() throws IOException {
|
||||
process(SimpleProperties.class, (roundEnv, metadataEnv) -> {
|
||||
TypeElement ownerElement = roundEnv.getRootElement(SimpleProperties.class);
|
||||
JavaBeanPropertyDescriptor property = createPropertyDescriptor(ownerElement, "theName");
|
||||
|
||||
@@ -16,7 +16,7 @@
|
||||
|
||||
package org.springframework.boot.configurationprocessor;
|
||||
|
||||
import org.junit.Test;
|
||||
import org.junit.jupiter.api.Test;
|
||||
|
||||
import org.springframework.boot.configurationprocessor.metadata.ConfigurationMetadata;
|
||||
import org.springframework.boot.configurationprocessor.metadata.Metadata;
|
||||
@@ -38,56 +38,56 @@ import static org.assertj.core.api.Assertions.assertThat;
|
||||
*
|
||||
* @author Stephane Nicoll
|
||||
*/
|
||||
public class LombokMetadataGenerationTests extends AbstractMetadataGenerationTests {
|
||||
class LombokMetadataGenerationTests extends AbstractMetadataGenerationTests {
|
||||
|
||||
@Test
|
||||
public void lombokDataProperties() {
|
||||
void lombokDataProperties() {
|
||||
ConfigurationMetadata metadata = compile(LombokSimpleDataProperties.class);
|
||||
assertSimpleLombokProperties(metadata, LombokSimpleDataProperties.class, "data");
|
||||
}
|
||||
|
||||
@Test
|
||||
public void lombokSimpleProperties() {
|
||||
void lombokSimpleProperties() {
|
||||
ConfigurationMetadata metadata = compile(LombokSimpleProperties.class);
|
||||
assertSimpleLombokProperties(metadata, LombokSimpleProperties.class, "simple");
|
||||
}
|
||||
|
||||
@Test
|
||||
public void lombokExplicitProperties() {
|
||||
void lombokExplicitProperties() {
|
||||
ConfigurationMetadata metadata = compile(LombokExplicitProperties.class);
|
||||
assertSimpleLombokProperties(metadata, LombokExplicitProperties.class, "explicit");
|
||||
assertThat(metadata.getItems()).hasSize(6);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void lombokAccessLevelProperties() {
|
||||
void lombokAccessLevelProperties() {
|
||||
ConfigurationMetadata metadata = compile(LombokAccessLevelProperties.class);
|
||||
assertAccessLevelLombokProperties(metadata, LombokAccessLevelProperties.class, "accesslevel", 2);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void lombokAccessLevelOverwriteDataProperties() {
|
||||
void lombokAccessLevelOverwriteDataProperties() {
|
||||
ConfigurationMetadata metadata = compile(LombokAccessLevelOverwriteDataProperties.class);
|
||||
assertAccessLevelOverwriteLombokProperties(metadata, LombokAccessLevelOverwriteDataProperties.class,
|
||||
"accesslevel.overwrite.data");
|
||||
}
|
||||
|
||||
@Test
|
||||
public void lombokAccessLevelOverwriteExplicitProperties() {
|
||||
void lombokAccessLevelOverwriteExplicitProperties() {
|
||||
ConfigurationMetadata metadata = compile(LombokAccessLevelOverwriteExplicitProperties.class);
|
||||
assertAccessLevelOverwriteLombokProperties(metadata, LombokAccessLevelOverwriteExplicitProperties.class,
|
||||
"accesslevel.overwrite.explicit");
|
||||
}
|
||||
|
||||
@Test
|
||||
public void lombokAccessLevelOverwriteDefaultProperties() {
|
||||
void lombokAccessLevelOverwriteDefaultProperties() {
|
||||
ConfigurationMetadata metadata = compile(LombokAccessLevelOverwriteDefaultProperties.class);
|
||||
assertAccessLevelOverwriteLombokProperties(metadata, LombokAccessLevelOverwriteDefaultProperties.class,
|
||||
"accesslevel.overwrite.default");
|
||||
}
|
||||
|
||||
@Test
|
||||
public void lombokInnerClassProperties() {
|
||||
void lombokInnerClassProperties() {
|
||||
ConfigurationMetadata metadata = compile(LombokInnerClassProperties.class);
|
||||
assertThat(metadata).has(Metadata.withGroup("config").fromSource(LombokInnerClassProperties.class));
|
||||
assertThat(metadata).has(Metadata.withGroup("config.first").ofType(LombokInnerClassProperties.Foo.class)
|
||||
@@ -111,7 +111,7 @@ public class LombokMetadataGenerationTests extends AbstractMetadataGenerationTes
|
||||
}
|
||||
|
||||
@Test
|
||||
public void lombokInnerClassWithGetterProperties() {
|
||||
void lombokInnerClassWithGetterProperties() {
|
||||
ConfigurationMetadata metadata = compile(LombokInnerClassWithGetterProperties.class);
|
||||
assertThat(metadata).has(Metadata.withGroup("config").fromSource(LombokInnerClassWithGetterProperties.class));
|
||||
assertThat(metadata)
|
||||
|
||||
@@ -22,7 +22,7 @@ import javax.lang.model.element.ExecutableElement;
|
||||
import javax.lang.model.element.TypeElement;
|
||||
import javax.lang.model.element.VariableElement;
|
||||
|
||||
import org.junit.Test;
|
||||
import org.junit.jupiter.api.Test;
|
||||
|
||||
import org.springframework.boot.configurationsample.lombok.LombokDefaultValueProperties;
|
||||
import org.springframework.boot.configurationsample.lombok.LombokDeprecatedSingleProperty;
|
||||
@@ -40,10 +40,10 @@ import static org.assertj.core.api.Assertions.assertThat;
|
||||
*
|
||||
* @author Stephane Nicoll
|
||||
*/
|
||||
public class LombokPropertyDescriptorTests extends PropertyDescriptorTests {
|
||||
class LombokPropertyDescriptorTests extends PropertyDescriptorTests {
|
||||
|
||||
@Test
|
||||
public void lombokSimpleProperty() throws IOException {
|
||||
void lombokSimpleProperty() throws IOException {
|
||||
process(LombokSimpleProperties.class, (roundEnv, metadataEnv) -> {
|
||||
TypeElement ownerElement = roundEnv.getRootElement(LombokSimpleProperties.class);
|
||||
LombokPropertyDescriptor property = createPropertyDescriptor(ownerElement, "name");
|
||||
@@ -56,7 +56,7 @@ public class LombokPropertyDescriptorTests extends PropertyDescriptorTests {
|
||||
}
|
||||
|
||||
@Test
|
||||
public void lombokCollectionProperty() throws IOException {
|
||||
void lombokCollectionProperty() throws IOException {
|
||||
process(LombokSimpleProperties.class, (roundEnv, metadataEnv) -> {
|
||||
TypeElement ownerElement = roundEnv.getRootElement(LombokSimpleProperties.class);
|
||||
LombokPropertyDescriptor property = createPropertyDescriptor(ownerElement, "items");
|
||||
@@ -69,7 +69,7 @@ public class LombokPropertyDescriptorTests extends PropertyDescriptorTests {
|
||||
}
|
||||
|
||||
@Test
|
||||
public void lombokNestedPropertySameClass() throws IOException {
|
||||
void lombokNestedPropertySameClass() throws IOException {
|
||||
process(LombokInnerClassProperties.class, (roundEnv, metadataEnv) -> {
|
||||
TypeElement ownerElement = roundEnv.getRootElement(LombokInnerClassProperties.class);
|
||||
LombokPropertyDescriptor property = createPropertyDescriptor(ownerElement, "first");
|
||||
@@ -82,7 +82,7 @@ public class LombokPropertyDescriptorTests extends PropertyDescriptorTests {
|
||||
}
|
||||
|
||||
@Test
|
||||
public void lombokNestedPropertyWithAnnotation() throws IOException {
|
||||
void lombokNestedPropertyWithAnnotation() throws IOException {
|
||||
process(LombokInnerClassProperties.class, (roundEnv, metadataEnv) -> {
|
||||
TypeElement ownerElement = roundEnv.getRootElement(LombokInnerClassProperties.class);
|
||||
LombokPropertyDescriptor property = createPropertyDescriptor(ownerElement, "third");
|
||||
@@ -95,7 +95,7 @@ public class LombokPropertyDescriptorTests extends PropertyDescriptorTests {
|
||||
}
|
||||
|
||||
@Test
|
||||
public void lombokSimplePropertyWithOnlyGetterOnClassShouldNotBeExposed() throws IOException {
|
||||
void lombokSimplePropertyWithOnlyGetterOnClassShouldNotBeExposed() throws IOException {
|
||||
process(LombokSimpleProperties.class, (roundEnv, metadataEnv) -> {
|
||||
TypeElement ownerElement = roundEnv.getRootElement(LombokSimpleProperties.class);
|
||||
LombokPropertyDescriptor property = createPropertyDescriptor(ownerElement, "ignored");
|
||||
@@ -105,7 +105,7 @@ public class LombokPropertyDescriptorTests extends PropertyDescriptorTests {
|
||||
}
|
||||
|
||||
@Test
|
||||
public void lombokSimplePropertyWithOnlyGetterOnDataClassShouldNotBeExposed() throws IOException {
|
||||
void lombokSimplePropertyWithOnlyGetterOnDataClassShouldNotBeExposed() throws IOException {
|
||||
process(LombokSimpleDataProperties.class, (roundEnv, metadataEnv) -> {
|
||||
TypeElement ownerElement = roundEnv.getRootElement(LombokSimpleDataProperties.class);
|
||||
LombokPropertyDescriptor property = createPropertyDescriptor(ownerElement, "ignored");
|
||||
@@ -115,7 +115,7 @@ public class LombokPropertyDescriptorTests extends PropertyDescriptorTests {
|
||||
}
|
||||
|
||||
@Test
|
||||
public void lombokSimplePropertyWithOnlyGetterOnFieldShouldNotBeExposed() throws IOException {
|
||||
void lombokSimplePropertyWithOnlyGetterOnFieldShouldNotBeExposed() throws IOException {
|
||||
process(LombokExplicitProperties.class, (roundEnv, metadataEnv) -> {
|
||||
TypeElement ownerElement = roundEnv.getRootElement(LombokExplicitProperties.class);
|
||||
LombokPropertyDescriptor property = createPropertyDescriptor(ownerElement, "ignoredOnlyGetter");
|
||||
@@ -125,7 +125,7 @@ public class LombokPropertyDescriptorTests extends PropertyDescriptorTests {
|
||||
}
|
||||
|
||||
@Test
|
||||
public void lombokSimplePropertyWithOnlySetterOnFieldShouldNotBeExposed() throws IOException {
|
||||
void lombokSimplePropertyWithOnlySetterOnFieldShouldNotBeExposed() throws IOException {
|
||||
process(LombokExplicitProperties.class, (roundEnv, metadataEnv) -> {
|
||||
TypeElement ownerElement = roundEnv.getRootElement(LombokExplicitProperties.class);
|
||||
LombokPropertyDescriptor property = createPropertyDescriptor(ownerElement, "ignoredOnlySetter");
|
||||
@@ -135,7 +135,7 @@ public class LombokPropertyDescriptorTests extends PropertyDescriptorTests {
|
||||
}
|
||||
|
||||
@Test
|
||||
public void lombokMetadataSimpleProperty() throws IOException {
|
||||
void lombokMetadataSimpleProperty() throws IOException {
|
||||
process(LombokSimpleProperties.class, (roundEnv, metadataEnv) -> {
|
||||
TypeElement ownerElement = roundEnv.getRootElement(LombokSimpleProperties.class);
|
||||
LombokPropertyDescriptor property = createPropertyDescriptor(ownerElement, "description");
|
||||
@@ -145,7 +145,7 @@ public class LombokPropertyDescriptorTests extends PropertyDescriptorTests {
|
||||
}
|
||||
|
||||
@Test
|
||||
public void lombokMetadataCollectionProperty() throws IOException {
|
||||
void lombokMetadataCollectionProperty() throws IOException {
|
||||
process(LombokSimpleProperties.class, (roundEnv, metadataEnv) -> {
|
||||
TypeElement ownerElement = roundEnv.getRootElement(LombokSimpleProperties.class);
|
||||
LombokPropertyDescriptor property = createPropertyDescriptor(ownerElement, "items");
|
||||
@@ -156,7 +156,7 @@ public class LombokPropertyDescriptorTests extends PropertyDescriptorTests {
|
||||
}
|
||||
|
||||
@Test
|
||||
public void lombokMetadataNestedGroup() throws IOException {
|
||||
void lombokMetadataNestedGroup() throws IOException {
|
||||
process(LombokInnerClassProperties.class, (roundEnv, metadataEnv) -> {
|
||||
TypeElement ownerElement = roundEnv.getRootElement(LombokInnerClassProperties.class);
|
||||
VariableElement field = getField(ownerElement, "third");
|
||||
@@ -171,7 +171,7 @@ public class LombokPropertyDescriptorTests extends PropertyDescriptorTests {
|
||||
}
|
||||
|
||||
@Test
|
||||
public void lombokMetadataNestedGroupNoGetter() throws IOException {
|
||||
void lombokMetadataNestedGroupNoGetter() throws IOException {
|
||||
process(LombokInnerClassProperties.class, (roundEnv, metadataEnv) -> {
|
||||
TypeElement ownerElement = roundEnv.getRootElement(LombokInnerClassProperties.class);
|
||||
LombokPropertyDescriptor property = createPropertyDescriptor(ownerElement, "first");
|
||||
@@ -183,7 +183,7 @@ public class LombokPropertyDescriptorTests extends PropertyDescriptorTests {
|
||||
}
|
||||
|
||||
@Test
|
||||
public void lombokMetadataNotACandidatePropertyShouldReturnNull() throws IOException {
|
||||
void lombokMetadataNotACandidatePropertyShouldReturnNull() throws IOException {
|
||||
process(LombokSimpleProperties.class, (roundEnv, metadataEnv) -> {
|
||||
TypeElement ownerElement = roundEnv.getRootElement(LombokSimpleProperties.class);
|
||||
LombokPropertyDescriptor property = createPropertyDescriptor(ownerElement, "ignored");
|
||||
@@ -193,7 +193,7 @@ public class LombokPropertyDescriptorTests extends PropertyDescriptorTests {
|
||||
|
||||
@Test
|
||||
@SuppressWarnings("deprecation")
|
||||
public void lombokDeprecatedPropertyOnClass() throws IOException {
|
||||
void lombokDeprecatedPropertyOnClass() throws IOException {
|
||||
process(org.springframework.boot.configurationsample.lombok.LombokDeprecatedProperties.class,
|
||||
(roundEnv, metadataEnv) -> {
|
||||
TypeElement ownerElement = roundEnv.getRootElement(
|
||||
@@ -204,7 +204,7 @@ public class LombokPropertyDescriptorTests extends PropertyDescriptorTests {
|
||||
}
|
||||
|
||||
@Test
|
||||
public void lombokDeprecatedPropertyOnField() throws IOException {
|
||||
void lombokDeprecatedPropertyOnField() throws IOException {
|
||||
process(LombokDeprecatedSingleProperty.class, (roundEnv, metadataEnv) -> {
|
||||
TypeElement ownerElement = roundEnv.getRootElement(LombokDeprecatedSingleProperty.class);
|
||||
LombokPropertyDescriptor property = createPropertyDescriptor(ownerElement, "name");
|
||||
@@ -213,7 +213,7 @@ public class LombokPropertyDescriptorTests extends PropertyDescriptorTests {
|
||||
}
|
||||
|
||||
@Test
|
||||
public void lombokPropertyWithDescription() throws IOException {
|
||||
void lombokPropertyWithDescription() throws IOException {
|
||||
process(LombokSimpleProperties.class, (roundEnv, metadataEnv) -> {
|
||||
TypeElement ownerElement = roundEnv.getRootElement(LombokSimpleProperties.class);
|
||||
LombokPropertyDescriptor property = createPropertyDescriptor(ownerElement, "name");
|
||||
@@ -222,7 +222,7 @@ public class LombokPropertyDescriptorTests extends PropertyDescriptorTests {
|
||||
}
|
||||
|
||||
@Test
|
||||
public void lombokPropertyWithDefaultValue() throws IOException {
|
||||
void lombokPropertyWithDefaultValue() throws IOException {
|
||||
process(LombokDefaultValueProperties.class, (roundEnv, metadataEnv) -> {
|
||||
TypeElement ownerElement = roundEnv.getRootElement(LombokDefaultValueProperties.class);
|
||||
LombokPropertyDescriptor property = createPropertyDescriptor(ownerElement, "description");
|
||||
@@ -231,7 +231,7 @@ public class LombokPropertyDescriptorTests extends PropertyDescriptorTests {
|
||||
}
|
||||
|
||||
@Test
|
||||
public void lombokPropertyNotCandidate() throws IOException {
|
||||
void lombokPropertyNotCandidate() throws IOException {
|
||||
process(SimpleProperties.class, (roundEnv, metadataEnv) -> {
|
||||
TypeElement ownerElement = roundEnv.getRootElement(SimpleProperties.class);
|
||||
LombokPropertyDescriptor property = createPropertyDescriptor(ownerElement, "theName");
|
||||
@@ -241,7 +241,7 @@ public class LombokPropertyDescriptorTests extends PropertyDescriptorTests {
|
||||
}
|
||||
|
||||
@Test
|
||||
public void lombokNestedPropertyNotCandidate() throws IOException {
|
||||
void lombokNestedPropertyNotCandidate() throws IOException {
|
||||
process(InnerClassProperties.class, (roundEnv, metadataEnv) -> {
|
||||
TypeElement ownerElement = roundEnv.getRootElement(InnerClassProperties.class);
|
||||
LombokPropertyDescriptor property = createPropertyDescriptor(ownerElement, "first");
|
||||
|
||||
@@ -24,7 +24,7 @@ import java.util.Collections;
|
||||
import java.util.List;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
import org.junit.Test;
|
||||
import org.junit.jupiter.api.Test;
|
||||
|
||||
import org.springframework.boot.configurationprocessor.json.JSONArray;
|
||||
import org.springframework.boot.configurationprocessor.json.JSONObject;
|
||||
@@ -47,10 +47,10 @@ import static org.assertj.core.api.Assertions.assertThatIllegalStateException;
|
||||
*
|
||||
* @author Stephane Nicoll
|
||||
*/
|
||||
public class MergeMetadataGenerationTests extends AbstractMetadataGenerationTests {
|
||||
class MergeMetadataGenerationTests extends AbstractMetadataGenerationTests {
|
||||
|
||||
@Test
|
||||
public void mergingOfAdditionalProperty() throws Exception {
|
||||
void mergingOfAdditionalProperty() throws Exception {
|
||||
ItemMetadata property = ItemMetadata.newProperty(null, "foo", "java.lang.String",
|
||||
AdditionalMetadata.class.getName(), null, null, null, null);
|
||||
writeAdditionalMetadata(property);
|
||||
@@ -60,7 +60,7 @@ public class MergeMetadataGenerationTests extends AbstractMetadataGenerationTest
|
||||
}
|
||||
|
||||
@Test
|
||||
public void mergingOfAdditionalPropertyMatchingGroup() throws Exception {
|
||||
void mergingOfAdditionalPropertyMatchingGroup() throws Exception {
|
||||
ItemMetadata property = ItemMetadata.newProperty(null, "simple", "java.lang.String", null, null, null, null,
|
||||
null);
|
||||
writeAdditionalMetadata(property);
|
||||
@@ -70,7 +70,7 @@ public class MergeMetadataGenerationTests extends AbstractMetadataGenerationTest
|
||||
}
|
||||
|
||||
@Test
|
||||
public void mergeExistingPropertyDefaultValue() throws Exception {
|
||||
void mergeExistingPropertyDefaultValue() throws Exception {
|
||||
ItemMetadata property = ItemMetadata.newProperty("simple", "flag", null, null, null, null, true, null);
|
||||
writeAdditionalMetadata(property);
|
||||
ConfigurationMetadata metadata = compile(SimpleProperties.class);
|
||||
@@ -80,7 +80,7 @@ public class MergeMetadataGenerationTests extends AbstractMetadataGenerationTest
|
||||
}
|
||||
|
||||
@Test
|
||||
public void mergeExistingPropertyWithSeveralCandidates() throws Exception {
|
||||
void mergeExistingPropertyWithSeveralCandidates() throws Exception {
|
||||
ItemMetadata property = ItemMetadata.newProperty("simple", "flag", Boolean.class.getName(), null, null, null,
|
||||
true, null);
|
||||
writeAdditionalMetadata(property);
|
||||
@@ -104,7 +104,7 @@ public class MergeMetadataGenerationTests extends AbstractMetadataGenerationTest
|
||||
}
|
||||
|
||||
@Test
|
||||
public void mergeExistingPropertyDescription() throws Exception {
|
||||
void mergeExistingPropertyDescription() throws Exception {
|
||||
ItemMetadata property = ItemMetadata.newProperty("simple", "comparator", null, null, null, "A nice comparator.",
|
||||
null, null);
|
||||
writeAdditionalMetadata(property);
|
||||
@@ -115,7 +115,7 @@ public class MergeMetadataGenerationTests extends AbstractMetadataGenerationTest
|
||||
}
|
||||
|
||||
@Test
|
||||
public void mergeExistingPropertyDeprecation() throws Exception {
|
||||
void mergeExistingPropertyDeprecation() throws Exception {
|
||||
ItemMetadata property = ItemMetadata.newProperty("simple", "comparator", null, null, null, null, null,
|
||||
new ItemDeprecation("Don't use this.", "simple.complex-comparator", "error"));
|
||||
writeAdditionalMetadata(property);
|
||||
@@ -127,7 +127,7 @@ public class MergeMetadataGenerationTests extends AbstractMetadataGenerationTest
|
||||
}
|
||||
|
||||
@Test
|
||||
public void mergeExistingPropertyDeprecationOverride() throws Exception {
|
||||
void mergeExistingPropertyDeprecationOverride() throws Exception {
|
||||
ItemMetadata property = ItemMetadata.newProperty("singledeprecated", "name", null, null, null, null, null,
|
||||
new ItemDeprecation("Don't use this.", "single.name"));
|
||||
writeAdditionalMetadata(property);
|
||||
@@ -138,7 +138,7 @@ public class MergeMetadataGenerationTests extends AbstractMetadataGenerationTest
|
||||
}
|
||||
|
||||
@Test
|
||||
public void mergeExistingPropertyDeprecationOverrideLevel() throws Exception {
|
||||
void mergeExistingPropertyDeprecationOverrideLevel() throws Exception {
|
||||
ItemMetadata property = ItemMetadata.newProperty("singledeprecated", "name", null, null, null, null, null,
|
||||
new ItemDeprecation(null, null, "error"));
|
||||
writeAdditionalMetadata(property);
|
||||
@@ -150,7 +150,7 @@ public class MergeMetadataGenerationTests extends AbstractMetadataGenerationTest
|
||||
}
|
||||
|
||||
@Test
|
||||
public void mergeOfInvalidAdditionalMetadata() throws IOException {
|
||||
void mergeOfInvalidAdditionalMetadata() throws IOException {
|
||||
File additionalMetadataFile = createAdditionalMetadataFile();
|
||||
FileCopyUtils.copy("Hello World", new FileWriter(additionalMetadataFile));
|
||||
assertThatIllegalStateException().isThrownBy(() -> compile(SimpleProperties.class))
|
||||
@@ -158,7 +158,7 @@ public class MergeMetadataGenerationTests extends AbstractMetadataGenerationTest
|
||||
}
|
||||
|
||||
@Test
|
||||
public void mergingOfSimpleHint() throws Exception {
|
||||
void mergingOfSimpleHint() throws Exception {
|
||||
writeAdditionalHints(ItemHint.newHint("simple.the-name", new ItemHint.ValueHint("boot", "Bla bla"),
|
||||
new ItemHint.ValueHint("spring", null)));
|
||||
ConfigurationMetadata metadata = compile(SimpleProperties.class);
|
||||
@@ -170,7 +170,7 @@ public class MergeMetadataGenerationTests extends AbstractMetadataGenerationTest
|
||||
}
|
||||
|
||||
@Test
|
||||
public void mergingOfHintWithNonCanonicalName() throws Exception {
|
||||
void mergingOfHintWithNonCanonicalName() throws Exception {
|
||||
writeAdditionalHints(ItemHint.newHint("simple.theName", new ItemHint.ValueHint("boot", "Bla bla")));
|
||||
ConfigurationMetadata metadata = compile(SimpleProperties.class);
|
||||
assertThat(metadata).has(Metadata.withProperty("simple.the-name", String.class)
|
||||
@@ -180,7 +180,7 @@ public class MergeMetadataGenerationTests extends AbstractMetadataGenerationTest
|
||||
}
|
||||
|
||||
@Test
|
||||
public void mergingOfHintWithProvider() throws Exception {
|
||||
void mergingOfHintWithProvider() throws Exception {
|
||||
writeAdditionalHints(new ItemHint("simple.theName", Collections.emptyList(),
|
||||
Arrays.asList(new ItemHint.ValueProvider("first", Collections.singletonMap("target", "org.foo")),
|
||||
new ItemHint.ValueProvider("second", null))));
|
||||
@@ -193,7 +193,7 @@ public class MergeMetadataGenerationTests extends AbstractMetadataGenerationTest
|
||||
}
|
||||
|
||||
@Test
|
||||
public void mergingOfAdditionalDeprecation() throws Exception {
|
||||
void mergingOfAdditionalDeprecation() throws Exception {
|
||||
writePropertyDeprecation(ItemMetadata.newProperty("simple", "wrongName", "java.lang.String", null, null, null,
|
||||
null, new ItemDeprecation("Lame name.", "simple.the-name")));
|
||||
ConfigurationMetadata metadata = compile(SimpleProperties.class);
|
||||
@@ -202,7 +202,7 @@ public class MergeMetadataGenerationTests extends AbstractMetadataGenerationTest
|
||||
}
|
||||
|
||||
@Test
|
||||
public void mergingOfAdditionalMetadata() throws Exception {
|
||||
void mergingOfAdditionalMetadata() throws Exception {
|
||||
File metaInfFolder = new File(getCompiler().getOutputLocation(), "META-INF");
|
||||
metaInfFolder.mkdirs();
|
||||
File additionalMetadataFile = new File(metaInfFolder, "additional-spring-configuration-metadata.json");
|
||||
|
||||
@@ -22,9 +22,8 @@ import java.util.Collections;
|
||||
|
||||
import javax.annotation.processing.ProcessingEnvironment;
|
||||
|
||||
import org.junit.Rule;
|
||||
import org.junit.Test;
|
||||
import org.junit.rules.TemporaryFolder;
|
||||
import org.junit.jupiter.api.Test;
|
||||
import org.junit.jupiter.api.io.TempDir;
|
||||
|
||||
import static org.assertj.core.api.Assertions.assertThat;
|
||||
import static org.mockito.BDDMockito.given;
|
||||
@@ -35,18 +34,18 @@ import static org.mockito.Mockito.mock;
|
||||
*
|
||||
* @author Andy Wilkinson
|
||||
*/
|
||||
public class MetadataStoreTests {
|
||||
class MetadataStoreTests {
|
||||
|
||||
@Rule
|
||||
public final TemporaryFolder temp = new TemporaryFolder();
|
||||
@TempDir
|
||||
File tempDir;
|
||||
|
||||
private final ProcessingEnvironment environment = mock(ProcessingEnvironment.class);
|
||||
|
||||
private final MetadataStore metadataStore = new MetadataStore(this.environment);
|
||||
|
||||
@Test
|
||||
public void additionalMetadataIsLocatedInMavenBuild() throws IOException {
|
||||
File app = this.temp.newFolder("app");
|
||||
void additionalMetadataIsLocatedInMavenBuild() throws IOException {
|
||||
File app = new File(this.tempDir, "app");
|
||||
File classesLocation = new File(app, "target/classes");
|
||||
File metaInf = new File(classesLocation, "META-INF");
|
||||
metaInf.mkdirs();
|
||||
@@ -58,8 +57,8 @@ public class MetadataStoreTests {
|
||||
}
|
||||
|
||||
@Test
|
||||
public void additionalMetadataIsLocatedInGradle3Build() throws IOException {
|
||||
File app = this.temp.newFolder("app");
|
||||
void additionalMetadataIsLocatedInGradle3Build() throws IOException {
|
||||
File app = new File(this.tempDir, "app");
|
||||
File classesLocation = new File(app, "build/classes/main");
|
||||
File resourcesLocation = new File(app, "build/resources/main");
|
||||
File metaInf = new File(resourcesLocation, "META-INF");
|
||||
@@ -72,8 +71,8 @@ public class MetadataStoreTests {
|
||||
}
|
||||
|
||||
@Test
|
||||
public void additionalMetadataIsLocatedInGradle4Build() throws IOException {
|
||||
File app = this.temp.newFolder("app");
|
||||
void additionalMetadataIsLocatedInGradle4Build() throws IOException {
|
||||
File app = new File(this.tempDir, "app");
|
||||
File classesLocation = new File(app, "build/classes/java/main");
|
||||
File resourcesLocation = new File(app, "build/resources/main");
|
||||
File metaInf = new File(resourcesLocation, "META-INF");
|
||||
@@ -86,8 +85,8 @@ public class MetadataStoreTests {
|
||||
}
|
||||
|
||||
@Test
|
||||
public void additionalMetadataIsLocatedUsingLocationsOption() throws IOException {
|
||||
File app = this.temp.newFolder("app");
|
||||
void additionalMetadataIsLocatedUsingLocationsOption() throws IOException {
|
||||
File app = new File(this.tempDir, "app");
|
||||
File location = new File(app, "src/main/resources");
|
||||
File metaInf = new File(location, "META-INF");
|
||||
metaInf.mkdirs();
|
||||
|
||||
@@ -16,7 +16,7 @@
|
||||
|
||||
package org.springframework.boot.configurationprocessor;
|
||||
|
||||
import org.junit.Test;
|
||||
import org.junit.jupiter.api.Test;
|
||||
|
||||
import org.springframework.boot.configurationprocessor.metadata.ConfigurationMetadata;
|
||||
import org.springframework.boot.configurationprocessor.metadata.Metadata;
|
||||
@@ -33,10 +33,10 @@ import static org.assertj.core.api.Assertions.assertThat;
|
||||
*
|
||||
* @author Stephane Nicoll
|
||||
*/
|
||||
public class MethodBasedMetadataGenerationTests extends AbstractMetadataGenerationTests {
|
||||
class MethodBasedMetadataGenerationTests extends AbstractMetadataGenerationTests {
|
||||
|
||||
@Test
|
||||
public void simpleMethodConfig() {
|
||||
void simpleMethodConfig() {
|
||||
ConfigurationMetadata metadata = compile(SimpleMethodConfig.class);
|
||||
assertThat(metadata).has(Metadata.withGroup("foo").fromSource(SimpleMethodConfig.class));
|
||||
assertThat(metadata)
|
||||
@@ -46,7 +46,7 @@ public class MethodBasedMetadataGenerationTests extends AbstractMetadataGenerati
|
||||
}
|
||||
|
||||
@Test
|
||||
public void invalidMethodConfig() {
|
||||
void invalidMethodConfig() {
|
||||
ConfigurationMetadata metadata = compile(InvalidMethodConfig.class);
|
||||
assertThat(metadata)
|
||||
.has(Metadata.withProperty("something.name", String.class).fromSource(InvalidMethodConfig.class));
|
||||
@@ -54,7 +54,7 @@ public class MethodBasedMetadataGenerationTests extends AbstractMetadataGenerati
|
||||
}
|
||||
|
||||
@Test
|
||||
public void methodAndClassConfig() {
|
||||
void methodAndClassConfig() {
|
||||
ConfigurationMetadata metadata = compile(MethodAndClassConfig.class);
|
||||
assertThat(metadata)
|
||||
.has(Metadata.withProperty("conflict.name", String.class).fromSource(MethodAndClassConfig.Foo.class));
|
||||
@@ -65,13 +65,13 @@ public class MethodBasedMetadataGenerationTests extends AbstractMetadataGenerati
|
||||
}
|
||||
|
||||
@Test
|
||||
public void emptyTypeMethodConfig() {
|
||||
void emptyTypeMethodConfig() {
|
||||
ConfigurationMetadata metadata = compile(EmptyTypeMethodConfig.class);
|
||||
assertThat(metadata).isNotEqualTo(Metadata.withProperty("something.foo"));
|
||||
}
|
||||
|
||||
@Test
|
||||
public void deprecatedMethodConfig() {
|
||||
void deprecatedMethodConfig() {
|
||||
Class<DeprecatedMethodConfig> type = DeprecatedMethodConfig.class;
|
||||
ConfigurationMetadata metadata = compile(type);
|
||||
assertThat(metadata).has(Metadata.withGroup("foo").fromSource(type));
|
||||
@@ -83,7 +83,7 @@ public class MethodBasedMetadataGenerationTests extends AbstractMetadataGenerati
|
||||
|
||||
@Test
|
||||
@SuppressWarnings("deprecation")
|
||||
public void deprecatedMethodConfigOnClass() {
|
||||
void deprecatedMethodConfigOnClass() {
|
||||
Class<?> type = org.springframework.boot.configurationsample.method.DeprecatedClassMethodConfig.class;
|
||||
ConfigurationMetadata metadata = compile(type);
|
||||
assertThat(metadata).has(Metadata.withGroup("foo").fromSource(type));
|
||||
|
||||
@@ -16,6 +16,7 @@
|
||||
|
||||
package org.springframework.boot.configurationprocessor;
|
||||
|
||||
import java.io.File;
|
||||
import java.io.IOException;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
@@ -27,9 +28,8 @@ import java.util.stream.Stream;
|
||||
|
||||
import javax.lang.model.element.TypeElement;
|
||||
|
||||
import org.junit.Rule;
|
||||
import org.junit.Test;
|
||||
import org.junit.rules.TemporaryFolder;
|
||||
import org.junit.jupiter.api.Test;
|
||||
import org.junit.jupiter.api.io.TempDir;
|
||||
|
||||
import org.springframework.boot.configurationprocessor.metadata.ItemMetadata;
|
||||
import org.springframework.boot.configurationprocessor.test.RoundEnvironmentTester;
|
||||
@@ -52,19 +52,19 @@ import static org.assertj.core.api.Assertions.assertThat;
|
||||
*
|
||||
* @author Stephane Nicoll
|
||||
*/
|
||||
public class PropertyDescriptorResolverTests {
|
||||
class PropertyDescriptorResolverTests {
|
||||
|
||||
@Rule
|
||||
public TemporaryFolder temporaryFolder = new TemporaryFolder();
|
||||
@TempDir
|
||||
File tempDir;
|
||||
|
||||
@Test
|
||||
public void propertiesWithJavaBeanProperties() throws IOException {
|
||||
void propertiesWithJavaBeanProperties() throws IOException {
|
||||
process(SimpleProperties.class,
|
||||
propertyNames((stream) -> assertThat(stream).containsExactly("theName", "flag", "comparator")));
|
||||
}
|
||||
|
||||
@Test
|
||||
public void propertiesWithJavaBeanHierarchicalProperties() throws IOException {
|
||||
void propertiesWithJavaBeanHierarchicalProperties() throws IOException {
|
||||
process(HierarchicalProperties.class,
|
||||
Arrays.asList(HierarchicalPropertiesParent.class, HierarchicalPropertiesGrandparent.class),
|
||||
(type, metadataEnv) -> {
|
||||
@@ -78,31 +78,31 @@ public class PropertyDescriptorResolverTests {
|
||||
}
|
||||
|
||||
@Test
|
||||
public void propertiesWithLombokGetterSetterAtClassLevel() throws IOException {
|
||||
void propertiesWithLombokGetterSetterAtClassLevel() throws IOException {
|
||||
process(LombokSimpleProperties.class, propertyNames(
|
||||
(stream) -> assertThat(stream).containsExactly("name", "description", "counter", "number", "items")));
|
||||
}
|
||||
|
||||
@Test
|
||||
public void propertiesWithLombokGetterSetterAtFieldLevel() throws IOException {
|
||||
void propertiesWithLombokGetterSetterAtFieldLevel() throws IOException {
|
||||
process(LombokExplicitProperties.class, propertyNames(
|
||||
(stream) -> assertThat(stream).containsExactly("name", "description", "counter", "number", "items")));
|
||||
}
|
||||
|
||||
@Test
|
||||
public void propertiesWithLombokDataClass() throws IOException {
|
||||
void propertiesWithLombokDataClass() throws IOException {
|
||||
process(LombokSimpleDataProperties.class, propertyNames(
|
||||
(stream) -> assertThat(stream).containsExactly("name", "description", "counter", "number", "items")));
|
||||
}
|
||||
|
||||
@Test
|
||||
public void propertiesWithConstructorParameters() throws IOException {
|
||||
void propertiesWithConstructorParameters() throws IOException {
|
||||
process(ImmutableSimpleProperties.class, propertyNames(
|
||||
(stream) -> assertThat(stream).containsExactly("theName", "flag", "comparator", "counter")));
|
||||
}
|
||||
|
||||
@Test
|
||||
public void propertiesWithSeveralConstructors() throws IOException {
|
||||
void propertiesWithSeveralConstructors() throws IOException {
|
||||
process(TwoConstructorsExample.class, propertyNames((stream) -> assertThat(stream).containsExactly("name")));
|
||||
process(TwoConstructorsExample.class,
|
||||
properties((stream) -> assertThat(stream).element(0).isInstanceOf(JavaBeanPropertyDescriptor.class)));
|
||||
@@ -134,7 +134,7 @@ public class PropertyDescriptorResolverTests {
|
||||
};
|
||||
TestableAnnotationProcessor<MetadataGenerationEnvironment> processor = new TestableAnnotationProcessor<>(
|
||||
internalConsumer, new MetadataGenerationEnvironmentFactory());
|
||||
TestCompiler compiler = new TestCompiler(this.temporaryFolder);
|
||||
TestCompiler compiler = new TestCompiler(this.tempDir);
|
||||
ArrayList<Class<?>> allClasses = new ArrayList<>();
|
||||
allClasses.add(target);
|
||||
allClasses.addAll(additionalClasses);
|
||||
|
||||
@@ -16,6 +16,7 @@
|
||||
|
||||
package org.springframework.boot.configurationprocessor;
|
||||
|
||||
import java.io.File;
|
||||
import java.io.IOException;
|
||||
import java.util.function.BiConsumer;
|
||||
|
||||
@@ -25,8 +26,7 @@ import javax.lang.model.element.TypeElement;
|
||||
import javax.lang.model.element.VariableElement;
|
||||
import javax.lang.model.util.ElementFilter;
|
||||
|
||||
import org.junit.Rule;
|
||||
import org.junit.rules.TemporaryFolder;
|
||||
import org.junit.jupiter.api.io.TempDir;
|
||||
|
||||
import org.springframework.boot.configurationprocessor.test.ItemMetadataAssert;
|
||||
import org.springframework.boot.configurationprocessor.test.RoundEnvironmentTester;
|
||||
@@ -40,8 +40,8 @@ import org.springframework.boot.testsupport.compiler.TestCompiler;
|
||||
*/
|
||||
public abstract class PropertyDescriptorTests {
|
||||
|
||||
@Rule
|
||||
public TemporaryFolder temporaryFolder = new TemporaryFolder();
|
||||
@TempDir
|
||||
File tempDir;
|
||||
|
||||
protected String createAccessorMethodName(String prefix, String name) {
|
||||
char[] chars = name.toCharArray();
|
||||
@@ -70,7 +70,7 @@ public abstract class PropertyDescriptorTests {
|
||||
throws IOException {
|
||||
TestableAnnotationProcessor<MetadataGenerationEnvironment> processor = new TestableAnnotationProcessor<>(
|
||||
consumer, new MetadataGenerationEnvironmentFactory());
|
||||
TestCompiler compiler = new TestCompiler(this.temporaryFolder);
|
||||
TestCompiler compiler = new TestCompiler(this.tempDir);
|
||||
compiler.getTask(target).call(processor);
|
||||
}
|
||||
|
||||
|
||||
@@ -28,15 +28,13 @@ import java.util.HashSet;
|
||||
import java.util.LinkedHashSet;
|
||||
import java.util.Set;
|
||||
|
||||
import org.junit.Assert;
|
||||
import org.junit.rules.TemporaryFolder;
|
||||
|
||||
import org.springframework.boot.configurationprocessor.metadata.ConfigurationMetadata;
|
||||
import org.springframework.boot.configurationprocessor.test.TestConfigurationMetadataAnnotationProcessor;
|
||||
import org.springframework.boot.configurationsample.ConfigurationProperties;
|
||||
import org.springframework.boot.configurationsample.NestedConfigurationProperty;
|
||||
import org.springframework.boot.testsupport.compiler.TestCompiler;
|
||||
import org.springframework.boot.testsupport.compiler.TestCompiler.TestCompilationTask;
|
||||
import org.springframework.util.Assert;
|
||||
import org.springframework.util.FileCopyUtils;
|
||||
import org.springframework.util.FileSystemUtils;
|
||||
|
||||
@@ -64,9 +62,9 @@ public class TestProject {
|
||||
|
||||
private Set<File> sourceFiles = new LinkedHashSet<>();
|
||||
|
||||
public TestProject(TemporaryFolder tempFolder, Class<?>... classes) throws IOException {
|
||||
this.sourceFolder = tempFolder.newFolder();
|
||||
this.compiler = new TestCompiler(tempFolder) {
|
||||
public TestProject(File tempFolder, Class<?>... classes) throws IOException {
|
||||
this.sourceFolder = new File(tempFolder, "src");
|
||||
this.compiler = new TestCompiler(new File(tempFolder, "build")) {
|
||||
@Override
|
||||
protected File getSourceFolder() {
|
||||
return TestProject.this.sourceFolder;
|
||||
@@ -123,7 +121,7 @@ public class TestProject {
|
||||
* @return the output file
|
||||
*/
|
||||
public File getOutputFile(String relativePath) {
|
||||
Assert.assertFalse(new File(relativePath).isAbsolute());
|
||||
Assert.isTrue(!new File(relativePath).isAbsolute(), "'" + relativePath + "' was absolute");
|
||||
return new File(this.compiler.getOutputLocation(), relativePath);
|
||||
}
|
||||
|
||||
@@ -158,7 +156,7 @@ public class TestProject {
|
||||
* @throws IOException on IO error
|
||||
*/
|
||||
public void revert(Class<?> type) throws IOException {
|
||||
Assert.assertTrue(getSourceFile(type).exists());
|
||||
Assert.isTrue(getSourceFile(type).exists(), "Source file for type '" + type + "' does not exist");
|
||||
copySources(type);
|
||||
}
|
||||
|
||||
@@ -168,7 +166,7 @@ public class TestProject {
|
||||
* @throws IOException on IO error
|
||||
*/
|
||||
public void add(Class<?> type) throws IOException {
|
||||
Assert.assertFalse(getSourceFile(type).exists());
|
||||
Assert.isTrue(!getSourceFile(type).exists(), "Source file for type '" + type + "' already exists");
|
||||
copySources(type);
|
||||
}
|
||||
|
||||
|
||||
@@ -16,13 +16,13 @@
|
||||
|
||||
package org.springframework.boot.configurationprocessor;
|
||||
|
||||
import java.io.File;
|
||||
import java.io.IOException;
|
||||
import java.time.Duration;
|
||||
import java.util.function.BiConsumer;
|
||||
|
||||
import org.junit.Rule;
|
||||
import org.junit.Test;
|
||||
import org.junit.rules.TemporaryFolder;
|
||||
import org.junit.jupiter.api.Test;
|
||||
import org.junit.jupiter.api.io.TempDir;
|
||||
|
||||
import org.springframework.boot.configurationprocessor.TypeUtils.TypeDescriptor;
|
||||
import org.springframework.boot.configurationprocessor.test.RoundEnvironmentTester;
|
||||
@@ -39,13 +39,13 @@ import static org.assertj.core.api.Assertions.assertThat;
|
||||
*
|
||||
* @author Stephane Nicoll
|
||||
*/
|
||||
public class TypeUtilsTests {
|
||||
class TypeUtilsTests {
|
||||
|
||||
@Rule
|
||||
public TemporaryFolder temporaryFolder = new TemporaryFolder();
|
||||
@TempDir
|
||||
File tempDir;
|
||||
|
||||
@Test
|
||||
public void resolveTypeDescriptorOnConcreteClass() throws IOException {
|
||||
void resolveTypeDescriptorOnConcreteClass() throws IOException {
|
||||
process(SimpleGenericProperties.class, (roundEnv, typeUtils) -> {
|
||||
TypeDescriptor typeDescriptor = typeUtils
|
||||
.resolveTypeDescriptor(roundEnv.getRootElement(SimpleGenericProperties.class));
|
||||
@@ -59,7 +59,7 @@ public class TypeUtilsTests {
|
||||
}
|
||||
|
||||
@Test
|
||||
public void resolveTypeDescriptorOnIntermediateClass() throws IOException {
|
||||
void resolveTypeDescriptorOnIntermediateClass() throws IOException {
|
||||
process(AbstractIntermediateGenericProperties.class, (roundEnv, typeUtils) -> {
|
||||
TypeDescriptor typeDescriptor = typeUtils
|
||||
.resolveTypeDescriptor(roundEnv.getRootElement(AbstractIntermediateGenericProperties.class));
|
||||
@@ -72,7 +72,7 @@ public class TypeUtilsTests {
|
||||
}
|
||||
|
||||
@Test
|
||||
public void resolveTypeDescriptorWithOnlyGenerics() throws IOException {
|
||||
void resolveTypeDescriptorWithOnlyGenerics() throws IOException {
|
||||
process(AbstractGenericProperties.class, (roundEnv, typeUtils) -> {
|
||||
TypeDescriptor typeDescriptor = typeUtils
|
||||
.resolveTypeDescriptor(roundEnv.getRootElement(AbstractGenericProperties.class));
|
||||
@@ -84,7 +84,7 @@ public class TypeUtilsTests {
|
||||
|
||||
private void process(Class<?> target, BiConsumer<RoundEnvironmentTester, TypeUtils> consumer) throws IOException {
|
||||
TestableAnnotationProcessor<TypeUtils> processor = new TestableAnnotationProcessor<>(consumer, TypeUtils::new);
|
||||
TestCompiler compiler = new TestCompiler(this.temporaryFolder);
|
||||
TestCompiler compiler = new TestCompiler(this.tempDir);
|
||||
compiler.getTask(target).call(processor);
|
||||
}
|
||||
|
||||
|
||||
@@ -16,6 +16,7 @@
|
||||
|
||||
package org.springframework.boot.configurationprocessor.fieldvalues;
|
||||
|
||||
import java.io.File;
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
import java.util.Set;
|
||||
@@ -29,9 +30,8 @@ import javax.lang.model.SourceVersion;
|
||||
import javax.lang.model.element.Element;
|
||||
import javax.lang.model.element.TypeElement;
|
||||
|
||||
import org.junit.Rule;
|
||||
import org.junit.Test;
|
||||
import org.junit.rules.TemporaryFolder;
|
||||
import org.junit.jupiter.api.Test;
|
||||
import org.junit.jupiter.api.io.TempDir;
|
||||
|
||||
import org.springframework.boot.configurationsample.fieldvalues.FieldValues;
|
||||
import org.springframework.boot.testsupport.compiler.TestCompiler;
|
||||
@@ -46,15 +46,15 @@ import static org.assertj.core.api.Assertions.assertThat;
|
||||
*/
|
||||
public abstract class AbstractFieldValuesProcessorTests {
|
||||
|
||||
@Rule
|
||||
public TemporaryFolder temporaryFolder = new TemporaryFolder();
|
||||
@TempDir
|
||||
File tempDir;
|
||||
|
||||
protected abstract FieldValuesParser createProcessor(ProcessingEnvironment env);
|
||||
|
||||
@Test
|
||||
public void getFieldValues() throws Exception {
|
||||
void getFieldValues() throws Exception {
|
||||
TestProcessor processor = new TestProcessor();
|
||||
TestCompiler compiler = new TestCompiler(this.temporaryFolder);
|
||||
TestCompiler compiler = new TestCompiler(this.tempDir);
|
||||
compiler.getTask(FieldValues.class).call(processor);
|
||||
Map<String, Object> values = processor.getValues();
|
||||
assertThat(values.get("string")).isEqualTo("1");
|
||||
|
||||
@@ -18,11 +18,11 @@ package org.springframework.boot.configurationprocessor.fieldvalues.javac;
|
||||
|
||||
import javax.annotation.processing.ProcessingEnvironment;
|
||||
|
||||
import org.opentest4j.TestAbortedException;
|
||||
|
||||
import org.springframework.boot.configurationprocessor.fieldvalues.AbstractFieldValuesProcessorTests;
|
||||
import org.springframework.boot.configurationprocessor.fieldvalues.FieldValuesParser;
|
||||
|
||||
import static org.junit.Assume.assumeNoException;
|
||||
|
||||
/**
|
||||
* Tests for {@link JavaCompilerFieldValuesParser}.
|
||||
*
|
||||
@@ -36,8 +36,7 @@ public class JavaCompilerFieldValuesProcessorTests extends AbstractFieldValuesPr
|
||||
return new JavaCompilerFieldValuesParser(env);
|
||||
}
|
||||
catch (Throwable ex) {
|
||||
assumeNoException(ex);
|
||||
throw new IllegalStateException();
|
||||
throw new TestAbortedException();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -16,7 +16,7 @@
|
||||
|
||||
package org.springframework.boot.configurationprocessor.metadata;
|
||||
|
||||
import org.junit.Test;
|
||||
import org.junit.jupiter.api.Test;
|
||||
|
||||
import static org.assertj.core.api.Assertions.assertThat;
|
||||
|
||||
@@ -25,55 +25,55 @@ import static org.assertj.core.api.Assertions.assertThat;
|
||||
*
|
||||
* @author Stephane Nicoll
|
||||
*/
|
||||
public class ConfigurationMetadataTests {
|
||||
class ConfigurationMetadataTests {
|
||||
|
||||
@Test
|
||||
public void toDashedCaseCamelCase() {
|
||||
void toDashedCaseCamelCase() {
|
||||
assertThat(toDashedCase("simpleCamelCase")).isEqualTo("simple-camel-case");
|
||||
}
|
||||
|
||||
@Test
|
||||
public void toDashedCaseUpperCamelCaseSuffix() {
|
||||
void toDashedCaseUpperCamelCaseSuffix() {
|
||||
assertThat(toDashedCase("myDLQ")).isEqualTo("my-d-l-q");
|
||||
}
|
||||
|
||||
@Test
|
||||
public void toDashedCaseUpperCamelCaseMiddle() {
|
||||
void toDashedCaseUpperCamelCaseMiddle() {
|
||||
assertThat(toDashedCase("someDLQKey")).isEqualTo("some-d-l-q-key");
|
||||
}
|
||||
|
||||
@Test
|
||||
public void toDashedCaseWordsUnderscore() {
|
||||
void toDashedCaseWordsUnderscore() {
|
||||
assertThat(toDashedCase("Word_With_underscore")).isEqualTo("word-with-underscore");
|
||||
}
|
||||
|
||||
@Test
|
||||
public void toDashedCaseWordsSeveralUnderscores() {
|
||||
void toDashedCaseWordsSeveralUnderscores() {
|
||||
assertThat(toDashedCase("Word___With__underscore")).isEqualTo("word---with--underscore");
|
||||
}
|
||||
|
||||
@Test
|
||||
public void toDashedCaseLowerCaseUnderscore() {
|
||||
void toDashedCaseLowerCaseUnderscore() {
|
||||
assertThat(toDashedCase("lower_underscore")).isEqualTo("lower-underscore");
|
||||
}
|
||||
|
||||
@Test
|
||||
public void toDashedCaseUpperUnderscoreSuffix() {
|
||||
void toDashedCaseUpperUnderscoreSuffix() {
|
||||
assertThat(toDashedCase("my_DLQ")).isEqualTo("my-d-l-q");
|
||||
}
|
||||
|
||||
@Test
|
||||
public void toDashedCaseUpperUnderscoreMiddle() {
|
||||
void toDashedCaseUpperUnderscoreMiddle() {
|
||||
assertThat(toDashedCase("some_DLQ_key")).isEqualTo("some-d-l-q-key");
|
||||
}
|
||||
|
||||
@Test
|
||||
public void toDashedCaseMultipleUnderscores() {
|
||||
void toDashedCaseMultipleUnderscores() {
|
||||
assertThat(toDashedCase("super___crazy")).isEqualTo("super---crazy");
|
||||
}
|
||||
|
||||
@Test
|
||||
public void toDashedCaseLowercase() {
|
||||
void toDashedCaseLowercase() {
|
||||
assertThat(toDashedCase("lowercase")).isEqualTo("lowercase");
|
||||
}
|
||||
|
||||
|
||||
@@ -16,7 +16,7 @@
|
||||
|
||||
package org.springframework.boot.configurationprocessor.metadata;
|
||||
|
||||
import org.junit.Test;
|
||||
import org.junit.jupiter.api.Test;
|
||||
|
||||
import static org.assertj.core.api.Assertions.assertThat;
|
||||
|
||||
@@ -25,20 +25,20 @@ import static org.assertj.core.api.Assertions.assertThat;
|
||||
*
|
||||
* @author Stephane Nicoll
|
||||
*/
|
||||
public class ItemMetadataTests {
|
||||
class ItemMetadataTests {
|
||||
|
||||
@Test
|
||||
public void newItemMetadataPrefixWithCapitalizedPrefix() {
|
||||
void newItemMetadataPrefixWithCapitalizedPrefix() {
|
||||
assertThat(newItemMetadataPrefix("Prefix.", "value")).isEqualTo("prefix.value");
|
||||
}
|
||||
|
||||
@Test
|
||||
public void newItemMetadataPrefixWithCamelCaseSuffix() {
|
||||
void newItemMetadataPrefixWithCamelCaseSuffix() {
|
||||
assertThat(newItemMetadataPrefix("prefix.", "myValue")).isEqualTo("prefix.my-value");
|
||||
}
|
||||
|
||||
@Test
|
||||
public void newItemMetadataPrefixWithUpperCamelCaseSuffix() {
|
||||
void newItemMetadataPrefixWithUpperCamelCaseSuffix() {
|
||||
assertThat(newItemMetadataPrefix("prefix.", "MyValue")).isEqualTo("prefix.my-value");
|
||||
}
|
||||
|
||||
|
||||
@@ -23,7 +23,7 @@ import java.io.InputStream;
|
||||
import java.util.Arrays;
|
||||
import java.util.Collections;
|
||||
|
||||
import org.junit.Test;
|
||||
import org.junit.jupiter.api.Test;
|
||||
|
||||
import static org.assertj.core.api.Assertions.assertThat;
|
||||
|
||||
@@ -33,10 +33,10 @@ import static org.assertj.core.api.Assertions.assertThat;
|
||||
* @author Phillip Webb
|
||||
* @author Stephane Nicoll
|
||||
*/
|
||||
public class JsonMarshallerTests {
|
||||
class JsonMarshallerTests {
|
||||
|
||||
@Test
|
||||
public void marshallAndUnmarshal() throws Exception {
|
||||
void marshallAndUnmarshal() throws Exception {
|
||||
ConfigurationMetadata metadata = new ConfigurationMetadata();
|
||||
metadata.add(ItemMetadata.newProperty("a", "b", StringBuffer.class.getName(), InputStream.class.getName(),
|
||||
"sourceMethod", "desc", "x", new ItemDeprecation("Deprecation comment", "b.c.d")));
|
||||
@@ -69,7 +69,7 @@ public class JsonMarshallerTests {
|
||||
}
|
||||
|
||||
@Test
|
||||
public void marshallOrderItems() throws IOException {
|
||||
void marshallOrderItems() throws IOException {
|
||||
ConfigurationMetadata metadata = new ConfigurationMetadata();
|
||||
metadata.add(ItemHint.newHint("fff"));
|
||||
metadata.add(ItemHint.newHint("eee"));
|
||||
@@ -89,7 +89,7 @@ public class JsonMarshallerTests {
|
||||
}
|
||||
|
||||
@Test
|
||||
public void marshallPutDeprecatedItemsAtTheEnd() throws IOException {
|
||||
void marshallPutDeprecatedItemsAtTheEnd() throws IOException {
|
||||
ConfigurationMetadata metadata = new ConfigurationMetadata();
|
||||
metadata.add(ItemMetadata.newProperty("com.example.bravo", "bbb", null, null, null, null, null, null));
|
||||
metadata.add(ItemMetadata.newProperty("com.example.bravo", "aaa", null, null, null, null, null,
|
||||
|
||||
Reference in New Issue
Block a user