OOoRunner test harness

lib
Class MultiPropertyTest

java.lang.Object
  |
  +--lib.MultiMethodTest
        |
        +--lib.MultiPropertyTest

public class MultiPropertyTest
extends MultiMethodTest

MultiPropertyTest extends the functionality of MultiMethodTest to support services testing. Since, in most cases, service tests has one method testing most of its properties, the MultiPropertyTest provides unified version of the method: testProperty().

The testProperty() is called, when the MultiMethodTest's testing method is not found in the subclass. So, by defining such methods for properties the standard testing behavioutr can be changed.

The testing behaviour also can be changed by overriding compare(), getNewVAlue() or toString(Object) methods, or by extending PropertyTester class.

See Also:
MultiMethodTest, testProperty(String), #testProperty(String, Propertytester), #getNewValue, compare(java.lang.Object, java.lang.Object), toString(Object)

Inner Class Summary
 class 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).
 class MultiPropertyTest.PropertyValueSwitcher
          Extension for PropertyTester which switches two different values.
 
Field Summary
 XPropertySet oObj
          Contains a XPropertySet interface of the tested object.
protected  boolean optionalService
           
 
Fields inherited from class lib.MultiMethodTest
entry, log, tEnv, tParam, tRes
 
Constructor Summary
MultiPropertyTest()
           
 
Method Summary
protected  void before()
          Overrides super.before() to check the service is supported by the object.
protected  boolean compare(Object obj1, Object obj2)
          Compares two object.
protected  void invokeTestMethod(Method meth, String methName)
          Overrides MultiMethodTest.invokeTestMethod().
protected  void testProperty(String propName)
          The method performs testing of propName property.
protected  void testProperty(String propName, MultiPropertyTest.PropertyTester propTester)
          The method performs testing of propName property using propTester.
protected  void testProperty(String propName, Object val1, Object val2)
          Tests the property using PropertyValueSwitcher tester and two values for this property.
protected  String toString(Object obj)
          Gets string representation of the obj.
 
Methods inherited from class lib.MultiMethodTest
after, callMethod, disposeEnvironment, disposeEnvironment, executeMethod, getInterfaceName, getMethodFor, getStatusFor, getTestedClassName, isCalled, isOptional, requiredMethod, run, setField, setStatus, setSubStates
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

oObj

public XPropertySet oObj
Contains a XPropertySet interface of the tested object. Is initialized in MultiMethodTest code.

optionalService

protected boolean optionalService
Constructor Detail

MultiPropertyTest

public MultiPropertyTest()
Method Detail

before

protected void before()
Overrides super.before() to check the service is supported by the object.
Overrides:
before in class MultiMethodTest

invokeTestMethod

protected void invokeTestMethod(Method meth,
                                String methName)
Overrides MultiMethodTest.invokeTestMethod(). If the test for the meth is not available (meth == null) calls testProperty method for the method. Otherwise calls super.invokeTestMethod().
Overrides:
invokeTestMethod in class MultiMethodTest
See Also:
#MultiMethodTest.invokeTestMethod()

testProperty

protected void testProperty(String propName,
                            MultiPropertyTest.PropertyTester propTester)
The method performs testing of propName property using propTester.

testProperty

protected void testProperty(String propName)
The method performs testing of propName property. It uses PropertyTester instance for testing.

testProperty

protected void testProperty(String propName,
                            Object val1,
                            Object val2)
Tests the property using PropertyValueSwitcher tester and two values for this property.
See Also:
#PropertyValueSwitcher

compare

protected boolean compare(Object obj1,
                          Object obj2)
Compares two object. In the implementation calls obj1.equals(obj2).

toString

protected String toString(Object obj)
Gets string representation of the obj. In the implementation returns obj.toString().

OOoRunner test harness