@Test
public void testStoreAwaitingMessage() {

	Instance rootInstance = new Instance( "root" );
	Assert.assertEquals( 0, this.ma.getScopedInstanceToAwaitingMessages().size());
	this.ma.storeAwaitingMessage( rootInstance, new MsgCmdSendInstances());
	Assert.assertEquals( 1, this.ma.getScopedInstanceToAwaitingMessages().size());
	List<Message> messages = this.ma.getScopedInstanceToAwaitingMessages().get( rootInstance );
	Assert.assertEquals( 1, messages.size());
	Assert.assertEquals( MsgCmdSendInstances.class, messages.get( 0 ).getClass());
	Instance childInstance = new Instance( "child" );
	InstanceHelpers.insertChild( rootInstance, childInstance );
	this.ma.storeAwaitingMessage( childInstance, new MsgCmdAddInstance( childInstance ));
	Assert.assertEquals( 1, this.ma.getScopedInstanceToAwaitingMessages().size());
	Assert.assertEquals( 2, messages.size());
	Assert.assertEquals( MsgCmdSendInstances.class, messages.get( 0 ).getClass());
	Assert.assertEquals( MsgCmdAddInstance.class, messages.get( 1 ).getClass());
	childInstance.setParent( null );
	this.ma.storeAwaitingMessage( childInstance, new MsgCmdRemoveInstance( childInstance ));
	Assert.assertEquals( 2, this.ma.getScopedInstanceToAwaitingMessages().size());
	messages = this.ma.getScopedInstanceToAwaitingMessages().get( childInstance );
	Assert.assertEquals( 1, messages.size());
	Assert.assertEquals( MsgCmdRemoveInstance.class, messages.get( 0 ).getClass());
}