@Test
public void testInstance() {

	Instance inst = new Instance();
	Iterator<ModelError> iterator = RuntimeModelValidator.validate( inst ).iterator();
	Assert.assertEquals( ErrorCode.RM_EMPTY_INSTANCE_NAME, iterator.next().getErrorCode());
	Assert.assertEquals( ErrorCode.RM_EMPTY_INSTANCE_COMPONENT, iterator.next().getErrorCode());
	Assert.assertFalse( iterator.hasNext());
	inst.setName( "?my instance?" );
	iterator = RuntimeModelValidator.validate( inst ).iterator();
	Assert.assertEquals( ErrorCode.RM_INVALID_INSTANCE_NAME, iterator.next().getErrorCode());
	Assert.assertEquals( ErrorCode.RM_EMPTY_INSTANCE_COMPONENT, iterator.next().getErrorCode());
	Assert.assertFalse( iterator.hasNext());
	inst.setName( "my-instance" );
	iterator = RuntimeModelValidator.validate( inst ).iterator();
	Assert.assertEquals( ErrorCode.RM_EMPTY_INSTANCE_COMPONENT, iterator.next().getErrorCode());
	Assert.assertFalse( iterator.hasNext());
	inst.setComponent( new Component( "comp" ));
	Assert.assertEquals( 0, RuntimeModelValidator.validate( inst ).size());
	inst.setName( "my instance" );
	Assert.assertEquals( 0, RuntimeModelValidator.validate( inst ).size());
	inst.overriddenExports.put( "inst.value", "whatever" );
	iterator = RuntimeModelValidator.validate( inst ).iterator();
	Assert.assertEquals( ErrorCode.RM_MAGIC_INSTANCE_VARIABLE, iterator.next().getErrorCode());
	Assert.assertFalse( iterator.hasNext());
}