1996fanrui commented on code in PR #23199:
URL: https://github.com/apache/flink/pull/23199#discussion_r1303220686
##########
flink-runtime/src/test/java/org/apache/flink/runtime/util/SerializedThrowableTest.java:
##########
@@ -63,20 +60,21 @@ public void testSerialization() {
Class<?> clazz = userException.getClass();
// check that we cannot simply copy the exception
- try {
- byte[] serialized =
InstantiationUtil.serializeObject(userException);
- InstantiationUtil.deserializeObject(serialized,
getClass().getClassLoader());
- fail("should fail with a class not found exception");
- } catch (ClassNotFoundException e) {
- // as we want it
- }
+ assertThatThrownBy(
+ () -> {
+ byte[] serialized =
+
InstantiationUtil.serializeObject(userException);
+ InstantiationUtil.deserializeObject(
+ serialized,
getClass().getClassLoader());
Review Comment:
The first line should be moved out of this `assertThatThrownBy` if we expect
`InstantiationUtil.deserializeObject(` throw exception.
--
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]