Skip to content

Commit 845efae

Browse files
committed
Add constructor binding property assertions
Strengthen constructor-binding coverage by exposing getters on `TestConstructorBindingConfigurationProperties` and asserting its bound `name`/`value` fields in `EventPublishingConfigurationPropertiesBeanPropertyChangedListenerTest`. Also removes the now-unused `isConstructorBindingBean()` helper from `ConfigurationPropertiesBeanContext`.
1 parent 173715c commit 845efae

3 files changed

Lines changed: 17 additions & 9 deletions

File tree

microsphere-spring-boot-core/src/main/java/io/microsphere/spring/boot/context/properties/bind/ConfigurationPropertiesBeanContext.java

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -158,15 +158,6 @@ ResolvableType getBeanType() {
158158
return this.beanType;
159159
}
160160

161-
/**
162-
* Is the bean a constructor binding bean ?
163-
*
164-
* @return if the bean is a constructor binding bean , return {@code true} , else return {@code false}
165-
*/
166-
boolean isConstructorBindingBean() {
167-
return this.bindConstructor != null;
168-
}
169-
170161
/**
171162
* Get the prefix
172163
*

microsphere-spring-boot-core/src/test/java/io/microsphere/spring/boot/context/properties/TestConstructorBindingConfigurationProperties.java

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,4 +39,12 @@ public TestConstructorBindingConfigurationProperties(String name, String value)
3939
this.name = name;
4040
this.value = value;
4141
}
42+
43+
public String getName() {
44+
return name;
45+
}
46+
47+
public String getValue() {
48+
return value;
49+
}
4250
}

microsphere-spring-boot-core/src/test/java/io/microsphere/spring/boot/context/properties/bind/EventPublishingConfigurationPropertiesBeanPropertyChangedListenerTest.java

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -198,6 +198,15 @@ void testTestConfigurationProperties(int index) {
198198

199199
}
200200

201+
@Test
202+
void testTestConstructorBindingConfigurationProperties(int index) {
203+
if (index > 0) {
204+
return;
205+
}
206+
assertEquals("test-constructor-binding-name", this.testConstructorBindingConfigurationProperties.getName());
207+
assertEquals("test-constructor-binding-value", this.testConstructorBindingConfigurationProperties.getValue());
208+
}
209+
201210
void setProperty(String configurationPropertyName, String propertyValue, Object configurationPropertiesBean) {
202211
this.mockPropertySource.setProperty(configurationPropertyName, propertyValue);
203212
this.beanFactory.destroyBean(configurationPropertiesBean);

0 commit comments

Comments
 (0)