@Test
public void testFindAllScopedInstances() {

	Instance root = new Instance( "root" ).component( new Component( "Root" ).installerName( Constants.TARGET_INSTALLER ));
	Instance server = new Instance( "server" ).component( new Component( "Server" ).installerName( Constants.TARGET_INSTALLER ));
	Instance app1 = new Instance( "app1" ).component( new Component( "Application" ).installerName( "whatever" ));
	Instance app2 = new Instance( "app2" ).component( new Component( "Application" ).installerName( Constants.TARGET_INSTALLER ));
	Instance server2 = new Instance( "server2" ).component( new Component( "Server" ).installerName( "whatever" ));
	InstanceHelpers.insertChild( root, server );
	InstanceHelpers.insertChild( root, server2 );
	InstanceHelpers.insertChild( server, app1 );
	InstanceHelpers.insertChild( server2, app2 );
	Application app = new Application( "test", new ApplicationTemplate());
	app.getRootInstances().add( root );
	List<Instance> instances = InstanceHelpers.findAllScopedInstances( app );
	Assert.assertEquals( 3, instances.size());
	Assert.assertTrue( instances.contains( root ));
	Assert.assertTrue( instances.contains( server ));
	Assert.assertTrue( instances.contains( app2 ));
}