reswqa commented on code in PR #22471:
URL: https://github.com/apache/flink/pull/22471#discussion_r1174870744


##########
flink-queryable-state/flink-queryable-state-runtime/src/test/java/org/apache/flink/queryablestate/network/ClientTest.java:
##########
@@ -721,29 +690,29 @@ public void testClientServerIntegration() throws 
Throwable {
             } catch (Exception e) {
                 e.printStackTrace();
             }
-            Assert.assertTrue(client.isEventGroupShutdown());
-
-            final CombinableMatcher<Throwable> exceptionMatcher =
-                    
either(FlinkMatchers.containsCause(ClosedChannelException.class))
-                            
.or(FlinkMatchers.containsCause(IllegalStateException.class));
+            assertThat(client.isEventGroupShutdown()).isTrue();
 
             for (Future<Void> future : taskFutures) {
                 try {
                     future.get();
-                    fail("Did not throw expected Exception after shut down");
-                } catch (ExecutionException t) {
-                    assertThat(t, exceptionMatcher);
+                } catch (Throwable throwable) {
+                    assertThat(throwable.getCause().getCause())
+                            .isInstanceOfAny(
+                                    ClosedChannelException.class, 
IllegalStateException.class);

Review Comment:
   `throwable.getCause().getCause()` is a bit too hack and relying on the level 
of the error stack.
   
   How about asserting this like:
   
   ```
   FlinkAssertions.assertThatChainOfCauses(throwable)
                       .anySatisfy(
                               cause ->
                                       Assertions.assertThat(cause)
                                               .isInstanceOfAny(
                                                       IOException.class, 
RuntimeException.class));
   ```
   



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