use of io.confluent.ksql.function.types.GenericType in project ksql by confluentinc.
the class UdfUtilTest method shouldGetPartialGenericTriFunction.
@Test
public void shouldGetPartialGenericTriFunction() throws NoSuchMethodException {
// Given:
final Type genericType = getClass().getMethod("partialGenericTriFunctionType").getGenericReturnType();
// When:
final ParamType returnType = UdfUtil.getSchemaFromType(genericType);
// Then:
assertThat(returnType, is(LambdaType.of(ImmutableList.of(GenericType.of("T"), ParamTypes.BOOLEAN, GenericType.of("U")), ParamTypes.INTEGER)));
}
use of io.confluent.ksql.function.types.GenericType in project ksql by confluentinc.
the class UdfUtilTest method shouldGetGenericTriFunction.
@Test
public void shouldGetGenericTriFunction() throws NoSuchMethodException {
// Given:
final Type genericType = getClass().getMethod("genericTriFunctionType").getGenericReturnType();
// When:
final ParamType returnType = UdfUtil.getSchemaFromType(genericType);
// Then:
assertThat(returnType, is(LambdaType.of(ImmutableList.of(GenericType.of("T"), GenericType.of("U"), GenericType.of("V")), GenericType.of("W"))));
}
use of io.confluent.ksql.function.types.GenericType in project ksql by confluentinc.
the class UdfUtilTest method shouldGetGenericSchemaFromPartialParameterizedType.
@Test
public void shouldGetGenericSchemaFromPartialParameterizedType() throws NoSuchMethodException {
// Given:
final Type genericType = getClass().getMethod("partialGenericMapType").getGenericReturnType();
// When:
final ParamType returnType = UdfUtil.getSchemaFromType(genericType);
// Then:
assertThat(returnType, is(MapType.of(ParamTypes.LONG, GenericType.of("V"))));
}
use of io.confluent.ksql.function.types.GenericType in project ksql by confluentinc.
the class UdfUtilTest method shouldGetGenericFunction.
@Test
public void shouldGetGenericFunction() throws NoSuchMethodException {
// Given:
final Type genericType = getClass().getMethod("genericFunctionType").getGenericReturnType();
// When:
final ParamType returnType = UdfUtil.getSchemaFromType(genericType);
// Then:
assertThat(returnType, is(LambdaType.of(ImmutableList.of(GenericType.of("T")), GenericType.of("U"))));
}
use of io.confluent.ksql.function.types.GenericType in project ksql by confluentinc.
the class UdfUtilTest method shouldGetGenericSchemaFromType.
@Test
public void shouldGetGenericSchemaFromType() throws NoSuchMethodException {
// Given:
final Type genericType = getClass().getMethod("genericType").getGenericReturnType();
// When:
final ParamType returnType = UdfUtil.getSchemaFromType(genericType);
// Then:
MatcherAssert.assertThat(returnType, CoreMatchers.is(GenericType.of("T")));
}
Aggregations