rakesh-das08 commented on code in PR #7730:
URL: https://github.com/apache/iceberg/pull/7730#discussion_r1210442623
##########
api/src/test/java/org/apache/iceberg/expressions/TestNumericLiteralConversions.java:
##########
@@ -18,155 +18,153 @@
*/
package org.apache.iceberg.expressions;
+import static org.assertj.core.api.Assertions.assertThat;
+import static org.assertj.core.data.Offset.offset;
+
import java.math.BigDecimal;
import java.util.stream.IntStream;
import org.apache.iceberg.types.Types;
-import org.junit.Assert;
-import org.junit.Test;
+import org.junit.jupiter.api.Test;
public class TestNumericLiteralConversions {
@Test
public void testIntegerToLongConversion() {
Literal<Integer> lit = Literal.of(34);
Literal<Long> longLit = lit.to(Types.LongType.get());
- Assert.assertEquals("Value should match", 34L, (long) longLit.value());
+ assertThat((long) longLit.value()).as("Value should match").isEqualTo(34L);
}
@Test
public void testIntegerToFloatConversion() {
Literal<Integer> lit = Literal.of(34);
Literal<Float> floatLit = lit.to(Types.FloatType.get());
- Assert.assertEquals("Value should match", 34.0F, floatLit.value(),
0.0000000001D);
+ assertThat(floatLit.value()).as("Value should match").isCloseTo(34.0F,
offset(0.0000000001F));
}
@Test
public void testIntegerToDoubleConversion() {
Literal<Integer> lit = Literal.of(34);
Literal<Double> doubleLit = lit.to(Types.DoubleType.get());
- Assert.assertEquals("Value should match", 34.0D, doubleLit.value(),
0.0000000001D);
+ assertThat(doubleLit.value()).as("Value should match").isCloseTo(34.0D,
offset(0.0000000001D));
}
@Test
public void testIntegerToDecimalConversion() {
Literal<Integer> lit = Literal.of(34);
- Assert.assertEquals(
- "Value should match", new BigDecimal("34"),
lit.to(Types.DecimalType.of(9, 0)).value());
- Assert.assertEquals(
- "Value should match", new BigDecimal("34.00"),
lit.to(Types.DecimalType.of(9, 2)).value());
- Assert.assertEquals(
- "Value should match",
- new BigDecimal("34.0000"),
- lit.to(Types.DecimalType.of(9, 4)).value());
+ assertThat(lit.to(Types.DecimalType.of(9, 0)).value())
+ .as("Value should match")
Review Comment:
Sure. Made changes wherever i thought obvious description of tests is there.
--
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]