zentol commented on code in PR #22935:
URL: https://github.com/apache/flink/pull/22935#discussion_r1254766401
##########
flink-runtime/src/test/java/org/apache/flink/runtime/leaderelection/TestingLeaderElectionListener.java:
##########
@@ -61,6 +66,19 @@ private void put(LeaderElectionEvent leaderElectionEvent) {
}
}
+ public <T> T assertNextEvent(Class<T> expectedEventClass) throws
InterruptedException {
+ final LeaderElectionEvent leaderElectionEvent =
leaderElectionEvents.take();
+
+ if
(expectedEventClass.isAssignableFrom(leaderElectionEvent.getClass())) {
+ return expectedEventClass.cast(leaderElectionEvent);
+ }
+
+ throw new AssertionError(
+ String.format(
+ "The next event didn't match the expected event type
%s.",
+ expectedEventClass.getSimpleName()));
Review Comment:
```
assertThat(leaderElectionEvent.getClass).isInstanceOf(expectedEventClass);
return <cast>
```
--
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]