@Test
public void testBuildHierarchicalList() {

	// Series 0
	List<Instance> instances = InstanceHelpers.buildHierarchicalList( null );
	Assert.assertEquals( 0, instances.size());
	// Series 1
	Instance instance_1 = new Instance( "inst 1" );
	instances = InstanceHelpers.buildHierarchicalList( instance_1 );
	Assert.assertEquals( 1, instances.size());
	Assert.assertEquals( instance_1, instances.get( 0 ));
	// Series 2
	Instance instance_1_1 = new Instance( "inst 11" );
	InstanceHelpers.insertChild( instance_1, instance_1_1 );
	instances = InstanceHelpers.buildHierarchicalList( instance_1 );
	Assert.assertEquals( 2, instances.size());
	Assert.assertEquals( instance_1, instances.get( 0 ));
	Assert.assertEquals( instance_1_1, instances.get( 1 ));
	// Series 3
	Instance instance_1_2 = new Instance( "inst 12" );
	InstanceHelpers.insertChild( instance_1, instance_1_2 );
	Instance instance_1_1_1 = new Instance( "inst 111" );
	InstanceHelpers.insertChild( instance_1_1, instance_1_1_1 );
	Instance instance_1_2_1 = new Instance( "inst 121" );
	InstanceHelpers.insertChild( instance_1_2, instance_1_2_1 );
	instances = InstanceHelpers.buildHierarchicalList( instance_1 );
	Assert.assertEquals( 5, instances.size());
	Assert.assertEquals( instance_1, instances.get( 0 ));
	Assert.assertEquals( instance_1_1, instances.get( 1 ));
	Assert.assertEquals( instance_1_2, instances.get( 2 ));
	Assert.assertEquals( instance_1_1_1, instances.get( 3 ));
	Assert.assertEquals( instance_1_2_1, instances.get( 4 ));
}