* An empty DataGraph can have a root assigned by the createRootObject() methods.
* However, if a previous root DataObject exists than an IllegalStateException is
* thrown.
*/
public void testCreateRootObjectAgainIllegalStateException() {
DataGraph dataGraph = SDOUtil.createDataGraph();
Type type = testDO.getType();
// verify the initial condition
assertNull("The DataGraph should have been created without a root DataObject.", dataGraph.getRootObject());
assertNotNull("DataObject.getType() returned null.", type);
dataGraph.createRootObject(type);
// verify the pre-condition
assertNotNull("The DataGraph.createRootObject() should have created a root DataObject for the DataGraph.", dataGraph.getRootObject());
try {
dataGraph.createRootObject(type);
fail("DataGraph.createRootObject(Type) should throw an IllegalStateException a root Object already exists for the DataGraph. No Exception was thrown.");
} catch (IllegalStateException e) {
// Success - do nothing
} catch (Exception e) {
fail("DataGraph.createRootObject(Type) should throw an IllegalStateException a root Object already exists for the DataGraph. " + e.getClass().getName() + " was thrown.");