OOoRunner test harness

lib
Class TestEnvironment

java.lang.Object
  |
  +--lib.TestEnvironment

public class TestEnvironment
extends Object

The class contains an instance of a given implementation object and auxiliary objects associated with it and required for the object testing.

See Also:
TestCase

Field Summary
protected  boolean disposed
          Indicates that the testObject is in invalid state and should notbe used for testing anymore.
protected  Hashtable relations
          Contains object relations - auxiliary objects associated with the tested object and required for testing.
protected  XInterface testObject
          An instance of the tested implementation object.
 
Constructor Summary
TestEnvironment(XInterface testObject)
          Creates an instance of test environment with testObject.
 
Method Summary
 void addObjRelation(String name, Object relation)
          Adds to the environment an auxiliary object required for testing.
 void dispose()
          Makes the environment invalid, i.e.
 Object getObjRelation(String name)
          Returns an auxiliary object referenced by tname.
 TestCase getTestCase()
           
 XInterface getTestObject()
           
 boolean hasObjRelation(String name)
          Checks if an auxiliary object has been registered with name
 boolean isDisposed()
          Checks if the environment has been disposed.
 void setTestCase(TestCase tCase)
          Sets the TestCase that created the environment.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

relations

protected Hashtable relations
Contains object relations - auxiliary objects associated with the tested object and required for testing.

testObject

protected XInterface testObject
An instance of the tested implementation object.

disposed

protected boolean disposed
Indicates that the testObject is in invalid state and should notbe used for testing anymore.
Constructor Detail

TestEnvironment

public TestEnvironment(XInterface testObject)
Creates an instance of test environment with testObject.
Parameters:
testObject - object to test
Throws:
IllegalArgumentException - if the testObject is null.
Method Detail

getTestObject

public XInterface getTestObject()
Returns:
the object to test.

addObjRelation

public void addObjRelation(String name,
                           Object relation)
Adds to the environment an auxiliary object required for testing.
Parameters:
name - a name to reference the auxiliary object
relation - the auxiliary object related to the tested one

getObjRelation

public Object getObjRelation(String name)
Returns an auxiliary object referenced by tname.
Parameters:
name - a name of the object relation
Returns:
the auxiliary object(object relation)

hasObjRelation

public boolean hasObjRelation(String name)
Checks if an auxiliary object has been registered with name
Parameters:
name - a name referencing an auxiliarx object
Returns:
true if the object has been associated, false otherwise.

setTestCase

public void setTestCase(TestCase tCase)
Sets the TestCase that created the environment.

getTestCase

public TestCase getTestCase()
Returns:
the TestCase created the environment.

dispose

public void dispose()
Makes the environment invalid, i.e. it should not be used for testing anymore.

isDisposed

public boolean isDisposed()
Checks if the environment has been disposed.
Returns:
truefalse otherwise.
See Also:
dispose()

OOoRunner test harness