+ final Boolean result = new EventFilter(logLevel, getSystem()).from(subject.path().toString())
+ .message(logMessage).occurrences(1).intercept(() -> Boolean.TRUE);
+ assertEquals(Boolean.TRUE, result);
+ }
+
+ @SuppressWarnings("checkstyle:IllegalCatch")
+ public static String waitUntilLeader(final ActorRef shard) {
+ FiniteDuration duration = FiniteDuration.create(100, TimeUnit.MILLISECONDS);
+ for (int i = 0; i < 20 * 5; i++) {
+ Future<Object> future = Patterns.ask(shard, FindLeader.INSTANCE, new Timeout(duration));
+ try {
+ final Optional<String> maybeLeader = ((FindLeaderReply) Await.result(future, duration))
+ .getLeaderActor();
+ if (maybeLeader.isPresent()) {
+ return maybeLeader.get();