luoyuxia commented on code in PR #23358:
URL: https://github.com/apache/flink/pull/23358#discussion_r1329993380


##########
flink-table/flink-table-planner/src/test/scala/org/apache/flink/table/planner/expressions/utils/ExpressionTestBase.scala:
##########
@@ -138,33 +131,28 @@ abstract class ExpressionTestBase(isStreaming: Boolean = 
true) {
     invalidTableApiExprs.clear()
   }
 
-  @After
+  @AfterEach
   def evaluateExprs(): Unit = {
 
     // evaluate valid expressions
     evaluateGivenExprs(validExprs)
 
     // evaluate invalid expressions
     invalidSqlExprs.foreach {
-      case (sqlExpr, keywords, clazz) => {
-        try {
+      case (sqlExpr, keywords, clazz) =>
+        val callable: ThrowingCallable = () => {
           val invalidExprs = mutable.ArrayBuffer[(String, RexNode, String)]()
           addSqlTestExpr(sqlExpr, keywords, invalidExprs, clazz)
           evaluateGivenExprs(invalidExprs)
-          fail(s"Expected a $clazz, but no exception is thrown.")
-        } catch {
-          case e if e.getClass == clazz =>
-            if (keywords != null) {
-              assertTrue(
-                s"The actual exception message \n${e.getMessage}\n" +
-                  s"doesn't contain expected keyword \n$keywords\n",
-                e.getMessage.contains(keywords))
-            }
-          case e: Throwable =>
-            e.printStackTrace()

Review Comment:
   Thx, make sense to me.



##########
flink-table/flink-table-planner/src/test/scala/org/apache/flink/table/planner/expressions/ArrayTypeTest.scala:
##########
@@ -21,7 +21,8 @@ import org.apache.flink.table.api._
 import org.apache.flink.table.planner.expressions.utils.ArrayTypeTestBase
 import org.apache.flink.table.planner.utils.DateTimeTestUtil.{localDate, 
localDateTime, localTime => gLocalTime}
 
-import org.junit.Test
+import org.assertj.core.api.Assertions.{assertThatExceptionOfType, 
assertThatThrownBy}

Review Comment:
   Are you sure is it used? I still couldn't find the usage of 
`assertThatExceptionOfType`. Could you please post the link where it's 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: issues-unsubscr...@flink.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org

Reply via email to