void (Invoker invoker, boolean expectedBefore, boolean expectedAfter) { CountDownLatch latch = new CountDownLatch(1); test(invoker, latch, error -> { if (isExpected(latch, error, "before", expectedBefore)) { getApplication().runReadAction(() -> { register(invoker.invoke(() -> { if (isExpected(latch, error, "after", expectedAfter)) { latch.countDown(); // interrupt without any error } })); }); } }); }