libenchao commented on a change in pull request #12421:
URL: https://github.com/apache/flink/pull/12421#discussion_r433040780



##########
File path: 
flink-formats/flink-json/src/test/java/org/apache/flink/formats/json/JsonRowDataSerDeSchemaTest.java
##########
@@ -375,8 +375,12 @@ private void testParseErrors(TestSpec spec) throws 
Exception {
                JsonRowDataDeserializationSchema failingSchema = new 
JsonRowDataDeserializationSchema(
                        spec.rowType,  new RowDataTypeInfo(spec.rowType), 
false, false);
 
-               thrown.expectMessage(spec.errorMessage);
-               failingSchema.deserialize(spec.json.getBytes());
+               try {
+                       failingSchema.deserialize(spec.json.getBytes());
+                       throw new RuntimeException("expecting exception " + 
spec.errorMessage);
+               } catch (Throwable t) {
+                       assertEquals(t.getMessage(), spec.errorMessage);
+               }

Review comment:
       It's a very interesting question. The original implementation indeed has 
some unexpected behavior. It will abort the testing when it encounters one 
exception, no matter it is expected or not.
   Hence, the original tests only run until the first exception it thrown, and 
the next tests will be omitted. That's why the next test can pass before.




----------------------------------------------------------------
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.

For queries about this service, please contact Infrastructure at:
[email protected]


Reply via email to