Class PublishedEventsAssert.PublishedEventAssert<T>

java.lang.Object
org.springframework.modulith.test.PublishedEventsAssert.PublishedEventAssert<T>
Enclosing class:
PublishedEventsAssert

public class PublishedEventsAssert.PublishedEventAssert<T> extends Object
Assertions further qualifying the expected events.
Author:
Oliver Drotbohm
  • Method Details

    • matching

      public PublishedEventsAssert.PublishedEventAssert<T> matching(Predicate<? super T> predicate)
      Asserts that at least one event matches the given predicate.
      Parameters:
      predicate - must not be null.
      Returns:
      will never be null.
    • matching

      public <S> PublishedEventsAssert.PublishedEventAssert<T> matching(Function<T,S> function, Predicate<? super S> predicate)
      Asserts that at least one event exists for which the value extracted by the given Function matches the given Predicate.
      Type Parameters:
      S - the type of the value to be matched.
      Parameters:
      function - the extractor function, must not be null.
      predicate - the Predicate the extracted value is supposed to match. Must not be null.
      Returns:
      will never be null.
    • matching

      public <S> PublishedEventsAssert.PublishedEventAssert<T> matching(Function<T,S> function, @Nullable S value)
      Asserts that at least one event exists for which the value extracted by the given Function matches the given one.
      Type Parameters:
      S - the type of the value to be matched
      Parameters:
      function - the extractor function, must not be null.
      value - the expected value, can be null.
      Returns:
      will never be null.
    • and

      public PublishedEventsAssert and()
      Syntactic sugar to start a new assertion on a different type of event.
      Returns:
      will never be null.