You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@iceberg.apache.org by "rakesh-das08 (via GitHub)" <gi...@apache.org> on 2023/06/03 11:25:17 UTC
[GitHub] [iceberg] rakesh-das08 opened a new pull request, #7757: Api: Switch tests to Junit5 (second PR)
rakesh-das08 opened a new pull request, #7757:
URL: https://github.com/apache/iceberg/pull/7757
(no comment)
--
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-unsubscribe@iceberg.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@iceberg.apache.org
For additional commands, e-mail: issues-help@iceberg.apache.org
[GitHub] [iceberg] nastra commented on a diff in pull request #7757: Api: Switch tests to Junit5 (io,metrics,transforms packages)
Posted by "nastra (via GitHub)" <gi...@apache.org>.
nastra commented on code in PR #7757:
URL: https://github.com/apache/iceberg/pull/7757#discussion_r1215517171
##########
api/src/test/java/org/apache/iceberg/io/TestCloseableIterable.java:
##########
@@ -107,9 +108,9 @@ public void testWithCompletionRunnable() throws IOException {
try (CloseableIterable<Integer> iter =
CloseableIterable.whenComplete(
CloseableIterable.combine(items, () -> {}), completionCounter::incrementAndGet)) {
- iter.forEach(val -> Assertions.assertThat(completionCounter.get()).isEqualTo(0));
+ iter.forEach(val -> assertThat(completionCounter.get()).isZero());
}
- Assertions.assertThat(completionCounter.get()).isEqualTo(1);
+ assertThat(completionCounter.get()).isOne();
Review Comment:
I'm ok leaving them now, but just something to consider for future PRs
--
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-unsubscribe@iceberg.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@iceberg.apache.org
For additional commands, e-mail: issues-help@iceberg.apache.org
[GitHub] [iceberg] rakesh-das08 commented on a diff in pull request #7757: Api: Switch tests to Junit5 (io,metrics,transforms packages)
Posted by "rakesh-das08 (via GitHub)" <gi...@apache.org>.
rakesh-das08 commented on code in PR #7757:
URL: https://github.com/apache/iceberg/pull/7757#discussion_r1215518735
##########
api/src/test/java/org/apache/iceberg/transforms/TestBucketing.java:
##########
@@ -54,80 +55,88 @@ public static void getUUIDConstructor() {
private Random testRandom = null;
- @Before
+ @BeforeEach
public void initRandom() {
// reinitialize random for each test to avoid dependence on run order
this.testRandom = new Random(314358);
}
@Test
public void testSpecValues() {
- Assert.assertEquals("Spec example: hash(true) = 1392991556", 1392991556, BucketUtil.hash(1));
- Assert.assertEquals("Spec example: hash(34) = 2017239379", 2017239379, BucketUtil.hash(34));
- Assert.assertEquals("Spec example: hash(34L) = 2017239379", 2017239379, BucketUtil.hash(34L));
-
- Assert.assertEquals(
- "Spec example: hash(17.11F) = -142385009", -142385009, BucketUtil.hash(1.0F));
- Assert.assertEquals(
- "Spec example: hash(17.11D) = -142385009", -142385009, BucketUtil.hash(1.0D));
- Assert.assertEquals("Spec example: hash(0.0F) = 1669671676", 1669671676, BucketUtil.hash(0.0F));
- Assert.assertEquals(
- "Spec example: hash(-0.0F) = 1669671676", 1669671676, BucketUtil.hash(-0.0F));
- Assert.assertEquals("Spec example: hash(0.0) = 1669671676", 1669671676, BucketUtil.hash(0.0));
- Assert.assertEquals("Spec example: hash(-0.0) = 1669671676", 1669671676, BucketUtil.hash(-0.0));
-
- Assert.assertEquals(
- "Spec example: hash(decimal2(14.20)) = -500754589",
- -500754589,
- BucketUtil.hash(new BigDecimal("14.20")));
- Assert.assertEquals(
- "Spec example: hash(decimal2(14.20)) = -500754589",
- -500754589,
- BucketUtil.hash(new BigDecimal("14.20")));
+ assertThat(BucketUtil.hash(1))
+ .as("Spec example: hash(true) = 1392991556")
+ .isEqualTo(1392991556);
+ assertThat(BucketUtil.hash(34)).as("Spec example: hash(34) = 2017239379").isEqualTo(2017239379);
+ assertThat(BucketUtil.hash(34L))
+ .as("Spec example: hash(34L) = 2017239379")
+ .isEqualTo(2017239379);
+
+ assertThat(BucketUtil.hash(1.0F))
+ .as("Spec example: hash(17.11F) = -142385009")
+ .isEqualTo(-142385009);
+ assertThat(BucketUtil.hash(1.0D))
+ .as("Spec example: hash(17.11D) = -142385009")
+ .isEqualTo(-142385009);
+ assertThat(BucketUtil.hash(0.0F))
+ .as("Spec example: hash(0.0F) = 1669671676")
+ .isEqualTo(1669671676);
+ assertThat(BucketUtil.hash(-0.0F))
+ .as("Spec example: hash(-0.0F) = 1669671676")
+ .isEqualTo(1669671676);
+ assertThat(BucketUtil.hash(0.0))
+ .as("Spec example: hash(0.0) = 1669671676")
+ .isEqualTo(1669671676);
+ assertThat(BucketUtil.hash(-0.0))
+ .as("Spec example: hash(-0.0) = 1669671676")
+ .isEqualTo(1669671676);
+
+ assertThat(BucketUtil.hash(new BigDecimal("14.20")))
+ .as("Spec example: hash(decimal2(14.20)) = -500754589")
+ .isEqualTo(-500754589)
+ .as("Spec example: hash(decimal2(14.20)) = -500754589")
+ .isEqualTo(-500754589);
Literal<Integer> date = Literal.of("2017-11-16").to(Types.DateType.get());
- Assert.assertEquals(
- "Spec example: hash(2017-11-16) = -653330422", -653330422, BucketUtil.hash(date.value()));
+ assertThat(BucketUtil.hash(date.value()))
+ .as("Spec example: hash(2017-11-16) = -653330422")
+ .isEqualTo(-653330422);
Literal<Long> timeValue = Literal.of("22:31:08").to(Types.TimeType.get());
- Assert.assertEquals(
- "Spec example: hash(22:31:08) = -662762989",
- -662762989,
- BucketUtil.hash(timeValue.value()));
+ assertThat(BucketUtil.hash(timeValue.value()))
+ .as("Spec example: hash(22:31:08) = -662762989")
+ .isEqualTo(-662762989);
Literal<Long> timestampVal =
Literal.of("2017-11-16T22:31:08").to(Types.TimestampType.withoutZone());
- Assert.assertEquals(
- "Spec example: hash(2017-11-16T22:31:08) = -2047944441",
- -2047944441,
- BucketUtil.hash(timestampVal.value()));
+ assertThat(BucketUtil.hash(timestampVal.value()))
+ .as("Spec example: hash(2017-11-16T22:31:08) = -2047944441")
+ .isEqualTo(-2047944441);
Literal<Long> timestamptzVal =
Literal.of("2017-11-16T14:31:08-08:00").to(Types.TimestampType.withZone());
- Assert.assertEquals(
- "Spec example: hash(2017-11-16T14:31:08-08:00) = -2047944441",
- -2047944441,
- BucketUtil.hash(timestamptzVal.value()));
-
- Assert.assertEquals(
- "Spec example: hash(\"iceberg\") = 1210000089", 1210000089, BucketUtil.hash("iceberg"));
- Assert.assertEquals(
- "Spec example: hash(\"iceberg\") = 1210000089",
- 1210000089,
- BucketUtil.hash(new Utf8("iceberg")));
+ assertThat(BucketUtil.hash(timestamptzVal.value()))
+ .as("Spec example: hash(2017-11-16T14:31:08-08:00) = -2047944441")
+ .isEqualTo(-2047944441);
+
+ assertThat(BucketUtil.hash("iceberg"))
+ .as("Spec example: hash(\"iceberg\") = 1210000089")
+ .isEqualTo(1210000089);
+ assertThat(BucketUtil.hash(new Utf8("iceberg")))
+ .as("Spec example: hash(\"iceberg\") = 1210000089")
+ .isEqualTo(1210000089);
Literal<UUID> uuid =
Literal.of("f79c3e09-677c-4bbd-a479-3f349cb785e7").to(Types.UUIDType.get());
- Assert.assertEquals(
- "Spec example: hash(f79c3e09-677c-4bbd-a479-3f349cb785e7) = 1488055340",
- 1488055340,
- BucketUtil.hash(uuid.value()));
+ assertThat(BucketUtil.hash(uuid.value()))
+ .as("Spec example: hash(f79c3e09-677c-4bbd-a479-3f349cb785e7) = 1488055340")
+ .isEqualTo(1488055340);
ByteBuffer bytes = ByteBuffer.wrap(new byte[] {0, 1, 2, 3});
- Assert.assertEquals(
- "Spec example: hash([00 01 02 03]) = -188683207", -188683207, BucketUtil.hash(bytes));
- Assert.assertEquals(
- "Spec example: hash([00 01 02 03]) = -188683207", -188683207, BucketUtil.hash(bytes));
+ assertThat(BucketUtil.hash(bytes))
+ .as("Spec example: hash([00 01 02 03]) = -188683207")
+ .isEqualTo(-188683207)
+ .as("Spec example: hash([00 01 02 03]) = -188683207")
Review Comment:
Would add a comment explaining the need for 2 separate assertions.
--
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-unsubscribe@iceberg.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@iceberg.apache.org
For additional commands, e-mail: issues-help@iceberg.apache.org
[GitHub] [iceberg] nastra commented on a diff in pull request #7757: Api: Switch tests to Junit5 (io,metrics,transforms packages)
Posted by "nastra (via GitHub)" <gi...@apache.org>.
nastra commented on code in PR #7757:
URL: https://github.com/apache/iceberg/pull/7757#discussion_r1215453910
##########
api/src/test/java/org/apache/iceberg/io/TestClosingIterator.java:
##########
@@ -43,8 +41,8 @@ public void testHasNextAndNext() {
when(underlying.hasNext()).thenReturn(true);
when(underlying.next()).thenReturn("hello");
ClosingIterator<String> closingIterator = new ClosingIterator<>(underlying);
- assertTrue(closingIterator.hasNext());
- assertEquals("hello", closingIterator.next());
+ assertThat(closingIterator.hasNext()).isTrue();
Review Comment:
```suggestion
assertThat(closingIterator).hasNext()
```
##########
api/src/test/java/org/apache/iceberg/transforms/TestTransformSerialization.java:
##########
@@ -59,11 +60,11 @@ public void testFunctionSerialization() throws Exception {
for (Type type : types) {
for (Transform<?, ?> transform : transforms) {
- Assert.assertEquals(transform, TestHelpers.roundTripSerialize(transform));
+ assertThat(TestHelpers.roundTripSerialize(transform)).isEqualTo(transform);
if (transform.canTransform(type)) {
SerializableFunction<?, ?> func = transform.bind(type);
- Assert.assertTrue(func.getClass().isInstance(TestHelpers.roundTripSerialize(func)));
+ assertThat(func.getClass().isInstance(TestHelpers.roundTripSerialize(func))).isTrue();
Review Comment:
we should try and avoid `isTrue()` / `isFalse()` as much as possible, especially if there's a more expressive way to assert something
##########
api/src/test/java/org/apache/iceberg/io/TestClosingIterator.java:
##########
@@ -18,23 +18,21 @@
*/
package org.apache.iceberg.io;
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertFalse;
-import static org.junit.Assert.assertTrue;
+import static org.assertj.core.api.Assertions.assertThat;
import static org.mockito.Mockito.mock;
import static org.mockito.Mockito.times;
import static org.mockito.Mockito.verify;
import static org.mockito.Mockito.when;
import org.assertj.core.api.Assertions;
-import org.junit.Test;
+import org.junit.jupiter.api.Test;
public class TestClosingIterator {
@Test
public void testEmptyIterator() {
CloseableIterator<String> underlying = mock(CloseableIterator.class);
ClosingIterator<String> closingIterator = new ClosingIterator<>(underlying);
- assertFalse(closingIterator.hasNext());
+ assertThat(closingIterator.hasNext()).isFalse();
Review Comment:
please also adjust other places accordingly
##########
api/src/test/java/org/apache/iceberg/io/TestCloseableIterable.java:
##########
@@ -151,20 +152,19 @@ public void testWithCompletionRunnableWhenIterableThrows() {
throw new RuntimeException("expected");
}),
completionCounter::incrementAndGet)) {
- iter.forEach(val -> Assertions.assertThat(completionCounter.get()).isEqualTo(0));
+ iter.forEach(val -> assertThat(completionCounter.get()).isZero());
}
})
.isInstanceOf(RuntimeException.class)
- .hasMessage("expected");
Review Comment:
I'm not sure I follow this change here. Why do we want to remove `hasMessage()` here?
##########
api/src/test/java/org/apache/iceberg/transforms/TestTruncatesProjection.java:
##########
@@ -104,10 +104,11 @@ public void assertProjectionInclusive(
Expression projection = Projections.inclusive(spec).project(filter);
UnboundPredicate<?> predicate = assertAndUnwrapUnbound(projection);
- Assert.assertEquals(predicate.op(), expectedOp);
+ assertThat(expectedOp).isEqualTo(predicate.op());
- Assert.assertNotEquals(
- "Inclusive projection never runs for NOT_IN", Expression.Operation.NOT_IN, predicate.op());
+ assertThat(predicate.op())
Review Comment:
this and the `isEqualTo()` right above can be combined (as you already did in other test files)
##########
api/src/test/java/org/apache/iceberg/io/TestClosingIterator.java:
##########
@@ -18,23 +18,21 @@
*/
package org.apache.iceberg.io;
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertFalse;
-import static org.junit.Assert.assertTrue;
+import static org.assertj.core.api.Assertions.assertThat;
import static org.mockito.Mockito.mock;
import static org.mockito.Mockito.times;
import static org.mockito.Mockito.verify;
import static org.mockito.Mockito.when;
import org.assertj.core.api.Assertions;
-import org.junit.Test;
+import org.junit.jupiter.api.Test;
public class TestClosingIterator {
@Test
public void testEmptyIterator() {
CloseableIterator<String> underlying = mock(CloseableIterator.class);
ClosingIterator<String> closingIterator = new ClosingIterator<>(underlying);
- assertFalse(closingIterator.hasNext());
+ assertThat(closingIterator.hasNext()).isFalse();
Review Comment:
```suggestion
assertThat(closingIterator).isExhausted();
```
##########
api/src/test/java/org/apache/iceberg/transforms/TestBucketing.java:
##########
@@ -54,80 +55,88 @@ public static void getUUIDConstructor() {
private Random testRandom = null;
- @Before
+ @BeforeEach
public void initRandom() {
// reinitialize random for each test to avoid dependence on run order
this.testRandom = new Random(314358);
}
@Test
public void testSpecValues() {
- Assert.assertEquals("Spec example: hash(true) = 1392991556", 1392991556, BucketUtil.hash(1));
- Assert.assertEquals("Spec example: hash(34) = 2017239379", 2017239379, BucketUtil.hash(34));
- Assert.assertEquals("Spec example: hash(34L) = 2017239379", 2017239379, BucketUtil.hash(34L));
-
- Assert.assertEquals(
- "Spec example: hash(17.11F) = -142385009", -142385009, BucketUtil.hash(1.0F));
- Assert.assertEquals(
- "Spec example: hash(17.11D) = -142385009", -142385009, BucketUtil.hash(1.0D));
- Assert.assertEquals("Spec example: hash(0.0F) = 1669671676", 1669671676, BucketUtil.hash(0.0F));
- Assert.assertEquals(
- "Spec example: hash(-0.0F) = 1669671676", 1669671676, BucketUtil.hash(-0.0F));
- Assert.assertEquals("Spec example: hash(0.0) = 1669671676", 1669671676, BucketUtil.hash(0.0));
- Assert.assertEquals("Spec example: hash(-0.0) = 1669671676", 1669671676, BucketUtil.hash(-0.0));
-
- Assert.assertEquals(
- "Spec example: hash(decimal2(14.20)) = -500754589",
- -500754589,
- BucketUtil.hash(new BigDecimal("14.20")));
- Assert.assertEquals(
- "Spec example: hash(decimal2(14.20)) = -500754589",
- -500754589,
- BucketUtil.hash(new BigDecimal("14.20")));
+ assertThat(BucketUtil.hash(1))
+ .as("Spec example: hash(true) = 1392991556")
+ .isEqualTo(1392991556);
+ assertThat(BucketUtil.hash(34)).as("Spec example: hash(34) = 2017239379").isEqualTo(2017239379);
+ assertThat(BucketUtil.hash(34L))
+ .as("Spec example: hash(34L) = 2017239379")
+ .isEqualTo(2017239379);
+
+ assertThat(BucketUtil.hash(1.0F))
+ .as("Spec example: hash(17.11F) = -142385009")
+ .isEqualTo(-142385009);
+ assertThat(BucketUtil.hash(1.0D))
+ .as("Spec example: hash(17.11D) = -142385009")
+ .isEqualTo(-142385009);
+ assertThat(BucketUtil.hash(0.0F))
+ .as("Spec example: hash(0.0F) = 1669671676")
+ .isEqualTo(1669671676);
+ assertThat(BucketUtil.hash(-0.0F))
+ .as("Spec example: hash(-0.0F) = 1669671676")
+ .isEqualTo(1669671676);
+ assertThat(BucketUtil.hash(0.0))
+ .as("Spec example: hash(0.0) = 1669671676")
+ .isEqualTo(1669671676);
+ assertThat(BucketUtil.hash(-0.0))
+ .as("Spec example: hash(-0.0) = 1669671676")
+ .isEqualTo(1669671676);
+
+ assertThat(BucketUtil.hash(new BigDecimal("14.20")))
+ .as("Spec example: hash(decimal2(14.20)) = -500754589")
+ .isEqualTo(-500754589)
+ .as("Spec example: hash(decimal2(14.20)) = -500754589")
+ .isEqualTo(-500754589);
Literal<Integer> date = Literal.of("2017-11-16").to(Types.DateType.get());
- Assert.assertEquals(
- "Spec example: hash(2017-11-16) = -653330422", -653330422, BucketUtil.hash(date.value()));
+ assertThat(BucketUtil.hash(date.value()))
+ .as("Spec example: hash(2017-11-16) = -653330422")
+ .isEqualTo(-653330422);
Literal<Long> timeValue = Literal.of("22:31:08").to(Types.TimeType.get());
- Assert.assertEquals(
- "Spec example: hash(22:31:08) = -662762989",
- -662762989,
- BucketUtil.hash(timeValue.value()));
+ assertThat(BucketUtil.hash(timeValue.value()))
+ .as("Spec example: hash(22:31:08) = -662762989")
+ .isEqualTo(-662762989);
Literal<Long> timestampVal =
Literal.of("2017-11-16T22:31:08").to(Types.TimestampType.withoutZone());
- Assert.assertEquals(
- "Spec example: hash(2017-11-16T22:31:08) = -2047944441",
- -2047944441,
- BucketUtil.hash(timestampVal.value()));
+ assertThat(BucketUtil.hash(timestampVal.value()))
+ .as("Spec example: hash(2017-11-16T22:31:08) = -2047944441")
+ .isEqualTo(-2047944441);
Literal<Long> timestamptzVal =
Literal.of("2017-11-16T14:31:08-08:00").to(Types.TimestampType.withZone());
- Assert.assertEquals(
- "Spec example: hash(2017-11-16T14:31:08-08:00) = -2047944441",
- -2047944441,
- BucketUtil.hash(timestamptzVal.value()));
-
- Assert.assertEquals(
- "Spec example: hash(\"iceberg\") = 1210000089", 1210000089, BucketUtil.hash("iceberg"));
- Assert.assertEquals(
- "Spec example: hash(\"iceberg\") = 1210000089",
- 1210000089,
- BucketUtil.hash(new Utf8("iceberg")));
+ assertThat(BucketUtil.hash(timestamptzVal.value()))
+ .as("Spec example: hash(2017-11-16T14:31:08-08:00) = -2047944441")
+ .isEqualTo(-2047944441);
+
+ assertThat(BucketUtil.hash("iceberg"))
+ .as("Spec example: hash(\"iceberg\") = 1210000089")
+ .isEqualTo(1210000089);
+ assertThat(BucketUtil.hash(new Utf8("iceberg")))
+ .as("Spec example: hash(\"iceberg\") = 1210000089")
+ .isEqualTo(1210000089);
Literal<UUID> uuid =
Literal.of("f79c3e09-677c-4bbd-a479-3f349cb785e7").to(Types.UUIDType.get());
- Assert.assertEquals(
- "Spec example: hash(f79c3e09-677c-4bbd-a479-3f349cb785e7) = 1488055340",
- 1488055340,
- BucketUtil.hash(uuid.value()));
+ assertThat(BucketUtil.hash(uuid.value()))
+ .as("Spec example: hash(f79c3e09-677c-4bbd-a479-3f349cb785e7) = 1488055340")
+ .isEqualTo(1488055340);
ByteBuffer bytes = ByteBuffer.wrap(new byte[] {0, 1, 2, 3});
- Assert.assertEquals(
- "Spec example: hash([00 01 02 03]) = -188683207", -188683207, BucketUtil.hash(bytes));
- Assert.assertEquals(
- "Spec example: hash([00 01 02 03]) = -188683207", -188683207, BucketUtil.hash(bytes));
+ assertThat(BucketUtil.hash(bytes))
+ .as("Spec example: hash([00 01 02 03]) = -188683207")
+ .isEqualTo(-188683207)
+ .as("Spec example: hash([00 01 02 03]) = -188683207")
Review Comment:
my guess here would be that we wanted to test hashing a ByteBuffer twice to make sure it wasn't modified. That being said, these should be 2 separate hash calls like in the original code
##########
api/src/test/java/org/apache/iceberg/transforms/TestTransformSerialization.java:
##########
@@ -59,11 +60,11 @@ public void testFunctionSerialization() throws Exception {
for (Type type : types) {
for (Transform<?, ?> transform : transforms) {
- Assert.assertEquals(transform, TestHelpers.roundTripSerialize(transform));
+ assertThat(TestHelpers.roundTripSerialize(transform)).isEqualTo(transform);
if (transform.canTransform(type)) {
SerializableFunction<?, ?> func = transform.bind(type);
- Assert.assertTrue(func.getClass().isInstance(TestHelpers.roundTripSerialize(func)));
+ assertThat(func.getClass().isInstance(TestHelpers.roundTripSerialize(func))).isTrue();
Review Comment:
```suggestion
assertThat(func).isInstanceOf(TestHelpers.roundTripSerialize(func).getClass());
```
##########
api/src/test/java/org/apache/iceberg/io/TestClosingIterator.java:
##########
@@ -43,8 +41,8 @@ public void testHasNextAndNext() {
when(underlying.hasNext()).thenReturn(true);
when(underlying.next()).thenReturn("hello");
ClosingIterator<String> closingIterator = new ClosingIterator<>(underlying);
- assertTrue(closingIterator.hasNext());
- assertEquals("hello", closingIterator.next());
+ assertThat(closingIterator.hasNext()).isTrue();
Review Comment:
please also adjust other places accordingly
--
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-unsubscribe@iceberg.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@iceberg.apache.org
For additional commands, e-mail: issues-help@iceberg.apache.org
[GitHub] [iceberg] rakesh-das08 commented on a diff in pull request #7757: Api: Switch tests to Junit5 (io,metrics,transforms packages)
Posted by "rakesh-das08 (via GitHub)" <gi...@apache.org>.
rakesh-das08 commented on code in PR #7757:
URL: https://github.com/apache/iceberg/pull/7757#discussion_r1215484049
##########
api/src/test/java/org/apache/iceberg/io/TestCloseableIterable.java:
##########
@@ -151,20 +152,19 @@ public void testWithCompletionRunnableWhenIterableThrows() {
throw new RuntimeException("expected");
}),
completionCounter::incrementAndGet)) {
- iter.forEach(val -> Assertions.assertThat(completionCounter.get()).isEqualTo(0));
+ iter.forEach(val -> assertThat(completionCounter.get()).isZero());
}
})
.isInstanceOf(RuntimeException.class)
- .hasMessage("expected");
Review Comment:
This has been a miss from my end. Will correct this.
--
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-unsubscribe@iceberg.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@iceberg.apache.org
For additional commands, e-mail: issues-help@iceberg.apache.org
[GitHub] [iceberg] nastra commented on a diff in pull request #7757: Api: Switch tests to Junit5 (io,metrics,transforms packages)
Posted by "nastra (via GitHub)" <gi...@apache.org>.
nastra commented on code in PR #7757:
URL: https://github.com/apache/iceberg/pull/7757#discussion_r1215449224
##########
api/src/test/java/org/apache/iceberg/io/TestCloseableIterable.java:
##########
@@ -107,9 +108,9 @@ public void testWithCompletionRunnable() throws IOException {
try (CloseableIterable<Integer> iter =
CloseableIterable.whenComplete(
CloseableIterable.combine(items, () -> {}), completionCounter::incrementAndGet)) {
- iter.forEach(val -> Assertions.assertThat(completionCounter.get()).isEqualTo(0));
+ iter.forEach(val -> assertThat(completionCounter.get()).isZero());
}
- Assertions.assertThat(completionCounter.get()).isEqualTo(1);
+ assertThat(completionCounter.get()).isOne();
Review Comment:
is there any value in changing this from `isEqualTo()` to `isOne()`? IMO it just adds additional review overhead for something that is already quite large reviewing effort
--
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-unsubscribe@iceberg.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@iceberg.apache.org
For additional commands, e-mail: issues-help@iceberg.apache.org
[GitHub] [iceberg] nastra commented on a diff in pull request #7757: Api: Switch tests to Junit5 (io,metrics,transforms packages)
Posted by "nastra (via GitHub)" <gi...@apache.org>.
nastra commented on code in PR #7757:
URL: https://github.com/apache/iceberg/pull/7757#discussion_r1215449224
##########
api/src/test/java/org/apache/iceberg/io/TestCloseableIterable.java:
##########
@@ -107,9 +108,9 @@ public void testWithCompletionRunnable() throws IOException {
try (CloseableIterable<Integer> iter =
CloseableIterable.whenComplete(
CloseableIterable.combine(items, () -> {}), completionCounter::incrementAndGet)) {
- iter.forEach(val -> Assertions.assertThat(completionCounter.get()).isEqualTo(0));
+ iter.forEach(val -> assertThat(completionCounter.get()).isZero());
}
- Assertions.assertThat(completionCounter.get()).isEqualTo(1);
+ assertThat(completionCounter.get()).isOne();
Review Comment:
is there any value in changing this from `isEqualTo()` to `isOne()`?
--
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-unsubscribe@iceberg.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@iceberg.apache.org
For additional commands, e-mail: issues-help@iceberg.apache.org
[GitHub] [iceberg] nastra commented on pull request #7757: API: Switch tests to JUnit5 (io,metrics,transforms packages)
Posted by "nastra (via GitHub)" <gi...@apache.org>.
nastra commented on PR #7757:
URL: https://github.com/apache/iceberg/pull/7757#issuecomment-1574991772
thanks @rakesh-das08 for working on this
--
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-unsubscribe@iceberg.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@iceberg.apache.org
For additional commands, e-mail: issues-help@iceberg.apache.org
[GitHub] [iceberg] rakesh-das08 commented on a diff in pull request #7757: Api: Switch tests to Junit5 (io,metrics,transforms packages)
Posted by "rakesh-das08 (via GitHub)" <gi...@apache.org>.
rakesh-das08 commented on code in PR #7757:
URL: https://github.com/apache/iceberg/pull/7757#discussion_r1215480332
##########
api/src/test/java/org/apache/iceberg/io/TestCloseableIterable.java:
##########
@@ -107,9 +108,9 @@ public void testWithCompletionRunnable() throws IOException {
try (CloseableIterable<Integer> iter =
CloseableIterable.whenComplete(
CloseableIterable.combine(items, () -> {}), completionCounter::incrementAndGet)) {
- iter.forEach(val -> Assertions.assertThat(completionCounter.get()).isEqualTo(0));
+ iter.forEach(val -> assertThat(completionCounter.get()).isZero());
}
- Assertions.assertThat(completionCounter.get()).isEqualTo(1);
+ assertThat(completionCounter.get()).isOne();
Review Comment:
Thank you Eduard for taking time to review this. Would keep this in mind.
But one qq: Since you have already spent time in reviewing these changes should i revert the isEqualTo() to isOne()/isZero() changes or keep them as it is for now ?
--
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-unsubscribe@iceberg.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@iceberg.apache.org
For additional commands, e-mail: issues-help@iceberg.apache.org
[GitHub] [iceberg] rakesh-das08 commented on a diff in pull request #7757: Api: Switch tests to Junit5 (io,metrics,transforms packages)
Posted by "rakesh-das08 (via GitHub)" <gi...@apache.org>.
rakesh-das08 commented on code in PR #7757:
URL: https://github.com/apache/iceberg/pull/7757#discussion_r1215484358
##########
api/src/test/java/org/apache/iceberg/io/TestClosingIterator.java:
##########
@@ -18,23 +18,21 @@
*/
package org.apache.iceberg.io;
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertFalse;
-import static org.junit.Assert.assertTrue;
+import static org.assertj.core.api.Assertions.assertThat;
import static org.mockito.Mockito.mock;
import static org.mockito.Mockito.times;
import static org.mockito.Mockito.verify;
import static org.mockito.Mockito.when;
import org.assertj.core.api.Assertions;
-import org.junit.Test;
+import org.junit.jupiter.api.Test;
public class TestClosingIterator {
@Test
public void testEmptyIterator() {
CloseableIterator<String> underlying = mock(CloseableIterator.class);
ClosingIterator<String> closingIterator = new ClosingIterator<>(underlying);
- assertFalse(closingIterator.hasNext());
+ assertThat(closingIterator.hasNext()).isFalse();
Review Comment:
Sure
--
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-unsubscribe@iceberg.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@iceberg.apache.org
For additional commands, e-mail: issues-help@iceberg.apache.org
[GitHub] [iceberg] nastra merged pull request #7757: API: Switch tests to JUnit5 (io,metrics,transforms packages)
Posted by "nastra (via GitHub)" <gi...@apache.org>.
nastra merged PR #7757:
URL: https://github.com/apache/iceberg/pull/7757
--
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-unsubscribe@iceberg.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@iceberg.apache.org
For additional commands, e-mail: issues-help@iceberg.apache.org
[GitHub] [iceberg] rakesh-das08 commented on a diff in pull request #7757: Api: Switch tests to Junit5 (io,metrics,transforms packages)
Posted by "rakesh-das08 (via GitHub)" <gi...@apache.org>.
rakesh-das08 commented on code in PR #7757:
URL: https://github.com/apache/iceberg/pull/7757#discussion_r1215497894
##########
api/src/test/java/org/apache/iceberg/transforms/TestTransformSerialization.java:
##########
@@ -59,11 +60,11 @@ public void testFunctionSerialization() throws Exception {
for (Type type : types) {
for (Transform<?, ?> transform : transforms) {
- Assert.assertEquals(transform, TestHelpers.roundTripSerialize(transform));
+ assertThat(TestHelpers.roundTripSerialize(transform)).isEqualTo(transform);
if (transform.canTransform(type)) {
SerializableFunction<?, ?> func = transform.bind(type);
- Assert.assertTrue(func.getClass().isInstance(TestHelpers.roundTripSerialize(func)));
+ assertThat(func.getClass().isInstance(TestHelpers.roundTripSerialize(func))).isTrue();
Review Comment:
Noted.
--
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-unsubscribe@iceberg.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@iceberg.apache.org
For additional commands, e-mail: issues-help@iceberg.apache.org