tzulitai commented on a change in pull request #14042: URL: https://github.com/apache/flink/pull/14042#discussion_r522715078
########## File path: flink-core/src/test/java/org/apache/flink/core/io/PostVersionedIOReadableWritableTest.java ########## @@ -35,52 +36,92 @@ @Test public void testReadVersioned() throws IOException { + byte[] payload = "test-data".getBytes(); + byte[] serialized = serializeWithPostVersionedReadableWritable(payload); + byte[] restored = restoreWithPostVersionedReadableWritable(serialized, payload.length); - String payload = "test-data"; - TestPostVersionedReadableWritable versionedReadableWritable = new TestPostVersionedReadableWritable(payload); + Assert.assertArrayEquals(payload, restored); + } + + @Test + public void testReadNonVersioned() throws IOException { + byte[] preVersionedPayload = new byte[]{0x00, 0x00, 0x02, 0x33}; + byte[] serialized = serializeWithNonVersionedReadableWritable(preVersionedPayload); + byte[] restored = restoreWithPostVersionedReadableWritable(serialized, preVersionedPayload.length); + + Assert.assertArrayEquals(preVersionedPayload, restored); + } + + @Test + public void testReadNonVersionedWithLongPayload() throws IOException { + byte[] preVersionedPayload = "test-data".getBytes(); + byte[] serialized = serializeWithNonVersionedReadableWritable(preVersionedPayload); + byte[] restored = restoreWithPostVersionedReadableWritable(serialized, preVersionedPayload.length); + + Assert.assertArrayEquals(preVersionedPayload, restored); + } + + @Test + public void testReadNonVersionedWithShortPayload() throws IOException { Review comment: Can you add one more UT, where the pre-versioned payload is empty? I don't expect it to fail, but would be nice to have. ---------------------------------------------------------------- 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. For queries about this service, please contact Infrastructure at: us...@infra.apache.org