Skip to content

Commit 1f17592

Browse files
committed
fix: pass default value for required TestBean properties when they are not initialized
1 parent bf02362 commit 1f17592

1 file changed

Lines changed: 3 additions & 6 deletions

File tree

src/core/src/main/java/org/apache/jmeter/testbeans/TestBeanHelper.java

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -186,12 +186,9 @@ private static Object unwrapProperty(PropertyDescriptor desc, JMeterProperty jpr
186186
else if(jprop instanceof MultiProperty multiProperty)
187187
{
188188
value = unwrapCollection(multiProperty,(String)desc.getValue(TableEditor.CLASSNAME));
189-
}
190-
// value was not provided, and this is allowed
191-
else if (jprop instanceof NullProperty &&
192-
// use negative condition so missing (null) value is treated as FALSE
193-
! Boolean.TRUE.equals(desc.getValue(GenericTestBeanCustomizer.NOT_UNDEFINED))) {
194-
value=null;
189+
} else if (jprop instanceof NullProperty) {
190+
value = Boolean.TRUE.equals(desc.getValue(GenericTestBeanCustomizer.NOT_UNDEFINED))
191+
? desc.getValue(GenericTestBeanCustomizer.DEFAULT) : null;
195192
} else {
196193
value = Converter.convert(jprop.getStringValue(), type);
197194
}

0 commit comments

Comments
 (0)