Skip to content

Commit 9be08c3

Browse files
committed
Add null bean property test
Covers the null-return path in `ConfigurationPropertyUtils#newConfigurationPropertiesBeanProperty` by asserting an instance `Bindable` does not produce a bean property.
1 parent 6d3dc34 commit 9be08c3

1 file changed

Lines changed: 7 additions & 0 deletions

File tree

microsphere-spring-boot-core/src/test/java/io/microsphere/spring/boot/context/properties/source/util/ConfigurationPropertyUtilsTest.java

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,7 @@
4242
import static org.junit.jupiter.api.Assertions.assertSame;
4343
import static org.mockito.Mockito.mock;
4444
import static org.mockito.Mockito.when;
45+
import static org.springframework.boot.context.properties.bind.Bindable.ofInstance;
4546
import static org.springframework.boot.context.properties.source.ConfigurationPropertyName.EMPTY;
4647
import static org.springframework.boot.context.properties.source.ConfigurationPropertyName.of;
4748

@@ -112,4 +113,10 @@ public void onSuccess(ConfigurationPropertyName name, Bindable<?> target, BindCo
112113
});
113114
assertNotNull(serverProperties);
114115
}
116+
117+
@Test
118+
void testNewConfigurationPropertiesBeanPropertyOnNull() {
119+
Bindable<String> bindable = ofInstance("test");
120+
assertNull(newConfigurationPropertiesBeanProperty(bindable));
121+
}
115122
}

0 commit comments

Comments
 (0)