|
OOoRunner test harness | |||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--lib.MultiPropertyTest.PropertyTester
PropertyTester class defines how to test a property and defined to allow subclasses of MultiPropertyTest to change the testing behaviour more flexible, since the behaviour can be customized for each property separately, by providing subclass of PropertyTester and passing it to testProperty(String, PropertyTester method).
Constructor Summary | |
MultiPropertyTest.PropertyTester()
|
Method Summary | |
protected void |
checkResult(String propName,
Object oldValue,
Object newValue,
Object resValue,
Exception exception)
The method checks result of setting a new value to the property based o the following arguments: |
protected boolean |
compare(Object obj1,
Object obj2)
The method compares obj1 and obj2. |
protected Object |
getNewValue(String propName,
Object oldValue)
The method produces new value of the property from the oldValue. |
protected void |
testProperty(String propName)
The method defines the whole process of testing propName property. |
protected String |
toString(Object obj)
The method returns a String representation of the obj. |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
public MultiPropertyTest.PropertyTester()
Method Detail |
protected void testProperty(String propName)
First, it checks if the property exists(it maybe optional). Then, a value to set the property with is calculated with getNewValue method. Normally, the new value is calculated based on old value, but subclasses can override the behaviour (for example, if old value is null) and specify their own value. Then the property is set with that new value and the result( it maybe an exception too, for example a PropertyVetoException) is checked with checkResult method.
propName
- - the property to test.protected void checkResult(String propName, Object oldValue, Object newValue, Object resValue, Exception exception) throws Exception
-
- if not null - the exception thrown by
XPropertySet.setPropertyValue, else indicates
normal method completion.
If the property is READ_ONLY, than either PropertyVetoException should be thrown or the value of property should not have changed (resValue is compared with oldValue with compare method).
If the property is not READ_ONLY, checks that the new value has been successfully set(resValue is compared with newValue with compare method).
If the exception is not null then(except the case of read-only property and PropertyVetoException above) it is rethrown to allow further catching it if needed.
Subclasses can override to change this behaviour.
protected Object getNewValue(String propName, Object oldValue) throws IllegalArgumentException
protected boolean compare(Object obj1, Object obj2)
protected String toString(Object obj)
|
OOoRunner test harness | |||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |