Attributes of complex objects

Arguments that are based on primitive types (int, char, double, long, and so on), wrapped primitive types (for example Integer or Double), or Strings can be visualized as a single row in a test data table. Complex objects, on the other hand, cannot be visualized in a single row in the test data table and must be represented hierarchically in several table rows. Each row of a complex object is called an attribute.

The Rational Developer products give you several ways to define an object and its attributes: These definitions are based on:

When you click in the test data table in any cell that represents an object with defining attributes, you are presented with a list containing the different sets of defining attributes for the object, as shown in the following screen capture:

Example: test data table with defining attribute drop down

In this figure, several sets of defining attributes are provided for the object, which is of type Date.

When you choose one of the sets, the row representing the object expands to display the defining attributes that you have chosen for the object (in this case set properties), as shown in the following screen capture:

Example: test data table with defining attribute expansion

 

Object comparisons in validation action calls

An object's defining attributes are used not only to define the object in the test data table, but also to compare objects in a validation action. If class or interface-specific support has been used to initialize the object, the same support will be used to perform the comparison. If the object has been initialized by a constructor, the actual value will be compared to the expected value using the global comparison (the equals() method). If the object has been initialized by properties, actual values will be compared to expected values by comparing each property (attribute).

 

Working with interfaces and abstract classes

If the parameters or return types that you need to define are for an interface or abstract class, you will need to change the data type to a subclass that implements the interface or extends the abstract class in order to actually define the object's attributes. For example, the following method takes an IMoney interface as a parameter:

public add (IMoney m)

In the test data table, you will need to change the IMoney interface to a class that implements IMoney, such as Money. For details, see Using a subclass to initialize and test an object.

 

Java classes with special support

Special support is provided for the following classes:

 

Related tasks

Supplying test data for the attributes of object data types