Class Scenario.When.EventResult<E>
java.lang.Object
org.springframework.modulith.test.Scenario.When.EventResult<E>
- Enclosing class:
- Scenario.When<T>
The result of an expected event publication.
- Author:
- Oliver Drotbohm
-
Constructor Summary
ConstructorsConstructorDescriptionEventResult(Class<E> type, Function<PublishedEvents.TypedPublishedEvents<E>, PublishedEvents.TypedPublishedEvents<E>> filtered, org.springframework.modulith.test.Scenario.When.ExecutionResult<?, T> previousResult) Creates a newScenario.When.EventResultfor the given type and filter. -
Method Summary
Modifier and TypeMethodDescriptionMatches events that satisfy the givenPredicate.<S> Scenario.When<T>.EventResult<E>matchingMapped(Function<E, S> extractor, Predicate<? super S> filter) <S> Scenario.When<T>.EventResult<E>matchingMappedValue(Function<E, S> extractor, S value) Matches events that extracting the given value using the givenFunction.voidtoArrive()Awaits an event of the given specification to arrive.voidtoArriveAndAssert(BiConsumer<PublishedEventsAssert.PublishedEventAssert<? super E>, T> consumer) Expects the events previously specified to arrive and additionally assert thePublishedEventsAssertfor the captured event and original stimulus result.voidtoArriveAndAssert(Consumer<PublishedEventsAssert.PublishedEventAssert<? super E>> consumer) Expects the events previously specified to arrive and additionally assert thePublishedEventsAssertfor the captured event.voidtoArriveAndVerify(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.voidtoArriveAndVerify(Consumer<E> consumer) Awaits an event of the given specification to arrive and invokes the given consumer with it.
-
Constructor Details
-
EventResult
EventResult(Class<E> type, Function<PublishedEvents.TypedPublishedEvents<E>, PublishedEvents.TypedPublishedEvents<E>> filtered, org.springframework.modulith.test.Scenario.When.ExecutionResult<?, T> previousResult) Creates a newScenario.When.EventResultfor the given type and filter.- Parameters:
type- must not be null.filtered- must not be null.previousResult- a potentially previously calculated result.
-
-
Method Details
-
matching
Matches events that satisfy the givenPredicate.- 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) - 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 givenFunction.- 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
Awaits an event of the given specification to arrive and invokes the given consumer with it.- Parameters:
consumer- must not be null.
-
toArriveAndVerify
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 thePublishedEventsAssertfor 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 thePublishedEventsAssertfor the captured event and original stimulus result.- Parameters:
consumer- must not be null.
-