tomtongue commented on code in PR #10039: URL: https://github.com/apache/iceberg/pull/10039#discussion_r1542341876
########## core/src/test/java/org/apache/iceberg/TestMetrics.java: ########## @@ -766,24 +771,25 @@ protected void assertCounts(int fieldId, Long valueCount, Long nullValueCount, M protected void assertCounts( int fieldId, Long valueCount, Long nullValueCount, Long nanValueCount, Metrics metrics) { - Map<Integer, Long> valueCounts = metrics.valueCounts(); - Map<Integer, Long> nullValueCounts = metrics.nullValueCounts(); - Map<Integer, Long> nanValueCounts = metrics.nanValueCounts(); - Assert.assertEquals(valueCount, valueCounts.get(fieldId)); - Assert.assertEquals(nullValueCount, nullValueCounts.get(fieldId)); - Assert.assertEquals(nanValueCount, nanValueCounts.get(fieldId)); + assertThat(metrics.valueCounts().get(fieldId)).isEqualTo(valueCount); + assertThat(metrics.nullValueCounts().get(fieldId)).isEqualTo(nullValueCount); + assertThat(metrics.nanValueCounts().get(fieldId)).isEqualTo(nanValueCount); } protected <T> void assertBounds( int fieldId, Type type, T lowerBound, T upperBound, Metrics metrics) { Map<Integer, ByteBuffer> lowerBounds = metrics.lowerBounds(); Map<Integer, ByteBuffer> upperBounds = metrics.upperBounds(); - Assert.assertEquals( - lowerBound, - lowerBounds.containsKey(fieldId) ? fromByteBuffer(type, lowerBounds.get(fieldId)) : null); - Assert.assertEquals( - upperBound, - upperBounds.containsKey(fieldId) ? fromByteBuffer(type, upperBounds.get(fieldId)) : null); + assertThat( + lowerBounds.containsKey(fieldId) + ? Optional.ofNullable(fromByteBuffer(type, lowerBounds.get(fieldId))).get() Review Comment: This part throws compilation failure because of the [ambiguous error](http://joel-costigliola.github.io/assertj/assertj-core.html#ambiguous-compilation-error) (at least in Java 8 and 17) of reference to `assertThat` if it's only `fromByteBuffer(...)`. The other workaround is to use type-cast here. We can also use `(Object)` cast like: ```java assertThat( lowerBounds.containsKey(fieldId) ? (Object) fromByteBuffer(type, lowerBounds.get(fieldId)) : null) .isEqualTo(lowerBound); ``` I will try modifying this part with the `Object` cast, but what do you think about this? @nastra -- 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...@iceberg.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org --------------------------------------------------------------------- To unsubscribe, e-mail: issues-unsubscr...@iceberg.apache.org For additional commands, e-mail: issues-h...@iceberg.apache.org