ConditionValueInOperatorGenerator implements ConditionValueGenerator<InExpression> { @Override public Optional<RouteValue> generate(final InExpression predicate, final Column column, final List<Object> parameters) { List<Comparable<?>> routeValues = new LinkedList<>(); SPITimeService timeService = new SPITimeService(); for (ExpressionSegment each : predicate.getExpressionList()) { Optional<Comparable<?>> routeValue = new ConditionValue(each, parameters).getValue(); if (routeValue.isPresent()) { routeValues.add(routeValue.get()); continue; } if (ExpressionConditionUtils.isNowExpression(each)) { routeValues.add(timeService.getTime()); } } return routeValues.isEmpty() ? Optional.empty() : Optional.of(new ListRouteValue<>(column.getName(), column.getTableName(), routeValues)); }  @Override Optional<RouteValue> generate(final InExpression predicate, final Column column, final List<Object> parameters);  }
@Test public void assertNowExpression() { ListExpression listExpression = new ListExpression(0, 0); listExpression.getItems().add(new CommonExpressionSegment(0, 0, "now()")); InExpression inExpression = new InExpression(0, 0, null, listExpression, false); Optional<RouteValue> routeValue = generator.generate(inExpression, column, new LinkedList<>()); assertTrue(routeValue.isPresent()); assertThat(((ListRouteValue) routeValue.get()).getValues().iterator().next(), instanceOf(Date.class)); }