Class TestUtils
java.lang.Object
org.springframework.amqp.utils.test.TestUtils
Testing utilities.
- Since:
- 1.2
- Author:
- Mark Fisher, Iwein Fuld, Oleg Zhurakousky, Gary Russell, Ngoc Nhan, Artem Bilan
-
Method Summary
Modifier and TypeMethodDescriptionstatic <T> @Nullable TgetPropertyValue(Object root, String propertyPath) Uses nestedDirectFieldAccessors to obtain a property using dotted notation to traverse fields; e.g.static <T> @Nullable TgetPropertyValue(Object root, String propertyPath, Class<T> type) Deprecated, for removal: This API element is subject to removal in a future version.
-
Method Details
-
getPropertyValue
Uses nestedDirectFieldAccessors to obtain a property using dotted notation to traverse fields; e.g. "foo.bar.baz" will obtain a reference to the baz field of the bar field of foo. Adopted from Spring Integration.- Type Parameters:
T- the expected type of the value.- Parameters:
root- The object.propertyPath- The path.- Returns:
- The field.
-
getPropertyValue
@Deprecated(since="4.1", forRemoval=true) public static <T> @Nullable T getPropertyValue(Object root, String propertyPath, Class<T> type) Deprecated, for removal: This API element is subject to removal in a future version.since 4.1, usegetPropertyValue(Object, String)instead: there is no need in extra type check in tests.Uses nestedDirectFieldAccessors to get a property using dotted notation to traverse fields; e.g.prop.subProp.subSubPropwill get a reference to thesubSubPropfield of thesubPropfield ofpropprop from theroot.- Type Parameters:
T- the expected type of the value.- Parameters:
root- the object to get the property from.propertyPath- the path to the property. Can be a dotted notation for a nested property.type- the value expected type.- Returns:
- the property value.
-
getPropertyValue(Object, String)instead: there is no need in extra type check in tests.