dannycranmer commented on a change in pull request #18483: URL: https://github.com/apache/flink/pull/18483#discussion_r799342056
########## File path: flink-connectors/flink-connector-aws-kinesis-data-streams/src/test/java/org/apache/flink/connector/kinesis/sink/KinesisDataStreamsSinkBuilderTest.java ########## @@ -60,9 +58,36 @@ public void streamNameOfSinkMustBeSetToNonEmptyWhenBuilt() { () -> KinesisDataStreamsSink.<String>builder() .setStreamName("") - .setElementConverter(ELEMENT_CONVERTER_PLACEHOLDER) + .setPartitionKeyGenerator(PARTITION_KEY_GENERATOR) + .setSerializationSchema(SERIALIZATION_SCHEMA) .build()) .withMessageContaining( "The stream name must be set when initializing the KDS Sink."); } + + @Test + public void serializationSchemaMustBeSetWhenSinkIsBuilt() { + Assertions.assertThatExceptionOfType(NullPointerException.class) + .isThrownBy( + () -> + KinesisDataStreamsSink.<String>builder() + .setStreamName("stream") + .setPartitionKeyGenerator(PARTITION_KEY_GENERATOR) + .build()) + .withMessageContaining( + "No SerializationSchema was supplied to the KinesisDataStreamsSinkElementConverter builder."); + } + + @Test + public void partitionKeyGeneratorMustBeSetWhenSinkIsBuilt() { + Assertions.assertThatExceptionOfType(NullPointerException.class) + .isThrownBy( + () -> + KinesisDataStreamsSink.<String>builder() + .setStreamName("stream") + .setSerializationSchema(SERIALIZATION_SCHEMA) + .build()) + .withMessageContaining( + "No PartitionKeyGenerator lambda was supplied to the KinesisDataStreamsSinkElementConverter builder."); Review comment: nit: It does not have to be a lambda.. -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: issues-unsubscr...@flink.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org