Skip to content

Commit 20a25d7

Browse files
committed
Merge pull request #45382 from quaff
* pr/45382: Polish "Test that source information is resolved from super class" Test that source information is resolved from super class Closes gh-45382
2 parents 543de74 + 8810727 commit 20a25d7

File tree

4 files changed

+20
-6
lines changed

4 files changed

+20
-6
lines changed

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

Lines changed: 8 additions & 3 deletions
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.
@@ -56,6 +56,7 @@
5656
*
5757
* @author Stephane Nicoll
5858
* @author Scott Frederick
59+
* @author Yanming Zhou
5960
*/
6061
class PropertyDescriptorResolverTests {
6162

@@ -77,9 +78,13 @@ void propertiesWithJavaBeanHierarchicalProperties() {
7778
.map((descriptor) -> descriptor.getGetter().getEnclosingElement().getSimpleName().toString()))
7879
.containsExactly("HierarchicalProperties", "HierarchicalPropertiesParent",
7980
"HierarchicalPropertiesParent");
80-
assertThat(resolver.resolve(type, null)
81+
List<ItemMetadata> itemMetadataList = resolver.resolve(type, null)
8182
.map((descriptor) -> descriptor.resolveItemMetadata("test", metadataEnv))
82-
.map(ItemMetadata::getDefaultValue)).containsExactly("three", "two", "one");
83+
.toList();
84+
assertThat(itemMetadataList).map(ItemMetadata::getDefaultValue)
85+
.containsExactly("three", "two", "one");
86+
assertThat(itemMetadataList).map(ItemMetadata::getDescription)
87+
.containsExactly("Concrete property.", "Parent property.", "Grandparent property.");
8388
});
8489
}
8590

spring-boot-project/spring-boot-tools/spring-boot-configuration-processor/src/test/java/org/springframework/boot/configurationsample/simple/HierarchicalProperties.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.
@@ -26,6 +26,9 @@
2626
@ConfigurationProperties(prefix = "hierarchical")
2727
public class HierarchicalProperties extends HierarchicalPropertiesParent {
2828

29+
/**
30+
* Concrete property.
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+
* Grandparent property.
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+
* Parent property.
28+
*/
2629
private String second = "two";
2730

2831
public String getSecond() {

0 commit comments

Comments
 (0)