diff --git a/spring-boot-project/spring-boot-tools/spring-boot-configuration-processor/src/test/java/org/springframework/boot/configurationprocessor/PropertyDescriptorResolverTests.java b/spring-boot-project/spring-boot-tools/spring-boot-configuration-processor/src/test/java/org/springframework/boot/configurationprocessor/PropertyDescriptorResolverTests.java index 7fc50d0d56..7f4be37583 100644 --- a/spring-boot-project/spring-boot-tools/spring-boot-configuration-processor/src/test/java/org/springframework/boot/configurationprocessor/PropertyDescriptorResolverTests.java +++ b/spring-boot-project/spring-boot-tools/spring-boot-configuration-processor/src/test/java/org/springframework/boot/configurationprocessor/PropertyDescriptorResolverTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2012-2024 the original author or authors. + * Copyright 2012-2025 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -58,6 +58,7 @@ import static org.assertj.core.api.Assertions.assertThat; * * @author Stephane Nicoll * @author Scott Frederick + * @author Yanming Zhou */ class PropertyDescriptorResolverTests { @@ -79,9 +80,13 @@ class PropertyDescriptorResolverTests { .map((descriptor) -> descriptor.getGetter().getEnclosingElement().getSimpleName().toString())) .containsExactly("HierarchicalProperties", "HierarchicalPropertiesParent", "HierarchicalPropertiesParent"); - assertThat(resolver.resolve(type, null) + List itemMetadataList = resolver.resolve(type, null) .map((descriptor) -> descriptor.resolveItemMetadata("test", metadataEnv)) - .map(ItemMetadata::getDefaultValue)).containsExactly("three", "two", "one"); + .toList(); + assertThat(itemMetadataList).map(ItemMetadata::getDefaultValue) + .containsExactly("three", "two", "one"); + assertThat(itemMetadataList).map(ItemMetadata::getDescription) + .containsExactly("Concrete property.", "Parent property.", "Grandparent property."); }); } diff --git a/spring-boot-project/spring-boot-tools/spring-boot-configuration-processor/src/test/java/org/springframework/boot/configurationsample/simple/HierarchicalProperties.java b/spring-boot-project/spring-boot-tools/spring-boot-configuration-processor/src/test/java/org/springframework/boot/configurationsample/simple/HierarchicalProperties.java index 76e99e52ab..46b64ce41d 100644 --- a/spring-boot-project/spring-boot-tools/spring-boot-configuration-processor/src/test/java/org/springframework/boot/configurationsample/simple/HierarchicalProperties.java +++ b/spring-boot-project/spring-boot-tools/spring-boot-configuration-processor/src/test/java/org/springframework/boot/configurationsample/simple/HierarchicalProperties.java @@ -26,6 +26,9 @@ import org.springframework.boot.configurationsample.ConfigurationProperties; @ConfigurationProperties("hierarchical") public class HierarchicalProperties extends HierarchicalPropertiesParent { + /** + * Concrete property. + */ private String third = "three"; public String getThird() { diff --git a/spring-boot-project/spring-boot-tools/spring-boot-configuration-processor/src/test/java/org/springframework/boot/configurationsample/simple/HierarchicalPropertiesGrandparent.java b/spring-boot-project/spring-boot-tools/spring-boot-configuration-processor/src/test/java/org/springframework/boot/configurationsample/simple/HierarchicalPropertiesGrandparent.java index 6026c94e1f..debfcec229 100644 --- a/spring-boot-project/spring-boot-tools/spring-boot-configuration-processor/src/test/java/org/springframework/boot/configurationsample/simple/HierarchicalPropertiesGrandparent.java +++ b/spring-boot-project/spring-boot-tools/spring-boot-configuration-processor/src/test/java/org/springframework/boot/configurationsample/simple/HierarchicalPropertiesGrandparent.java @@ -1,5 +1,5 @@ /* - * Copyright 2012-2019 the original author or authors. + * Copyright 2012-2025 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -23,6 +23,9 @@ package org.springframework.boot.configurationsample.simple; */ public abstract class HierarchicalPropertiesGrandparent { + /** + * Grandparent property. + */ private String first = "one"; public String getFirst() { diff --git a/spring-boot-project/spring-boot-tools/spring-boot-configuration-processor/src/test/java/org/springframework/boot/configurationsample/simple/HierarchicalPropertiesParent.java b/spring-boot-project/spring-boot-tools/spring-boot-configuration-processor/src/test/java/org/springframework/boot/configurationsample/simple/HierarchicalPropertiesParent.java index b436470f05..6250a1e2c1 100644 --- a/spring-boot-project/spring-boot-tools/spring-boot-configuration-processor/src/test/java/org/springframework/boot/configurationsample/simple/HierarchicalPropertiesParent.java +++ b/spring-boot-project/spring-boot-tools/spring-boot-configuration-processor/src/test/java/org/springframework/boot/configurationsample/simple/HierarchicalPropertiesParent.java @@ -1,5 +1,5 @@ /* - * Copyright 2012-2020 the original author or authors. + * Copyright 2012-2025 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -23,6 +23,9 @@ package org.springframework.boot.configurationsample.simple; */ public abstract class HierarchicalPropertiesParent extends HierarchicalPropertiesGrandparent { + /** + * Parent property. + */ private String second = "two"; public String getSecond() {