nastra commented on code in PR #7730:
URL: https://github.com/apache/iceberg/pull/7730#discussion_r1211222502
##########
api/src/test/java/org/apache/iceberg/expressions/TestNumericLiteralConversions.java:
##########
@@ -127,20 +119,17 @@ public void testFloatToDecimalConversion() {
assertThat(lit.to(Types.DecimalType.of(9, 1)).value())
.as("Value should round using HALF_UP")
.isEqualTo(new BigDecimal("34.6"));
- assertThat(lit.to(Types.DecimalType.of(9, 2)).value())
- .as("Value should match")
- .isEqualTo(new BigDecimal("34.56"));
- assertThat(lit.to(Types.DecimalType.of(9, 4)).value())
- .as("Value should match")
- .isEqualTo(new BigDecimal("34.5600"));
+ assertThat(lit.to(Types.DecimalType.of(9, 2)).value()).isEqualTo(new
BigDecimal("34.56"));
+
Review Comment:
nit: can we remove this newline?
##########
api/src/test/java/org/apache/iceberg/expressions/TestNumericLiteralConversions.java:
##########
@@ -159,12 +148,9 @@ public void testDoubleToDecimalConversion() {
assertThat(lit.to(Types.DecimalType.of(9, 1)).value())
.as("Value should round using HALF_UP")
.isEqualTo(new BigDecimal("34.6"));
- assertThat(lit.to(Types.DecimalType.of(9, 2)).value())
- .as("Value should match")
- .isEqualTo(new BigDecimal("34.56"));
- assertThat(lit.to(Types.DecimalType.of(9, 4)).value())
- .as("Value should match")
- .isEqualTo(new BigDecimal("34.5600"));
+ assertThat(lit.to(Types.DecimalType.of(9, 2)).value()).isEqualTo(new
BigDecimal("34.56"));
+
Review Comment:
nit: can we remove this unnecessary newline?
##########
api/src/test/java/org/apache/iceberg/expressions/TestNumericLiteralConversions.java:
##########
@@ -18,155 +18,139 @@
*/
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()).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()).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()).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()).isEqualTo(new
BigDecimal("34"));
+
Review Comment:
nit: can we remove these unnecessary newlines?
--
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]