DateTimeFunction { private FunctionResolver time() { return define(BuiltinFunctionName.TIME.getName(), impl(nullMissingHandling(DateTimeFunction::exprTime), TIME, STRING), impl(nullMissingHandling(DateTimeFunction::exprTime), TIME, DATE), impl(nullMissingHandling(DateTimeFunction::exprTime), TIME, DATETIME), impl(nullMissingHandling(DateTimeFunction::exprTime), TIME, TIME), impl(nullMissingHandling(DateTimeFunction::exprTime), TIME, TIMESTAMP)); }  void register(BuiltinFunctionRepository repository);  }
@Test public void time() { when(nullRef.type()).thenReturn(TIME); when(missingRef.type()).thenReturn(TIME); assertEquals(nullValue(), eval(dsl.time(nullRef))); assertEquals(missingValue(), eval(dsl.time(missingRef))); FunctionExpression expr = dsl.time(DSL.literal("01:01:01")); assertEquals(TIME, expr.type()); assertEquals(new ExprTimeValue("01:01:01"), eval(expr)); assertEquals("time(\"01:01:01\")", expr.toString()); expr = dsl.time(DSL.literal(new ExprTimeValue("01:01:01"))); assertEquals(TIME, expr.type()); assertEquals(new ExprTimeValue("01:01:01"), eval(expr)); assertEquals("time(TIME '01:01:01')", expr.toString()); }