skytin1004 commented on code in PR #7767:
URL: https://github.com/apache/iceberg/pull/7767#discussion_r1219400741
##########
core/src/test/java/org/apache/iceberg/io/TestSingleBufferInputStream.java:
##########
@@ -40,8 +41,9 @@ protected ByteBufferInputStream newStream() {
@Override
protected void checkOriginalData() {
- Assert.assertEquals("Position should not change", 0, DATA.position());
- Assert.assertEquals("Limit should not change", DATA.array().length,
DATA.limit());
+ assertThat(DATA.position()).as("Position should not change").isEqualTo(0);
+
Review Comment:
I deleted the unnecessary newline.
##########
core/src/test/java/org/apache/iceberg/io/TestMultiBufferInputStream.java:
##########
@@ -62,62 +63,66 @@ public void testSliceData() throws Exception {
buffers.add(stream.slice(bytesToSlice));
}
- Assert.assertEquals("Position should be at end", length, stream.getPos());
- Assert.assertEquals("Should produce 5 buffers", 5, buffers.size());
+ assertThat(stream.getPos()).as("Position should be at
end").isEqualTo(length);
+ assertThat(buffers.size()).as("Should produce 5 buffers").isEqualTo(5);
int i = 0;
// one is a view of the first buffer because it is smaller
ByteBuffer one = buffers.get(0);
- Assert.assertSame("Should be a duplicate of the first array", one.array(),
DATA.get(0).array());
- Assert.assertEquals(8, one.remaining());
- Assert.assertEquals(0, one.position());
- Assert.assertEquals(8, one.limit());
- Assert.assertEquals(9, one.capacity());
+ assertThat(DATA.get(0).array())
+ .as("Should be a duplicate of the first array")
+ .isSameAs(one.array());
+ assertThat(one.remaining()).isEqualTo(8);
+ assertThat(one.position()).isEqualTo(0);
+ assertThat(one.limit()).isEqualTo(8);
+ assertThat(one.capacity()).isEqualTo(9);
for (; i < 8; i += 1) {
- Assert.assertEquals("Should produce correct values", i, one.get());
+ assertThat(one.get()).as("Should produce correct
values").isEqualTo((byte) i);
}
// two should be a copy of the next 8 bytes
ByteBuffer two = buffers.get(1);
- Assert.assertEquals(8, two.remaining());
- Assert.assertEquals(0, two.position());
- Assert.assertEquals(8, two.limit());
- Assert.assertEquals(8, two.capacity());
+ assertThat(two.remaining()).isEqualTo(8);
+ assertThat(two.position()).isEqualTo(0);
+ assertThat(two.limit()).isEqualTo(8);
+ assertThat(two.capacity()).isEqualTo(8);
for (; i < 16; i += 1) {
- Assert.assertEquals("Should produce correct values", i, two.get());
+ assertThat(two.get()).as("Should produce correct
values").isEqualTo((byte) i);
}
// three is a copy of part of the 4th buffer
ByteBuffer three = buffers.get(2);
- Assert.assertSame(
- "Should be a duplicate of the fourth array", three.array(),
DATA.get(3).array());
- Assert.assertEquals(8, three.remaining());
- Assert.assertEquals(3, three.position());
- Assert.assertEquals(11, three.limit());
- Assert.assertEquals(12, three.capacity());
+ assertThat(DATA.get(3).array())
+ .as("Should be a duplicate of the fourth array")
+ .isSameAs(three.array());
+ assertThat(three.remaining()).isEqualTo(8);
+ assertThat(three.position()).isEqualTo(3);
+ assertThat(three.limit()).isEqualTo(11);
+ assertThat(three.capacity()).isEqualTo(12);
for (; i < 24; i += 1) {
- Assert.assertEquals("Should produce correct values", i, three.get());
+ assertThat(three.get()).as("Should produce correct
values").isEqualTo((byte) i);
}
// four should be a copy of the next 8 bytes
ByteBuffer four = buffers.get(3);
- Assert.assertEquals(8, four.remaining());
- Assert.assertEquals(0, four.position());
- Assert.assertEquals(8, four.limit());
- Assert.assertEquals(8, four.capacity());
+ assertThat(four.remaining()).isEqualTo(8);
+ assertThat(four.position()).isEqualTo(0);
+ assertThat(four.limit()).isEqualTo(8);
+ assertThat(four.capacity()).isEqualTo(8);
for (; i < 32; i += 1) {
- Assert.assertEquals("Should produce correct values", i, four.get());
+ assertThat(four.get()).as("Should produce correct
values").isEqualTo((byte) i);
}
// five should be a copy of the next 8 bytes
ByteBuffer five = buffers.get(4);
- Assert.assertEquals(3, five.remaining());
- Assert.assertEquals(0, five.position());
- Assert.assertEquals(3, five.limit());
- Assert.assertEquals(3, five.capacity());
+
Review Comment:
I deleted the unnecessary newline.
--
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]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]