Class EventConditions

java.lang.Object
org.junit.platform.testkit.engine.EventConditions

@API(status=MAINTAINED, since="1.7") public final class EventConditions extends Object
Collection of AssertJ conditions for Event.
Since:
1.4
See Also:
  • Method Details

    • event

      @SafeVarargs public static org.assertj.core.api.Condition<Event> event(org.assertj.core.api.Condition<? super Event>... conditions)
      Create a new Condition that matches if and only if an Event matches all of the supplied conditions.
    • engine

      public static org.assertj.core.api.Condition<Event> engine()
      Create a new Condition that matches if and only if an Event's test descriptor is an instance of EngineDescriptor.
    • test

      public static org.assertj.core.api.Condition<Event> test(String uniqueIdSubstring)
      Create a new Condition that matches if and only if an Event's test descriptor is a test and its unique id contains the supplied String.
      See Also:
    • test

      public static org.assertj.core.api.Condition<Event> test(String uniqueIdSubstring, String displayName)
      Create a new Condition that matches if and only if an Event's test descriptor is a test, its unique id contains the supplied String, and its display name equals the supplied String.
      See Also:
    • test

      @API(status=MAINTAINED, since="1.8") public static org.assertj.core.api.Condition<Event> test(org.assertj.core.api.Condition<Event> condition)
      Create a new Condition that matches if and only if an Event matches the supplied Condition and its test descriptor is a test.

      For example, test(displayName("my display name")) can be used to match against a test with the given display name.

      Since:
      1.8
      See Also:
    • test

      public static org.assertj.core.api.Condition<Event> test()
      Create a new Condition that matches if and only if an Event's test descriptor is a test.
    • container

      public static org.assertj.core.api.Condition<Event> container(Class<?> clazz)
      Create a new Condition that matches if and only if an Event's test descriptor is a container and its unique id contains the fully-qualified name of the supplied Class.
    • container

      public static org.assertj.core.api.Condition<Event> container(String uniqueIdSubstring)
      Create a new Condition that matches if and only if an Event's test descriptor is a container and its unique id contains the supplied String.
    • container

      public static org.assertj.core.api.Condition<Event> container(org.assertj.core.api.Condition<Event> condition)
      Create a new Condition that matches if and only if an Event matches the supplied Condition and its test descriptor is a container.
    • container

      public static org.assertj.core.api.Condition<Event> container()
      Create a new Condition that matches if and only if an Event's test descriptor is a container.
    • nestedContainer

      @API(status=MAINTAINED, since="1.8") public static org.assertj.core.api.Condition<Event> nestedContainer(Class<?> clazz, org.assertj.core.api.Condition<Event> condition)
      Create a new Condition that matches if and only if an Event matches the supplied Condition, its test descriptor is a container, and its unique id contains the simple names of the supplied Class and all of its enclosing classes.

      For example, nestedContainer(MyNestedTests.class, displayName("my display name")) can be used to match against a nested container with the given display name.

      Please note that this method does not differentiate between static nested classes and non-static member classes (e.g., inner classes).

      Since:
      1.8
      See Also:
    • nestedContainer

      public static org.assertj.core.api.Condition<Event> nestedContainer(Class<?> clazz)
      Create a new Condition that matches if and only if an Event's test descriptor is a container and its unique id contains the simple names of the supplied Class and all of its enclosing classes.

      Please note that this method does not differentiate between static nested classes and non-static member classes (e.g., inner classes).

      See Also:
    • dynamicTestRegistered

      public static org.assertj.core.api.Condition<Event> dynamicTestRegistered(String uniqueIdSubstring)
      Create a new Condition that matches if and only if an Event's type is EventType.DYNAMIC_TEST_REGISTERED and its unique id contains the supplied String.
    • dynamicTestRegistered

      public static org.assertj.core.api.Condition<Event> dynamicTestRegistered(org.assertj.core.api.Condition<Event> condition)
      Create a new Condition that matches if and only if an Event's type is EventType.DYNAMIC_TEST_REGISTERED and it matches the supplied Condition.
    • uniqueIdSubstring

      public static org.assertj.core.api.Condition<Event> uniqueIdSubstring(String uniqueIdSubstring)
      Create a new Condition that matches if and only if the unique id of an Event's test descriptor contains the supplied String.
    • uniqueIdSubstrings

      public static org.assertj.core.api.Condition<Event> uniqueIdSubstrings(String... uniqueIdSubstrings)
      Create a new Condition that matches if and only if the unique id of an Event's test descriptor contains all of the supplied strings.
      Since:
      1.6
    • uniqueIdSubstrings

      public static org.assertj.core.api.Condition<Event> uniqueIdSubstrings(List<String> uniqueIdSubstrings)
      Create a new Condition that matches if and only if the unique id of an Event's test descriptor contains all of the supplied strings.
      Since:
      1.6
    • displayName

      public static org.assertj.core.api.Condition<Event> displayName(String displayName)
      Create a new Condition that matches if and only if the display name of an Event's test descriptor is equal to the supplied String.
    • skippedWithReason

      public static org.assertj.core.api.Condition<Event> skippedWithReason(String expectedReason)
      Create a new Condition that matches if and only if an Event's type is EventType.SKIPPED and the reason is equal to the supplied String.
      See Also:
    • skippedWithReason

      public static org.assertj.core.api.Condition<Event> skippedWithReason(Predicate<String> predicate)
      Create a new Condition that matches if and only if an Event's type is EventType.SKIPPED and the reason matches the supplied Predicate.
      See Also:
    • started

      public static org.assertj.core.api.Condition<Event> started()
      Create a new Condition that matches if and only if an Event's type is EventType.STARTED.
    • abortedWithReason

      @SafeVarargs public static org.assertj.core.api.Condition<Event> abortedWithReason(org.assertj.core.api.Condition<Throwable>... conditions)
      Create a new Condition that matches if and only if an Event's type is EventType.FINISHED and its result has a status of ABORTED as well as a cause that matches all of the supplied conditions.
    • finishedWithFailure

      @SafeVarargs public static org.assertj.core.api.Condition<Event> finishedWithFailure(org.assertj.core.api.Condition<Throwable>... conditions)
      Create a new Condition that matches if and only if an Event's type is EventType.FINISHED and its result has a status of FAILED as well as a cause that matches all of the supplied Conditions.
    • finishedWithFailure

      public static org.assertj.core.api.Condition<Event> finishedWithFailure()
      Create a new Condition that matches if and only if an Event's type is EventType.FINISHED and its result has a status of FAILED.
    • finishedSuccessfully

      public static org.assertj.core.api.Condition<Event> finishedSuccessfully()
      Create a new Condition that matches if and only if an Event's type is EventType.FINISHED and its result has a status of SUCCESSFUL.
    • finished

      public static org.assertj.core.api.Condition<Event> finished(org.assertj.core.api.Condition<org.junit.platform.engine.TestExecutionResult> resultCondition)
      Create a new Condition that matches if and only if an Event's type is EventType.FINISHED and its payload is an instance of TestExecutionResult that matches the supplied Condition.
    • type

      public static org.assertj.core.api.Condition<Event> type(EventType expectedType)
      Create a new Condition that matches if and only if an Event's type is equal to the supplied EventType.
    • result

      public static org.assertj.core.api.Condition<Event> result(org.assertj.core.api.Condition<org.junit.platform.engine.TestExecutionResult> condition)
      Create a new Condition that matches if and only if an Event's payload is an instance of TestExecutionResult that matches the supplied Condition.
    • reason

      public static org.assertj.core.api.Condition<Event> reason(String expectedReason)
      Create a new Condition that matches if and only if an Event's payload is an instance of String that is equal to the supplied value.
    • reason

      public static org.assertj.core.api.Condition<Event> reason(Predicate<String> predicate)
      Create a new Condition that matches if and only if an Event's payload is an instance of String that matches the supplied Predicate.
    • reportEntry

      @API(status=STABLE, since="1.10") public static org.assertj.core.api.Condition<Event> reportEntry(Map<String,String> keyValuePairs)
      Create a new Condition that matches if and only if an Event's payload is an instance of ReportEntry that contains the supplied key-value pairs.