TodoManagerImpl { public void add(final Callback<Boolean> callback, final Todo todo) { todoMap.put(todo.getId(), todo); auditor.audit("add", "added new todo"); callback.resolve(true); } TodoManagerImpl(final Auditor auditor); void add(final Callback<Boolean> callback, final Todo todo); void remove(final Callback<Boolean> callback, final String id); void list(final Callback<ArrayList<Todo>> callback); @QueueCallback({QueueCallbackType.LIMIT, QueueCallbackType.EMPTY, QueueCallbackType.IDLE}) void process(); @QueueCallback({QueueCallbackType.INIT}) void init(); @QueueCallback({QueueCallbackType.SHUTDOWN}) void shutdown();  }
@Test public void testUsingAll() throws Exception { final List<Promise<Boolean>> promises = new ArrayList<>(3); final CountDownLatch latch = new CountDownLatch(1); final AtomicBoolean success = new AtomicBoolean(); final Todo todo = new Todo("write", "Write tutorial", timer.time()); final Promise<Boolean> promise = client.add(todo); promises.add(promise); promises.add(client.add(new Todo("callMom", "Call Mom", timer.time()))); promises.add(client.add(new Todo("callSis", "Call Sister", timer.time()))); Promises.all(promises).then(done -> { success.set(true); latch.countDown(); }).catchError(e -> { success.set(false); latch.countDown(); }); promises.forEach(Promise::invoke); flushServiceProxy(client); latch.await(); assertTrue(success.get()); }