WencongLiu commented on code in PR #22171:
URL: https://github.com/apache/flink/pull/22171#discussion_r1135465877
##########
flink-runtime/src/test/java/org/apache/flink/runtime/webmonitor/threadinfo/ThreadInfoRequestCoordinatorTest.java:
##########
@@ -164,25 +160,22 @@ public void testThreadInfoRequestTimeout() throws
Exception {
DEFAULT_MAX_STACK_TRACE_DEPTH);
try {
- requestFuture.get();
- fail("Exception expected.");
- } catch (ExecutionException e) {
- assertThat(
- ExceptionUtils.findThrowableWithMessage(e,
REQUEST_TIMEOUT_MESSAGE)
- .isPresent())
- .isTrue();
+ assertThatThrownBy(requestFuture::get, "Exception expected.")
Review Comment:
Same with last one.
##########
flink-runtime/src/test/java/org/apache/flink/runtime/webmonitor/threadinfo/ThreadInfoRequestCoordinatorTest.java:
##########
@@ -140,17 +139,14 @@ public void testThreadInfoRequestWithException() throws
Exception {
DEFAULT_DELAY_BETWEEN_SAMPLES,
DEFAULT_MAX_STACK_TRACE_DEPTH);
- try {
- requestFuture.get();
- fail("Exception expected.");
- } catch (ExecutionException e) {
- assertThat(e.getCause()).isInstanceOf(RuntimeException.class);
- }
+ assertThatThrownBy(requestFuture::get, "Exception expected.")
Review Comment:
Maybe "The request must be failed." is more suitable? For this version, If
the requestFuture is completed successfully, there will be a exception like
this:
java.lang.AssertionError: [Exception expected.]
Expecting code to raise a throwable.
--
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]