Class EventConditions


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

      • EventConditions

        private EventConditions()
    • Method Detail

      • 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.
      • 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(String), test(String, String), displayName(String)
      • 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​(java.lang.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​(java.lang.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​(java.lang.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(Class)
      • nestedContainer

        public static org.assertj.core.api.Condition<Event> nestedContainer​(java.lang.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:
        nestedContainer(Class, Condition)
      • dynamicTestRegistered

        public static org.assertj.core.api.Condition<Event> dynamicTestRegistered​(java.lang.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​(java.lang.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​(java.lang.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​(java.util.List<java.lang.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​(java.lang.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​(java.lang.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:
        reason(String)
      • skippedWithReason

        public static org.assertj.core.api.Condition<Event> skippedWithReason​(java.util.function.Predicate<java.lang.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:
        reason(Predicate)
      • 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<java.lang.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<java.lang.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.
      • finishedWithCause

        private static org.assertj.core.api.Condition<Event> finishedWithCause​(TestExecutionResult.Status expectedStatus,
                                                                               org.assertj.core.api.Condition<java.lang.Throwable>... conditions)
      • 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<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​(java.lang.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​(java.util.function.Predicate<java.lang.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​(java.util.Map<java.lang.String,​java.lang.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.