<objs><obj id="myId" type="my.class.Type" hint="myParseHint">...</obj><objs>
Defining objects inside of the xml data files of DDTUnit should be as
clear and easy as to write the appropriate code in Java.
To achieve this the object structure was mapped onto the xml definition as
straight as possible.
As a starting point the following object types are supported:
- all objects that contain a constructor of the form
- all objects containing a default constructor and using (even private)
field definitions can be generated.
Java reflection is used to map xml field names on objects field definitions.
- all objects containing a default constructor and using setter methods
according to JavaBean spec can be generated.
Generic Bean Structures)
- For now two container object implementations are supported. (See
- Calling constructor or static methods of object is supported in a first
- Constants are supported as defined by static fields of classes and
typesafe enumerations. (See
- Special data types and keywords. (See
Shortcut notation using object type abbreviation. (See
The testdata can be accessed by using the following API called from
public Object getObject(String id); // or
public Object getObject(String id, String type);
public Object getGlobalObject(String id); // or
public Object getGlobalObject(String id, String type);
public Object getResourceObject(String id); // or
public Object getResourceObject(String id, String type);
A general remark on XML structure used for object definition. Basically
every object definition possesses three attributes to describe it.
- obj@id and obj@type allow identification of
objects. If there are only a few objects defined per test and these are
uniquely identified by using the obj@id the first method can
be used. If multiple objects were found this method will throw a
DDTException and the second method definition must be used.
- obj@hint - (Default: fields) specifies parsing information
for internal processing