ferenc-csaky commented on code in PR #23301:
URL: https://github.com/apache/flink/pull/23301#discussion_r1307420110
##########
flink-runtime/src/test/java/org/apache/flink/runtime/rpc/FencedRpcEndpointTest.java:
##########
@@ -88,20 +84,20 @@ public void testFencing() throws Exception {
FencedTestingGateway.class)
.get(timeout.toMilliseconds(),
TimeUnit.MILLISECONDS);
- assertEquals(
- value,
- properFencedGateway
- .foobar(timeout)
- .get(timeout.toMilliseconds(),
TimeUnit.MILLISECONDS));
+ assertThat(
+ properFencedGateway
+ .foobar(timeout)
+ .get(timeout.toMilliseconds(),
TimeUnit.MILLISECONDS))
+ .isEqualTo(value);
try {
wronglyFencedGateway
.foobar(timeout)
.get(timeout.toMilliseconds(), TimeUnit.MILLISECONDS);
fail("This should fail since we have the wrong fencing
token.");
} catch (ExecutionException e) {
- assertTrue(
- ExceptionUtils.stripExecutionException(e) instanceof
FencingTokenException);
+ assertThat(ExceptionUtils.stripExecutionException(e))
Review Comment:
Edit: This can be ignored, since then I realized that
`hasRootCauseInstanceOf` is a more strict condition than
`ExceptionUtils.stripExecutionException`, so it actually modifies the test case.
~~This try/catch can be removed completely:~~
```java
assertThatThrownBy(
() ->
wronglyFencedGateway
.foobar(timeout)
.get(timeout.toMilliseconds(),
TimeUnit.MILLISECONDS))
.hasRootCauseInstanceOf(FencingTokenException.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: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]