void (Invoker invoker, boolean ordered) { CountDownLatch latch = new CountDownLatch(2); test(invoker, latch, error -> { long first = ordered ? 2 : 1; register(invoker.invokeLater(() -> countDown(latch, 100, error, "unexpected task order", () -> first == latch.getCount()))); long second = ordered ? 1 : 2; register(invoker.invokeLater(() -> countDown(latch, 0, error, "unexpected task order", () -> second == latch.getCount()))); }); }