### Question:
CompletableResultCode { public CompletableResultCode succeed() { synchronized (lock) { if (succeeded == null) { succeeded = true; for (Runnable action : completionActions) { action.run(); } } } return this; } CompletableResultCode(); static CompletableResultCode ofSuccess(); static CompletableResultCode ofFailure(); static CompletableResultCode ofAll(final Collection<CompletableResultCode> codes); CompletableResultCode succeed(); CompletableResultCode fail(); boolean isSuccess(); CompletableResultCode whenComplete(Runnable action); boolean isDone(); CompletableResultCode join(long timeout, TimeUnit unit);  }### Answer:
@Test void succeed() throws InterruptedException { CompletableResultCode resultCode = new CompletableResultCode(); CountDownLatch completions = new CountDownLatch(1); new Thread( new Runnable() { @Override public void run() { resultCode.succeed(); } }) .start(); resultCode.whenComplete( new Runnable() { @Override public void run() { completions.countDown(); } }); completions.await(3, TimeUnit.SECONDS); assertThat(resultCode.isSuccess()).isTrue(); }