/** * Evaluates the error condition. Returns empty if threshold or measure value is not defined. */ private static Optional<EvaluatedCondition> evaluateCondition(Condition condition, ValueType type, Comparable value) { Comparable threshold = getThreshold(condition, type); if (reachThreshold(value, threshold, condition)) { return of(new EvaluatedCondition(condition, EvaluationStatus.ERROR, value.toString())); } return Optional.empty(); }
/** * Evaluates the error or warning condition. Returns empty if threshold or measure value is not defined. */ private static Optional<EvaluatedCondition> evaluateCondition(Condition condition, ValueType type, Comparable value, boolean error) { Optional<Comparable> threshold = getThreshold(condition, type, error); if (!threshold.isPresent()) { return Optional.empty(); } if (reachThreshold(value, threshold.get(), condition)) { EvaluationStatus status = error ? EvaluationStatus.ERROR : EvaluationStatus.WARN; return of(new EvaluatedCondition(condition, status, value.toString())); } return Optional.empty(); }