Class BeanPropertySetter
java.lang.Object
org.mockito.internal.util.reflection.BeanPropertySetter
This utility class will call the setter of the property to inject a new value.
-
Constructor Summary
ConstructorsConstructorDescriptionBeanPropertySetter(Object target, Field propertyField) New BeanPropertySetter that don't report failureBeanPropertySetter(Object target, Field propertyField, boolean reportNoSetterFound) New BeanPropertySetter -
Method Summary
Modifier and TypeMethodDescriptionbooleanSet the value to the property represented by thisBeanPropertySetter
-
Constructor Details
-
BeanPropertySetter
New BeanPropertySetter- Parameters:
target- The target on which the setter must be invokedpropertyField- The field that should be accessed with the setterreportNoSetterFound- Allow the set method to raise an Exception if the setter cannot be found
-
BeanPropertySetter
New BeanPropertySetter that don't report failure- Parameters:
target- The target on which the setter must be invokedpropertyField- The propertyField that must be accessed through a setter
-
-
Method Details
-
set
Set the value to the property represented by thisBeanPropertySetter- Parameters:
value- the new value to pass to the property setter- Returns:
trueif the value has been injected,falseotherwise- Throws:
RuntimeException- Can be thrown if the setter threw an exception, if the setter is not accessible or, ifreportNoSetterFoundand setter could not be found.
-