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

      @CheckReturnValue 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

      @CheckReturnValue 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

      @CheckReturnValue 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.
    • notToArrive

      public void notToArrive()
      Verifies that no event of the given specification arrives within the configured wait time (see Scenario.When.andWaitAtMost(Duration)). Note that, as the absence of an event can only be established by waiting, a successful invocation always takes the full wait time.
      Since:
      2.2
    • notToArriveAndVerify

      public void notToArriveAndVerify(Consumer<T> consumer)
      Verifies that no event of the given specification arrives within the configured wait time (see Scenario.When.andWaitAtMost(Duration)) and invokes the given consumer with the result created by the stimulus afterwards.
      Parameters:
      consumer - must not be null.
      Since:
      2.2
      See Also:
    • 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.