LessThanEvaluator extends Evaluator<T> { @Override protected TruthValue evaluate(T value) { if (value == null) { return TruthValue.NULL; } if (literal.compareTo(value) > threshold) { return TruthValue.YES; } return TruthValue.NO; } LessThanEvaluator(String fieldName, Comparable<T> literal, Operator operator);   }
@Test public void lessThanIsLessThan() { when(corc.getWritable(COL0)).thenReturn(ZERO); evaluator = new LessThanEvaluator<>(COL0, ONE, Operator.LESS_THAN); assertThat(evaluator.evaluate(corc), is(TruthValue.YES)); }
@Test public void lessThanIsEqualInput() { when(corc.getWritable(COL0)).thenReturn(ONE); evaluator = new LessThanEvaluator<>(COL0, ONE, Operator.LESS_THAN); assertThat(evaluator.evaluate(corc), is(TruthValue.NO)); }
@Test public void lessThatIsGreaterThan() { when(corc.getWritable(COL0)).thenReturn(TWO); evaluator = new LessThanEvaluator<>(COL0, ONE, Operator.LESS_THAN); assertThat(evaluator.evaluate(corc), is(TruthValue.NO)); }
@Test public void lessThanIsNullInput() { when(corc.getWritable(COL0)).thenReturn(null); evaluator = new LessThanEvaluator<>(COL0, ONE, Operator.LESS_THAN); assertThat(evaluator.evaluate(corc), is(TruthValue.NULL)); }
@Test public void lessThanEqualIsLessThan() { when(corc.getWritable(COL0)).thenReturn(ZERO); evaluator = new LessThanEvaluator<>(COL0, ONE, Operator.LESS_THAN_EQUALS); assertThat(evaluator.evaluate(corc), is(TruthValue.YES)); }
@Test public void lessThanEqualIsEqualInput() { when(corc.getWritable(COL0)).thenReturn(ONE); evaluator = new LessThanEvaluator<>(COL0, ONE, Operator.LESS_THAN_EQUALS); assertThat(evaluator.evaluate(corc), is(TruthValue.YES)); }
@Test public void lessThatEqualIsGreaterThan() { when(corc.getWritable(COL0)).thenReturn(TWO); evaluator = new LessThanEvaluator<>(COL0, ONE, Operator.LESS_THAN_EQUALS); assertThat(evaluator.evaluate(corc), is(TruthValue.NO)); }
@Test public void lessThanEqualIsNullInput() { when(corc.getWritable(COL0)).thenReturn(null); evaluator = new LessThanEvaluator<>(COL0, ONE, Operator.LESS_THAN_EQUALS); assertThat(evaluator.evaluate(corc), is(TruthValue.NULL)); }