public class BeanPropertyTester extends Object
| Constructor and Description |
|---|
BeanPropertyTester() |
| Modifier and Type | Method and Description |
|---|---|
void |
testProperty(Object bean,
PropertyInformation property,
Object testValue,
EqualityTest equalityTest)
Test the property specified by the propertyInformation parameter on the specified bean object using the specified
testValue.
|
protected boolean |
typesAreCompatible(Class<?> classA,
Type superType)
Are the specified compatible?
|
public void testProperty(Object bean, PropertyInformation property, Object testValue, EqualityTest equalityTest) throws IllegalArgumentException, AssertionError, BeanTestException
Test the property specified by the propertyInformation parameter on the specified bean object using the specified testValue.
The test is performed by setting the property of the specified bean to the specified testValue via the property setter method, then getting the value of the property via the property getter method and asserting that the obtained value matches the testValue. This tests the getter and setter methods of the property.
bean - The object the property should be tested on.property - Information about the property to be tested.testValue - The value to use when testing the property.equalityTest - The equality test to perform during testing: Logical (logically equivalence, that is x.equals(y)) or
Absolute (that is x == y).IllegalArgumentException - If any of the parameters are deemed illegal. For example, if any are null, if the
property is not readable and writable, or if the type of the testValue does not match the property
type.AssertionError - If the test fails.BeanTestException - If an unexpected exception occurs during testing.protected boolean typesAreCompatible(Class<?> classA, Type superType)
classA - A type to compare.superType - Another type to compare. If it is possible that one of the types might be a superclass of the other,
specify that type here.true if the specified types are compatible; false otherwise.Copyright © 2010–2020 meanbean. All rights reserved.