use of io.confluent.ksql.function.UdfFactory in project ksql by confluentinc.
the class InterpretedExpressionTest method shouldHandleFunctionCalls_intervalParam.
@Test
public void shouldHandleFunctionCalls_intervalParam() {
// Given:
final UdfFactory udfFactory = mock(UdfFactory.class);
final KsqlScalarFunction udf = mock(KsqlScalarFunction.class);
when(udf.newInstance(any())).thenReturn(new toMillisUdf());
givenUdf("FOO", udfFactory, udf);
when(udf.parameters()).thenReturn(ImmutableList.of(IntervalUnitType.INSTANCE, IntegerType.INSTANCE));
// When:
InterpretedExpression interpreter1 = interpreter(new FunctionCall(FunctionName.of("FOO"), ImmutableList.of(new IntervalUnit(TimeUnit.SECONDS), new IntegerLiteral(1))));
final Object object = interpreter1.evaluate(ROW);
// Then:
assertThat(object, is(1000));
}
Aggregations