reswqa commented on code in PR #20006:
URL: https://github.com/apache/flink/pull/20006#discussion_r901136039
##########
flink-connectors/flink-connector-files/src/test/java/org/apache/flink/connector/file/src/impl/StreamFormatAdapterTest.java:
##########
@@ -83,6 +85,26 @@ void testBatchSizeIsRecordMultiple() throws IOException {
simpleReadTest(20);
}
+ @Test
+ public void testReadEmptyFile() throws IOException {
Review Comment:
```suggestion
void testReadEmptyFile() throws IOException {
```
##########
flink-connectors/flink-connector-files/src/test/java/org/apache/flink/connector/file/src/impl/StreamFormatAdapterTest.java:
##########
@@ -83,6 +85,26 @@ void testBatchSizeIsRecordMultiple() throws IOException {
simpleReadTest(20);
}
+ @Test
+ public void testReadEmptyFile() throws IOException {
+ final StreamFormatAdapter<Integer> format =
+ new StreamFormatAdapter<>(new CheckpointedIntFormat());
+
+ final File emptyFile = new File(tmpDir.toFile(), "testFile-empty");
+ emptyFile.createNewFile();
+ Path emptyFilePath = Path.fromLocalFile(emptyFile);
+
+ final BulkFormat.Reader<Integer> reader =
+ format.createReader(
+ new Configuration(),
+ new FileSourceSplit("test-id", emptyFilePath, 0L, 0,
0L, 0));
+
+ final List<Integer> result = new ArrayList<>();
+ readNumbers(reader, result, 0);
+
+ assertThat(result).hasSize(0);
Review Comment:
```suggestion
assertThat(result).isEmpty();
```
--
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: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]