@Test
public void testResolveErrorsWithLocation() {

	ApplicationLoadResult alr = new ApplicationLoadResult();
	Component c1 = new Component( "comp1" );
	Component c2 = new Component( "comp2" );
	// Empty case
	Assert.assertEquals( 0, RoboconfErrorHelpers.resolveErrorsWithLocation( alr ).size());
	// Try with an application that contains only a runtime error
	alr.getLoadErrors().add( new RoboconfError( REC_SCRIPT_NO_SCRIPTS_DIR ));
	alr.getLoadErrors().add( new ModelError( RM_INVALID_VARIABLE_NAME, c1 ));
	alr.getLoadErrors().add( new ModelError( RM_INVALID_COMPONENT_INSTALLER, c2 ));
	List<RoboconfError> errors = RoboconfErrorHelpers.resolveErrorsWithLocation( alr );
	Assert.assertEquals( alr.getLoadErrors().size(), errors.size());
	Assert.assertEquals( RoboconfError.class, errors.get( 0 ).getClass());
	Assert.assertEquals( ModelError.class, errors.get( 1 ).getClass());
	Assert.assertEquals( ModelError.class, errors.get( 2 ).getClass());
	// Add location in the context
	alr.getObjectToSource().put( c1, new SourceReference( c1, new File( "whatever" ), 5 ));
	errors = RoboconfErrorHelpers.resolveErrorsWithLocation( alr );
	Assert.assertEquals( alr.getLoadErrors().size(), errors.size());
	Assert.assertEquals( RoboconfError.class, errors.get( 0 ).getClass());
	Assert.assertEquals( ParsingError.class, errors.get( 1 ).getClass());
	Assert.assertEquals( RM_INVALID_VARIABLE_NAME, errors.get( 1 ).getErrorCode());
	Assert.assertEquals( 5, ((ParsingError) errors.get( 1 )).getLine());
	Assert.assertEquals( ModelError.class, errors.get( 2 ).getClass());
}