Class Scenario.When.EventResult<E>

java.lang.Object
org.springframework.modulith.test.Scenario.When.EventResult<E>
Enclosing class:
Scenario.When<T>

public class Scenario.When.EventResult<E> extends Object
The result of an expected event publication.
Author:
Oliver Drotbohm
  • Constructor Details

  • Method Details

    • matching

      public Scenario.When<T>.EventResult<E> matching(Predicate<? super E> filter)
      Matches events that satisfy the given Predicate.
      Parameters:
      filter - must not be null.
      Returns:
      will never be null.
    • matchingMapped

      public <S> Scenario.When<T>.EventResult<E> matchingMapped(Function<E,S> extractor, Predicate<? super S> filter)
      Matches events that satisfy the given Predicate after extracting a value using the given Function.
      Type Parameters:
      S - the type of the extracted value.
      Parameters:
      extractor - must not be null.
      filter - must not be null.
      Returns:
      will never be null.
    • matchingMappedValue

      public <S> Scenario.When<T>.EventResult<E> matchingMappedValue(Function<E,S> extractor, @Nullable S value)
      Matches events that extracting the given value using the given Function.
      Type Parameters:
      S - the type of the extracted value.
      Parameters:
      extractor - must not be null.
      value - can be null.
      Returns:
      will never be null.
    • toArrive

      public void toArrive()
      Awaits an event of the given specification to arrive.
    • toArriveAndVerify

      public void toArriveAndVerify(Consumer<E> consumer)
      Awaits an event of the given specification to arrive and invokes the given consumer with it.
      Parameters:
      consumer - must not be null.
    • toArriveAndVerify

      public void toArriveAndVerify(BiConsumer<E,T> consumer)
      Awaits an event of the given specification to arrive and invokes the given consumer with it as well as the result created by the stimulus.
      Parameters:
      consumer - must not be null.
    • toArriveAndAssert

      public void toArriveAndAssert(Consumer<PublishedEventsAssert.PublishedEventAssert<? super E>> consumer)
      Expects the events previously specified to arrive and additionally assert the PublishedEventsAssert for the captured event.
      Parameters:
      consumer - must not be null.
    • toArriveAndAssert

      public void toArriveAndAssert(BiConsumer<PublishedEventsAssert.PublishedEventAssert<? super E>,T> consumer)
      Expects the events previously specified to arrive and additionally assert the PublishedEventsAssert for the captured event and original stimulus result.
      Parameters:
      consumer - must not be null.