|
20 | 20 |
|
21 | 21 | import org.springframework.boot.configurationprocessor.metadata.ConfigurationMetadata; |
22 | 22 | import org.springframework.boot.configurationprocessor.metadata.Metadata; |
23 | | -import org.springframework.boot.configurationsample.immutable.ConstructorParameterNameAnnotationProperties; |
24 | | -import org.springframework.boot.configurationsample.immutable.JavaBeanNameAnnotationProperties; |
25 | | -import org.springframework.boot.configurationsample.immutable.RecordComponentNameAnnotationProperties; |
| 23 | +import org.springframework.boot.configurationsample.name.ConstructorParameterNameAnnotationProperties; |
| 24 | +import org.springframework.boot.configurationsample.name.JavaBeanNameAnnotationProperties; |
| 25 | +import org.springframework.boot.configurationsample.name.LombokNameAnnotationProperties; |
| 26 | +import org.springframework.boot.configurationsample.name.RecordComponentNameAnnotationProperties; |
26 | 27 |
|
27 | 28 | import static org.assertj.core.api.Assertions.assertThat; |
28 | 29 |
|
29 | 30 | /** |
30 | 31 | * Metadata generation tests for using {@code @Name}. |
31 | 32 | * |
32 | 33 | * @author Phillip Webb |
| 34 | + * @author Stephane Nicoll |
33 | 35 | */ |
34 | 36 | class NameAnnotationPropertiesTests extends AbstractMetadataGenerationTests { |
35 | 37 |
|
36 | 38 | @Test |
37 | 39 | void constructorParameterNameAnnotationProperties() { |
38 | 40 | ConfigurationMetadata metadata = compile(ConstructorParameterNameAnnotationProperties.class); |
39 | | - assertThat(metadata).has(Metadata.withProperty("named.import", String.class) |
40 | | - .fromSource(ConstructorParameterNameAnnotationProperties.class)); |
| 41 | + assertThat(metadata) |
| 42 | + .has(Metadata.withProperty("named.import", String.class) |
| 43 | + .fromSource(ConstructorParameterNameAnnotationProperties.class) |
| 44 | + .withDescription("Imports to apply.")) |
| 45 | + .has(Metadata.withProperty("named.default", Boolean.class) |
| 46 | + .fromSource(ConstructorParameterNameAnnotationProperties.class) |
| 47 | + .withDefaultValue("Whether default mode is enabled.") |
| 48 | + .withDefaultValue(true)); |
41 | 49 | } |
42 | 50 |
|
43 | 51 | @Test |
44 | 52 | void recordComponentNameAnnotationProperties() { |
45 | 53 | ConfigurationMetadata metadata = compile(RecordComponentNameAnnotationProperties.class); |
46 | | - assertThat(metadata).has(Metadata.withProperty("named.import", String.class) |
47 | | - .fromSource(RecordComponentNameAnnotationProperties.class)); |
| 54 | + assertThat(metadata) |
| 55 | + .has(Metadata.withProperty("named.import", String.class) |
| 56 | + .fromSource(RecordComponentNameAnnotationProperties.class) |
| 57 | + .withDescription("Imports to apply.")) |
| 58 | + .has(Metadata.withProperty("named.default", Boolean.class) |
| 59 | + .fromSource(RecordComponentNameAnnotationProperties.class) |
| 60 | + .withDefaultValue("Whether default mode is enabled.") |
| 61 | + .withDefaultValue(true)); |
48 | 62 | } |
49 | 63 |
|
50 | 64 | @Test |
51 | 65 | void javaBeanNameAnnotationProperties() { |
52 | 66 | ConfigurationMetadata metadata = compile(JavaBeanNameAnnotationProperties.class); |
53 | | - assertThat(metadata).has( |
54 | | - Metadata.withProperty("named.import", String.class).fromSource(JavaBeanNameAnnotationProperties.class)); |
| 67 | + assertThat(metadata) |
| 68 | + .has(Metadata.withProperty("named.import", String.class) |
| 69 | + .fromSource(JavaBeanNameAnnotationProperties.class) |
| 70 | + .withDescription("Imports to apply.")) |
| 71 | + .has(Metadata.withProperty("named.default", Boolean.class) |
| 72 | + .fromSource(JavaBeanNameAnnotationProperties.class) |
| 73 | + .withDefaultValue("Whether default mode is enabled.") |
| 74 | + .withDefaultValue(true)); |
| 75 | + } |
| 76 | + |
| 77 | + @Test |
| 78 | + void lombokNameAnnotationProperties() { |
| 79 | + ConfigurationMetadata metadata = compile(LombokNameAnnotationProperties.class); |
| 80 | + assertThat(metadata) |
| 81 | + .has(Metadata.withProperty("named.import", String.class) |
| 82 | + .fromSource(LombokNameAnnotationProperties.class) |
| 83 | + .withDescription("Imports to apply.")) |
| 84 | + .has(Metadata.withProperty("named.default", Boolean.class) |
| 85 | + .fromSource(LombokNameAnnotationProperties.class) |
| 86 | + .withDefaultValue("Whether default mode is enabled.") |
| 87 | + .withDefaultValue(true)); |
55 | 88 | } |
56 | 89 |
|
57 | 90 | } |
0 commit comments