@Test public void alertHasErrorStateForBadHighValueWhenValueIsGreaterThanError() { assertThat(checker.checkValue(bd("0.21"), bd("0.15"), bd("0.20")), is(AlertType.ERROR)); }
@Override public AlertType checkValue(BigDecimal value, BigDecimal warn, BigDecimal error) { boolean isHighValueWorse = isTheValueBeingHighWorse(warn, error); if (isBeyondThreshold(value, error, isHighValueWorse)) { return AlertType.ERROR; } else if (isBeyondThreshold(value, warn, isHighValueWorse)) { return AlertType.WARN; } return AlertType.OK; }
DefaultValueChecker implements ValueChecker { @Override public AlertType checkValue(BigDecimal value, BigDecimal warn, BigDecimal error) { boolean isHighValueWorse = isTheValueBeingHighWorse(warn, error); if (isBeyondThreshold(value, error, isHighValueWorse)) { return AlertType.ERROR; } else if (isBeyondThreshold(value, warn, isHighValueWorse)) { return AlertType.WARN; } return AlertType.OK; } }
DefaultValueChecker implements ValueChecker { @Override public AlertType checkValue(BigDecimal value, BigDecimal warn, BigDecimal error) { boolean isHighValueWorse = isTheValueBeingHighWorse(warn, error); if (isBeyondThreshold(value, error, isHighValueWorse)) { return AlertType.ERROR; } else if (isBeyondThreshold(value, warn, isHighValueWorse)) { return AlertType.WARN; } return AlertType.OK; }  }
DefaultValueChecker implements ValueChecker { @Override public AlertType checkValue(BigDecimal value, BigDecimal warn, BigDecimal error) { boolean isHighValueWorse = isTheValueBeingHighWorse(warn, error); if (isBeyondThreshold(value, error, isHighValueWorse)) { return AlertType.ERROR; } else if (isBeyondThreshold(value, warn, isHighValueWorse)) { return AlertType.WARN; } return AlertType.OK; }  @Override AlertType checkValue(BigDecimal value, BigDecimal warn, BigDecimal error); }
DefaultValueChecker implements ValueChecker { @Override public AlertType checkValue(BigDecimal value, BigDecimal warn, BigDecimal error) { boolean isHighValueWorse = isTheValueBeingHighWorse(warn, error); if (isBeyondThreshold(value, error, isHighValueWorse)) { return AlertType.ERROR; } else if (isBeyondThreshold(value, warn, isHighValueWorse)) { return AlertType.WARN; } return AlertType.OK; }  @Override AlertType checkValue(BigDecimal value, BigDecimal warn, BigDecimal error);  }