Skip to content

Improve test to verify that property description is resolved from super class #45382

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -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.
Expand Down Expand Up @@ -56,6 +56,7 @@
*
* @author Stephane Nicoll
* @author Scott Frederick
* @author Yanming Zhou
*/
class PropertyDescriptorResolverTests {

Expand All @@ -77,9 +78,13 @@ void propertiesWithJavaBeanHierarchicalProperties() {
.map((descriptor) -> descriptor.getGetter().getEnclosingElement().getSimpleName().toString()))
.containsExactly("HierarchicalProperties", "HierarchicalPropertiesParent",
"HierarchicalPropertiesParent");
assertThat(resolver.resolve(type, null)
List<ItemMetadata> 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("I'm third", "I'm second", "I'm first");
});
}

Expand Down
Original file line number Diff line number Diff line change
@@ -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.
Expand All @@ -26,6 +26,9 @@
@ConfigurationProperties(prefix = "hierarchical")
public class HierarchicalProperties extends HierarchicalPropertiesParent {

/**
* I'm third
*/
private String third = "three";

public String getThird() {
Expand Down
Original file line number Diff line number Diff line change
@@ -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.
Expand All @@ -23,6 +23,9 @@
*/
public abstract class HierarchicalPropertiesGrandparent {

/**
* I'm first
*/
private String first = "one";

public String getFirst() {
Expand Down
Original file line number Diff line number Diff line change
@@ -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.
Expand All @@ -23,6 +23,9 @@
*/
public abstract class HierarchicalPropertiesParent extends HierarchicalPropertiesGrandparent {

/**
* I'm second
*/
private String second = "two";

public String getSecond() {
Expand Down