ExpressionEvaluatorImpl implements ExpressionEvaluator { private <T extends Comparable<? super T>> T evaluateConstant(Object expression) { Class<?> expressionClass = expression.getClass(); if (isConstant(expressionClass)) { return cast(expression, expressionClass, Comparable.class); } throw new IllegalArgumentException(String.format("Constant should be a string or a number but %s was given", expressionClass.getCanonicalName())); }  @Override Map<String, Set<String>> getColumnNames(Object expression); @Override T evaluate(Object expression, DataRow dataRow); @Override T evaluateAs(Object expression, DataRow dataRow, Class<T> cls);  }
@Test public void testEvaluateConstant() { assertThat(expressionEvaluator.evaluate(1, EMPTY_ROW), equalTo(1)); assertThat(expressionEvaluator.evaluate("string", EMPTY_ROW), equalTo("string")); assertThat(expressionEvaluator.evaluate(true, EMPTY_ROW), equalTo(true)); assertThat(expressionEvaluator.evaluate(false, EMPTY_ROW), equalTo(false)); assertThat(expressionEvaluator.evaluate(DataType.NULL, EMPTY_ROW), equalTo(DataType.NULL)); ZonedDateTime now = ZonedDateTime.now(); assertThat(expressionEvaluator.evaluate(now, EMPTY_ROW), equalTo(now)); }