io.cucumber.core.runtime.TimeServiceEventBus Maven / Gradle / Ivy
package io.cucumber.core.runtime;
import io.cucumber.core.eventbus.AbstractEventBus;
import java.time.Clock;
import java.time.Instant;
import java.util.UUID;
import java.util.function.Supplier;
public final class TimeServiceEventBus extends AbstractEventBus {
private final Clock clock;
private final Supplier idGenerator;
public TimeServiceEventBus(Clock clock, Supplier idGenerator) {
this.clock = clock;
this.idGenerator = idGenerator;
}
@Override
public Instant getInstant() {
return clock.instant();
}
@Override
public UUID generateId() {
return idGenerator.get();
}
}