@Test public void testFilterErrors() { List<RoboconfError> errors = new ArrayList<> (); errors.add( new RoboconfError( CMD_CANNOT_HAVE_ANY_PARENT )); errors.add( new RoboconfError( RM_ROOT_INSTALLER_MUST_BE_TARGET )); errors.add( new RoboconfError( RM_ROOT_INSTALLER_MUST_BE_TARGET )); errors.add( new RoboconfError( RM_UNRESOLVABLE_FACET_VARIABLE )); errors.add( new RoboconfError( RM_UNREACHABLE_COMPONENT )); errors.add( new RoboconfError( RM_ORPHAN_FACET_WITH_CHILDREN )); errors.add( new RoboconfError( RM_ORPHAN_FACET )); int size = errors.size(); RoboconfErrorHelpers.filterErrors( errors ); Assert.assertEquals( size, errors.size()); RoboconfErrorHelpers.filterErrors( errors, RM_ORPHAN_FACET ); Assert.assertEquals( size - 1, errors.size()); for( RoboconfError error : errors ) Assert.assertNotEquals( RM_ORPHAN_FACET, error.getErrorCode()); RoboconfErrorHelpers.filterErrors( errors, ErrorCode.RM_ROOT_INSTALLER_MUST_BE_TARGET, ErrorCode.RM_UNREACHABLE_COMPONENT ); Assert.assertEquals( size - 4, errors.size()); for( RoboconfError error : errors ) { Assert.assertNotEquals( RM_ORPHAN_FACET, error.getErrorCode()); Assert.assertNotEquals( RM_ROOT_INSTALLER_MUST_BE_TARGET, error.getErrorCode()); Assert.assertNotEquals( RM_UNREACHABLE_COMPONENT, error.getErrorCode()); } RoboconfErrorHelpers.filterErrors( errors, REC_ARTIFACT_ID_IN_LOWER_CASE ); Assert.assertEquals( size - 4, errors.size()); }
public static void filterErrors( Collection<? extends RoboconfError> errors, ErrorCode... errorCodes ) { List<ErrorCode> codesToSkip = new ArrayList<> (); codesToSkip.addAll( Arrays.asList( errorCodes )); Collection<RoboconfError> toRemove = new ArrayList<> (); for( RoboconfError error : errors ) { if( codesToSkip.contains( error.getErrorCode())) toRemove.add( error ); } errors.removeAll( toRemove ); }
RoboconfErrorHelpers { public static void filterErrors( Collection<? extends RoboconfError> errors, ErrorCode... errorCodes ) { List<ErrorCode> codesToSkip = new ArrayList<> (); codesToSkip.addAll( Arrays.asList( errorCodes )); Collection<RoboconfError> toRemove = new ArrayList<> (); for( RoboconfError error : errors ) { if( codesToSkip.contains( error.getErrorCode())) toRemove.add( error ); } errors.removeAll( toRemove ); } }
RoboconfErrorHelpers { public static void filterErrors( Collection<? extends RoboconfError> errors, ErrorCode... errorCodes ) { List<ErrorCode> codesToSkip = new ArrayList<> (); codesToSkip.addAll( Arrays.asList( errorCodes )); Collection<RoboconfError> toRemove = new ArrayList<> (); for( RoboconfError error : errors ) { if( codesToSkip.contains( error.getErrorCode())) toRemove.add( error ); } errors.removeAll( toRemove ); } private  RoboconfErrorHelpers(); }
RoboconfErrorHelpers { public static void filterErrors( Collection<? extends RoboconfError> errors, ErrorCode... errorCodes ) { List<ErrorCode> codesToSkip = new ArrayList<> (); codesToSkip.addAll( Arrays.asList( errorCodes )); Collection<RoboconfError> toRemove = new ArrayList<> (); for( RoboconfError error : errors ) { if( codesToSkip.contains( error.getErrorCode())) toRemove.add( error ); } errors.removeAll( toRemove ); } 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 ); }
RoboconfErrorHelpers { public static void filterErrors( Collection<? extends RoboconfError> errors, ErrorCode... errorCodes ) { List<ErrorCode> codesToSkip = new ArrayList<> (); codesToSkip.addAll( Arrays.asList( errorCodes )); Collection<RoboconfError> toRemove = new ArrayList<> (); for( RoboconfError error : errors ) { if( codesToSkip.contains( error.getErrorCode())) toRemove.add( error ); } errors.removeAll( toRemove ); } 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 );  }