@Test
public void testInvalidChildInstance_2() throws Exception {

	Component vmComponent = new Component( "VM" ).installerName( "target" );
	Component tomcatComponent = new Component( "Tomcat" ).installerName( "puppet" );
	Graphs graphs = new Graphs();
	graphs.getRootComponents().add( vmComponent );
	// We cannot instantiate a VM under a VM
	Instance vmInstance = new Instance("vm" ).component( vmComponent );
	Instance tomcatInstance = new Instance("tomcat" ).component( tomcatComponent );
	InstanceHelpers.insertChild( vmInstance, tomcatInstance );
	ApplicationTemplate app = new ApplicationTemplate( "app" ).version( "2.4" ).graphs( graphs );
	app.getRootInstances().add( vmInstance );
	Iterator<ModelError> iterator = RuntimeModelValidator.validate( app ).iterator();
	Assert.assertEquals( ErrorCode.RM_INVALID_INSTANCE_PARENT, iterator.next().getErrorCode());
	Assert.assertFalse( iterator.hasNext());
}