Skip to content

Commit fad882c

Browse files
committed
Improve test to verify that property description is resolved from super class
See spring-projectsGH-45381 Signed-off-by: Yanming Zhou <[email protected]>
1 parent 446c271 commit fad882c

File tree

4 files changed

+15
-3
lines changed

4 files changed

+15
-3
lines changed

spring-boot-project/spring-boot-tools/spring-boot-configuration-processor/src/test/java/org/springframework/boot/configurationprocessor/PropertyDescriptorResolverTests.java

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2012-2024 the original author or authors.
2+
* Copyright 2012-2025 the original author or authors.
33
*
44
* Licensed under the Apache License, Version 2.0 (the "License");
55
* you may not use this file except in compliance with the License.
@@ -82,6 +82,9 @@ void propertiesWithJavaBeanHierarchicalProperties() {
8282
assertThat(resolver.resolve(type, null)
8383
.map((descriptor) -> descriptor.resolveItemMetadata("test", metadataEnv))
8484
.map(ItemMetadata::getDefaultValue)).containsExactly("three", "two", "one");
85+
assertThat(resolver.resolve(type, null)
86+
.map((descriptor) -> descriptor.resolveItemMetadata("test", metadataEnv))
87+
.map(ItemMetadata::getDescription)).containsExactly("I'm third", "I'm second", "I'm first");
8588
});
8689
}
8790

spring-boot-project/spring-boot-tools/spring-boot-configuration-processor/src/test/java/org/springframework/boot/configurationsample/simple/HierarchicalProperties.java

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,9 @@
2626
@ConfigurationProperties("hierarchical")
2727
public class HierarchicalProperties extends HierarchicalPropertiesParent {
2828

29+
/**
30+
* I'm third
31+
*/
2932
private String third = "three";
3033

3134
public String getThird() {

spring-boot-project/spring-boot-tools/spring-boot-configuration-processor/src/test/java/org/springframework/boot/configurationsample/simple/HierarchicalPropertiesGrandparent.java

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2012-2019 the original author or authors.
2+
* Copyright 2012-2025 the original author or authors.
33
*
44
* Licensed under the Apache License, Version 2.0 (the "License");
55
* you may not use this file except in compliance with the License.
@@ -23,6 +23,9 @@
2323
*/
2424
public abstract class HierarchicalPropertiesGrandparent {
2525

26+
/**
27+
* I'm first
28+
*/
2629
private String first = "one";
2730

2831
public String getFirst() {

spring-boot-project/spring-boot-tools/spring-boot-configuration-processor/src/test/java/org/springframework/boot/configurationsample/simple/HierarchicalPropertiesParent.java

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2012-2020 the original author or authors.
2+
* Copyright 2012-2025 the original author or authors.
33
*
44
* Licensed under the Apache License, Version 2.0 (the "License");
55
* you may not use this file except in compliance with the License.
@@ -23,6 +23,9 @@
2323
*/
2424
public abstract class HierarchicalPropertiesParent extends HierarchicalPropertiesGrandparent {
2525

26+
/**
27+
* I'm second
28+
*/
2629
private String second = "two";
2730

2831
public String getSecond() {

0 commit comments

Comments
 (0)