EscherContainerRecord container1 = new EscherContainerRecord();
EscherContainerRecord spContainer1 = new EscherContainerRecord();
EscherContainerRecord spContainer2 = new EscherContainerRecord();
EscherContainerRecord spContainer3 = new EscherContainerRecord();
EscherSpRecord sp1 = new EscherSpRecord();
EscherSpRecord sp2 = new EscherSpRecord();
EscherSpRecord sp3 = new EscherSpRecord();
EscherClientDataRecord d2 = new EscherClientDataRecord();
EscherClientDataRecord d3 = new EscherClientDataRecord();
container1.setOptions( (short) 0x000F );
spContainer1.setOptions( (short) 0x000F );
spContainer1.setRecordId( EscherContainerRecord.SP_CONTAINER );
spContainer2.setOptions( (short) 0x000F );
spContainer2.setRecordId( EscherContainerRecord.SP_CONTAINER );
spContainer3.setOptions( (short) 0x000F );
spContainer3.setRecordId( EscherContainerRecord.SP_CONTAINER );
d2.setRecordId( EscherClientDataRecord.RECORD_ID );
d2.setRemainingData( new byte[0] );
d3.setRecordId( EscherClientDataRecord.RECORD_ID );
d3.setRemainingData( new byte[0] );
container1.addChildRecord( spContainer1 );
container1.addChildRecord( spContainer2 );
container1.addChildRecord( spContainer3 );
spContainer1.addChildRecord( sp1 );
spContainer2.addChildRecord( sp2 );
spContainer3.addChildRecord( sp3 );
spContainer2.addChildRecord( d2 );
spContainer3.addChildRecord( d3 );
EscherAggregate aggregate = new EscherAggregate(null);
aggregate.addEscherRecord( container1 );
aggregate.assoicateShapeToObjRecord( d2, new ObjRecord() );
aggregate.assoicateShapeToObjRecord( d3, new ObjRecord() );
byte[] data = new byte[112];
int bytesWritten = aggregate.serialize( 0, data );
assertEquals( 112, bytesWritten );
assertEquals( "[EC, 00, 40, 00, 0F, 00, 00, 00, 58, 00, 00, 00, 0F, 00, 04, F0, 10, 00, 00, 00, 00, 00, 0A, F0, 08, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 0F, 00, 04, F0, 18, 00, 00, 00, 00, 00, 0A, F0, 08, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 11, F0, 00, 00, 00, 00, 5D, 00, 00, 00, EC, 00, 20, 00, 0F, 00, 04, F0, 18, 00, 00, 00, 00, 00, 0A, F0, 08, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 00, 11, F0, 00, 00, 00, 00, 5D, 00, 00, 00, ]",
HexDump.toHex( data ) );