nastra commented on code in PR #9760:
URL: https://github.com/apache/iceberg/pull/9760#discussion_r1498984200
##########
spark/v3.5/spark-extensions/src/test/java/org/apache/iceberg/spark/extensions/TestCallStatementParser.java:
##########
@@ -188,25 +184,26 @@ private void checkArg(
if (expectedName != null) {
NamedArgument arg = checkCast(call.args().apply(index),
NamedArgument.class);
- Assert.assertEquals(expectedName, arg.name());
+ assertThat(arg.name()).isEqualTo(expectedName);
} else {
CallArgument arg = call.args().apply(index);
checkCast(arg, PositionalArgument.class);
}
Expression expectedExpr = toSparkLiteral(expectedValue, expectedType);
Expression actualExpr = call.args().apply(index).expr();
- Assert.assertEquals("Arg types must match", expectedExpr.dataType(),
actualExpr.dataType());
- Assert.assertEquals("Arg must match", expectedExpr, actualExpr);
+ assertThat(actualExpr.dataType()).as("Arg types must
match").isEqualTo(expectedExpr.dataType());
+ assertThat(actualExpr).as("Arg must match").isEqualTo(expectedExpr);
}
private Literal toSparkLiteral(Object value, DataType dataType) {
return Literal$.MODULE$.create(value, dataType);
}
private <T> T checkCast(Object value, Class<T> expectedClass) {
- Assert.assertTrue(
- "Expected instance of " + expectedClass.getName(),
expectedClass.isInstance(value));
+ assertThat(expectedClass.isInstance(value))
Review Comment:
the problem with the current assertion is that it only will print true/false
if the assertion fails. What we rather want to achieve for assertions is to
have enough context to know what actual/expected was exactly. That being said,
we want to avoid the usage of `isTrue()` / `isFalse()` as much as possible.
What was the assertion that you previously used?
--
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]