Fix test helper

This commit is contained in:
Rene Pfeuffer
2019-12-11 12:58:01 +01:00
parent 9a8f0a4ee7
commit a37df2c20b
3 changed files with 18 additions and 7 deletions

View File

@@ -1,10 +1,23 @@
package sonia.scm.repository.spi;
import java.time.Instant;
import java.util.function.Consumer;
import static sonia.scm.repository.spi.SyncAsyncExecutor.ExecutionType.SYNCHRONOUS;
public final class SyncAsyncExecutors {
public static SyncAsyncExecutor synchronousExecutor() {
return new SyncAsyncExecutor(Runnable::run, Instant.MAX);
return new SyncAsyncExecutor() {
@Override
public ExecutionType execute(Consumer<ExecutionType> runnable) {
runnable.accept(SYNCHRONOUS);
return SYNCHRONOUS;
}
@Override
public boolean hasExecutedAllSynchronously() {
return true;
}
};
}
}