ProcessDefinition processDefinition = new ProcessDefinition();
ProcessInstance pi = new ProcessInstance(processDefinition);
Token root = pi.getRootToken();
LoggingInstance li = (LoggingInstance) pi.getInstance(LoggingInstance.class);
ProcessLog one = new MessageLog(null);
li.addLog(one);
assertNull( one.getParent() );
assertSame( one, li.getLogs().get(1) );
assertEquals( 2, li.getLogs().size() );
assertEquals( 0, li.getCompositeLogStack().size() );
CompositeLog two = new CompositeLog();
two.setToken(root);
li.startCompositeLog(two);
assertNull( two.getParent() );
assertSame( two, li.getLogs().get(2) );
assertEquals( 3, li.getLogs().size() );
assertEquals( 1, li.getCompositeLogStack().size() );
ProcessLog three = new MessageLog(null);
li.addLog(three);
assertSame( two, three.getParent() );
assertSame( three, li.getLogs().get(3) );
assertEquals( 4, li.getLogs().size() );
assertEquals( 1, li.getCompositeLogStack().size() );
CompositeLog four = new CompositeLog();
four.setToken(root);
li.startCompositeLog(four);
assertSame( two, four.getParent() );
assertSame( four, li.getLogs().get(4) );
assertEquals( 5, li.getLogs().size() );
assertEquals( 2, li.getCompositeLogStack().size() );
ProcessLog five = new MessageLog(null);
li.addLog(five);
assertSame( four, five.getParent() );
assertSame( two, five.getParent().getParent() );
assertNull( five.getParent().getParent().getParent() );
assertSame( five, li.getLogs().get(5) );
assertEquals( 6, li.getLogs().size() );
assertEquals( 2, li.getCompositeLogStack().size() );
li.endCompositeLog();
assertEquals( 1, li.getCompositeLogStack().size() );
ProcessLog six = new MessageLog(null);
li.addLog(six);
assertSame( two, six.getParent() );
assertNull( six.getParent().getParent() );
assertSame( six, li.getLogs().get(6) );
assertEquals( 7, li.getLogs().size() );
assertEquals( 1, li.getCompositeLogStack().size() );
li.endCompositeLog();