tomtongue commented on code in PR #9760:
URL: https://github.com/apache/iceberg/pull/9760#discussion_r1498994264
##########
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:
Thanks for the reply. Yes, I understand the situation and we should avoid
using `isTrue()`/`isFalse()`.
In the current PR, I change it to
`assertThat(expectedClass.isInstance(value)).isTrue()`,
Before submitting the PR, I tested
`assertThat(expectedClass).isInstanceOf(value.getClass())`, but this failed due
to the error above. This is the reason
`assertThat(expectedClass.isInstance(value)).isTrue()` is used here.
--
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]