RoboconfErrorHelpers { public static List<RoboconfError> resolveErrorsWithLocation( ApplicationLoadResult alr ) { List<RoboconfError> result = new ArrayList<> (); for( RoboconfError error : alr.getLoadErrors()) { RoboconfError errorToAdd = error; if( error instanceof ModelError ) { Object modelObject = ((ModelError) error).getModelObject(); SourceReference sr = alr.getObjectToSource().get( modelObject ); if( sr != null ) errorToAdd = new ParsingError( error.getErrorCode(), sr.getSourceFile(), sr.getLine(), error.getDetails()); } result.add( errorToAdd ); } return result; } private  RoboconfErrorHelpers(); static boolean containsCriticalErrors( Collection<? extends RoboconfError> errors ); static Collection<RoboconfError> findWarnings( Collection<? extends RoboconfError> errors ); static List<RoboconfError> resolveErrorsWithLocation( ApplicationLoadResult alr ); static void filterErrorsForRecipes( ApplicationLoadResult alr ); static void filterErrorsForRecipes( Collection<? extends RoboconfError> errors ); static void filterErrors( Collection<? extends RoboconfError> errors, ErrorCode... errorCodes ); static Map<RoboconfError,String> formatErrors(
			Collection<? extends RoboconfError> errors,
			String lang,
			boolean addMetadata );  }
@Test public void testResolveErrorsWithLocation() { ApplicationLoadResult alr = new ApplicationLoadResult(); Component c1 = new Component( "comp1" ); Component c2 = new Component( "comp2" ); Assert.assertEquals( 0, RoboconfErrorHelpers.resolveErrorsWithLocation( alr ).size()); 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()); 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()); }