TestEventInterceptor (Grails 3.2.4)
Date: 2016-12-21

Package: grails.test.runtime

## [Groovy] Interface TestEventInterceptor

- Interface for event interceptors in the TestRuntime An event interceptor can be registered in 3 different ways: - a SharedRuntimeConfigurer that implements this interface will get registered - all plugins that implement this interface - manually by calling TestRuntime.addInterceptor method

  Authors:
    Lari Hotari
  Since:
    2.4.0

- - ### Methods Summary

    Methods
    Type | Name and description
    --- | ---
    `void` | `eventDelivered(TestEvent event)` This method is called after a single event has been delivered to plugins
    `void` | `eventPublished(TestEvent event)` This method is called before an event gets delivered and processed
    `void` | `eventsProcessed(TestEvent event, java.util.List<TestEvent> consequenceEvents)` This method is called after each "top-level" event has been fully processed.
    `void` | `mutateDeferredEvents(TestEvent event, java.util.List<TestEvent> deferredEvents)` This method is called before deferred events are delivered

- - ### Method Detail

    - #### void eventDelivered(TestEvent event)

      This method is called after a single event has been delivered to plugins

      Parameters:
        event

    - #### void eventPublished(TestEvent event)

      This method is called before an event gets delivered and processed event delivery can be prevented by setting the "stopDelivery" flag on the event instance

      Parameters:
        event

    - #### void eventsProcessed(TestEvent event, java.util.List<TestEvent> consequenceEvents)

      This method is called after each "top-level" event has been fully processed. This means that the event has been delivered and all of the consequnce events have been also processed. Events with "immediateDelivery" flag are considered top-level events besides the first initial event delivered to the system This list of consequence events doesn't contain other "top-level" events.

      Parameters:
        event
        `consequenceEvents` - processed consequence events that were the implication of the initial event and that were also processed

    - #### void mutateDeferredEvents(TestEvent event, java.util.List<TestEvent> deferredEvents)

      This method is called before deferred events are delivered this method might be called several times for a single top-level event since the processing of each deferred event might bring in more deferred events. A deferred event can be removed/combined or events can be reordered before they get delivered.

      Parameters:
        `event` - top-level event
        `deferredEvents` - list of deferred