io.magentys.java8.FutureMission Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of cherry-java8 Show documentation
Show all versions of cherry-java8 Show documentation
A syntactical sugar project for BDD oriented tests
The newest version!
package io.magentys.java8;
import io.magentys.Mission;
import java.util.concurrent.CompletableFuture;
import java.util.stream.Stream;
public interface FutureMission extends Mission {
default CompletableFuture accomplishAsync(Mission mission, FunctionalAgent agent) {
CompletableFuture futureResult = new CompletableFuture<>();
Runnable runnable = () -> {
try {
Result result = mission.accomplishAs(agent);
futureResult.complete(result);
} catch (Throwable e) {
futureResult.completeExceptionally(e);
}
};
new Thread(runnable).start();
return futureResult;
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy