Class SynchronizedEventBus

java.lang.Object
io.cucumber.core.runtime.SynchronizedEventBus
All Implemented Interfaces:
EventBus, EventPublisher

public final class SynchronizedEventBus extends Object implements EventBus
  • Field Details

    • delegate

      private final EventBus delegate
  • Constructor Details

    • SynchronizedEventBus

      private SynchronizedEventBus(EventBus delegate)
  • Method Details

    • synchronize

      public static SynchronizedEventBus synchronize(EventBus eventBus)
    • registerHandlerFor

      public <T> void registerHandlerFor(Class<T> eventType, EventHandler<T> handler)
      Description copied from interface: EventPublisher
      Registers an event handler for a specific event.

      The available events types are:

      • Event - all events.
      • TestRunStarted - the first event sent.
      • TestSourceRead - sent for each feature file read, contains the feature file source.
      • SnippetsSuggestedEvent - sent for each step that could not be matched to a step definition, contains the raw snippets for the step.
      • StepDefinedEvent - sent for each step definition as it is loaded, contains the StepDefinition
      • TestCaseStarted - sent before starting the execution of a Test Case(/Pickle/Scenario), contains the Test Case
      • TestStepStarted - sent before starting the execution of a Test Step, contains the Test Step
      • EmbedEvent - calling scenario.attach in a hook triggers this event.
      • WriteEvent - calling scenario.log in a hook triggers this event.
      • TestStepFinished - sent after the execution of a Test Step, contains the Test Step and its Result.
      • TestCaseFinished - sent after the execution of a Test Case(/Pickle/Scenario), contains the Test Case and its Result.
      • TestRunFinished - the last event sent.
      Specified by:
      registerHandlerFor in interface EventPublisher
      Type Parameters:
      T - the event type
      Parameters:
      eventType - the event type for which the handler is being registered
      handler - the event handler
      See Also:
    • removeHandlerFor

      public <T> void removeHandlerFor(Class<T> eventType, EventHandler<T> handler)
      Description copied from interface: EventPublisher
      Unregister an event handler for a specific event
      Specified by:
      removeHandlerFor in interface EventPublisher
      Type Parameters:
      T - the event type
      Parameters:
      eventType - the event type for which the handler is being registered
      handler - the event handler
    • getInstant

      public Instant getInstant()
      Specified by:
      getInstant in interface EventBus
    • generateId

      public UUID generateId()
      Specified by:
      generateId in interface EventBus
    • send

      public <T> void send(T event)
      Specified by:
      send in interface EventBus
    • sendAll

      public <T> void sendAll(Iterable<T> events)
      Specified by:
      sendAll in interface EventBus