Skip to content
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
21 changes: 16 additions & 5 deletions cucumber-core/src/main/java/io/cucumber/core/runtime/Runtime.java
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
import io.cucumber.core.eventbus.EventBus;
import io.cucumber.core.feature.FeatureParser;
import io.cucumber.core.filter.Filters;
import io.cucumber.core.eventbus.UuidGenerator;
import io.cucumber.core.gherkin.Feature;
import io.cucumber.core.gherkin.Pickle;
import io.cucumber.core.logging.Logger;
Expand Down Expand Up @@ -119,6 +120,7 @@ public static class Builder {
private BackendSupplier backendSupplier;
private FeatureSupplier featureSupplier;
private List<Plugin> additionalPlugins = emptyList();
private UuidGenerator uuidGenerator;

private Builder() {
}
Expand All @@ -142,6 +144,11 @@ public Builder withFeatureSupplier(final FeatureSupplier featureSupplier) {
this.featureSupplier = featureSupplier;
return this;
}

public Builder withFeatureSupplier(final UuidGenerator uuidGenerator) {
this.uuidGenerator = uuidGenerator;
return this;
}

public Builder withAdditionalPlugins(final Plugin... plugins) {
this.additionalPlugins = Arrays.asList(plugins);
Expand Down Expand Up @@ -173,11 +180,15 @@ public Runtime build() {
plugins.addPlugin(exitStatus);

if (this.eventBus == null) {
final UuidGeneratorServiceLoader uuidGeneratorServiceLoader = new UuidGeneratorServiceLoader(
classLoader,
runtimeOptions);
this.eventBus = new TimeServiceEventBus(Clock.systemUTC(),
uuidGeneratorServiceLoader.loadUuidGenerator());
UuidGenerator generator;
if (uuidGenerator == null) {
final UuidGeneratorServiceLoader uuidGeneratorServiceLoader = new UuidGeneratorServiceLoader(
classLoader, runtimeOptions);
generator = uuidGeneratorServiceLoader.loadUuidGenerator();
} else {
generator = uuidGenerator;
}
this.eventBus = new TimeServiceEventBus(Clock.systemUTC(), generator);
}
final EventBus eventBus = synchronize(this.eventBus);

Expand Down
Loading