use of org.hamcrest.core.StringStartsWith in project flink by apache.
the class DataStreamTest method testEnumKeyRejection.
@Test
public void testEnumKeyRejection() {
KeySelector<Tuple2<TestEnum, String>, TestEnum> keySelector = value -> value.f0;
StreamExecutionEnvironment env = StreamExecutionEnvironment.getExecutionEnvironment();
DataStream<Tuple2<TestEnum, String>> input = env.fromElements(Tuple2.of(TestEnum.FOO, "Foo"), Tuple2.of(TestEnum.BAR, "Bar"));
expectedException.expect(InvalidProgramException.class);
expectedException.expectMessage(new StringStartsWith("Type " + EnumTypeInfo.of(TestEnum.class) + " cannot be used as key."));
input.keyBy(keySelector);
}
Aggregations