### Question:
CompositeCommand extends CommandBase { @Override public void execute() { if (!isExecutable()) { throw new RuntimeException("Not executable"); } else { if (!registeredCommands.isEmpty()) { registeredCommands.forEach(t -> t.execute()); } } } CompositeCommand(Command... commands); void register(Command command); void unregister(Command command); @Override void execute(); @Override double getProgress(); @Override ReadOnlyDoubleProperty progressProperty();  }### Answer:
@Disabled("unstable test. Needs to be fixed. see bug #260") @Test public void longRunningAsyncComposite() throws Exception { BooleanProperty condition = new SimpleBooleanProperty(true); CompletableFuture<Void> commandStarted = new CompletableFuture<>(); CompletableFuture<Void> commandCompleted = new CompletableFuture<>(); CompletableFuture<Void> future = new CompletableFuture<>(); DelegateCommand delegateCommand1 = new DelegateCommand(() -> new Action() { @Override protected void action() throws Exception { sleep(500); } }, condition, true); DelegateCommand delegateCommand2 = new DelegateCommand(() -> new Action() { @Override protected void action() throws Exception { sleep(1000); future.complete(null); } }, condition, true); DelegateCommand delegateCommand3 = new DelegateCommand(() -> new Action() { @Override protected void action() throws Exception { } }, condition, true); CompositeCommand compositeCommand = new CompositeCommand(delegateCommand1, delegateCommand2, delegateCommand3); GCVerifier.forceGC(); compositeCommand.runningProperty().addListener((observable, oldValue, newValue) -> { if (newValue && !oldValue) { Platform.runLater(() -> { assertTrue(compositeCommand.runningProperty().get()); assertTrue(delegateCommand1.runningProperty().get()); assertTrue(delegateCommand2.runningProperty().get()); assertTrue(delegateCommand3.runningProperty().get()); assertFalse(compositeCommand.notRunningProperty().get()); assertFalse(delegateCommand1.notRunningProperty().get()); assertFalse(delegateCommand2.notRunningProperty().get()); assertFalse(delegateCommand3.notRunningProperty().get()); commandStarted.complete(null); }); } if (oldValue && !newValue) { Platform.runLater(() -> { assertFalse(compositeCommand.runningProperty().get()); assertFalse(delegateCommand1.runningProperty().get()); assertFalse(delegateCommand2.runningProperty().get()); assertFalse(delegateCommand3.runningProperty().get()); assertTrue(compositeCommand.notRunningProperty().get()); assertTrue(delegateCommand1.notRunningProperty().get()); assertTrue(delegateCommand2.notRunningProperty().get()); assertTrue(delegateCommand3.notRunningProperty().get()); commandCompleted.complete(null); }); } }); compositeCommand.execute(); commandStarted.get(5, TimeUnit.SECONDS); future.get(5, TimeUnit.SECONDS); commandCompleted.get(5, TimeUnit.SECONDS); }