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 Summary

      Constructors 
      Modifier Constructor Description
      private EventConditions()  
    • Method Summary

      All Methods Static Methods Concrete Methods 
      Modifier and Type Method Description
      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.
      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.
      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.
      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.
      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.
      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.
      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.
      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.
      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.
      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.
      static org.assertj.core.api.Condition<Event> fileEntry​(java.util.function.Predicate<org.junit.platform.engine.reporting.FileEntry> predicate)
      Create a new Condition that matches if and only if an Event's payload is an instance of FileEntry that contains a file that matches the supplied Predicate.
      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.
      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.
      private static org.assertj.core.api.Condition<Event> finishedWithCause​(org.junit.platform.engine.TestExecutionResult.Status expectedStatus, org.assertj.core.api.Condition<java.lang.Throwable>... conditions)  
      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.
      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.
      static org.assertj.core.api.Condition<Event> legacyReportingName​(java.lang.String legacyReportingName)
      Create a new Condition that matches if and only if the TestDescriptor.getLegacyReportingName() () legacy reporting name} of an Event's test descriptor is equal to the supplied String.
      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.
      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.
      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.
      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.
      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.
      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.
      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.
      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.
      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.
      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.
      static org.assertj.core.api.Condition<Event> test​(java.lang.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.
      static org.assertj.core.api.Condition<Event> test​(java.lang.String uniqueIdSubstring, java.lang.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.
      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.
      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.
      static org.assertj.core.api.Condition<Event> uniqueId​(java.lang.String uniqueId)
      Create a new Condition that matches if and only if the unique id of an Event's test descriptor is equal to the UniqueId parsed from the supplied String.
      static org.assertj.core.api.Condition<Event> uniqueId​(org.assertj.core.api.Condition<? super org.junit.platform.engine.UniqueId> condition)
      Create a new Condition that matches if and only if the unique id of an Event's test descriptor matches the supplied Condition.
      static org.assertj.core.api.Condition<Event> uniqueId​(org.junit.platform.engine.UniqueId uniqueId)
      Create a new Condition that matches if and only if the unique id of an Event's test descriptor is equal to the supplied UniqueId.
      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.
      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.
      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.
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • 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.
      • 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​(java.lang.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(), uniqueIdSubstring(String)
      • 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.
      • uniqueId

        @API(status=MAINTAINED,
             since="1.13.3")
        public static org.assertj.core.api.Condition<Event> uniqueId​(java.lang.String uniqueId)
        Create a new Condition that matches if and only if the unique id of an Event's test descriptor is equal to the UniqueId parsed from the supplied String.
        Since:
        1.13
      • uniqueId

        @API(status=MAINTAINED,
             since="1.13.3")
        public static org.assertj.core.api.Condition<Event> uniqueId​(org.junit.platform.engine.UniqueId uniqueId)
        Create a new Condition that matches if and only if the unique id of an Event's test descriptor is equal to the supplied UniqueId.
        Since:
        1.13
      • 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.
      • uniqueId

        @API(status=MAINTAINED,
             since="1.13.3")
        public static org.assertj.core.api.Condition<Event> uniqueId​(org.assertj.core.api.Condition<? super org.junit.platform.engine.UniqueId> condition)
        Create a new Condition that matches if and only if the unique id of an Event's test descriptor matches the supplied Condition.
        Since:
        1.13
      • 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.
      • legacyReportingName

        @API(status=MAINTAINED,
             since="1.13.3")
        public static org.assertj.core.api.Condition<Event> legacyReportingName​(java.lang.String legacyReportingName)
        Create a new Condition that matches if and only if the TestDescriptor.getLegacyReportingName() () legacy reporting name} of an Event's test descriptor is equal to the supplied String.
        Since:
        1.13
      • 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​(org.junit.platform.engine.TestExecutionResult.Status expectedStatus,
                                                                               org.assertj.core.api.Condition<java.lang.Throwable>... 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​(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.
      • fileEntry

        @API(status=MAINTAINED,
             since="1.13.3")
        public static org.assertj.core.api.Condition<Event> fileEntry​(java.util.function.Predicate<org.junit.platform.engine.reporting.FileEntry> predicate)
        Create a new Condition that matches if and only if an Event's payload is an instance of FileEntry that contains a file that matches the supplied Predicate.
        Since:
        1.12