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:
TestExecutionResultConditions
-
Method Summary
Modifier and Type Method Description static Condition<Event>
abortedWithReason(Condition<Throwable>... conditions)
static Condition<Event>
container()
static Condition<Event>
container(Class<?> clazz)
static Condition<Event>
container(String uniqueIdSubstring)
static Condition<Event>
container(Condition<Event> condition)
Create a newCondition
that matches if and only if anEvent
matches the suppliedCondition
and its test descriptor is a container.static Condition<Event>
displayName(String displayName)
Create a newCondition
that matches if and only if the display name of anEvent
's test descriptor is equal to the suppliedString
.static Condition<Event>
dynamicTestRegistered(String uniqueIdSubstring)
static Condition<Event>
dynamicTestRegistered(Condition<Event> condition)
Create a newCondition
that matches if and only if anEvent
's type isEventType.DYNAMIC_TEST_REGISTERED
and it matches the suppliedCondition
.static Condition<Event>
engine()
Create a newCondition
that matches if and only if anEvent
's test descriptor is an instance ofEngineDescriptor
.static Condition<Event>
event(Condition<? super Event>... conditions)
static Condition<Event>
finished(Condition<TestExecutionResult> resultCondition)
Create a newCondition
that matches if and only if anEvent
's type isEventType.FINISHED
and its payload is an instance ofTestExecutionResult
that matches the suppliedCondition
.static Condition<Event>
finishedSuccessfully()
Create a newCondition
that matches if and only if anEvent
's type isEventType.FINISHED
and its result has a status ofSUCCESSFUL
.static Condition<Event>
finishedWithFailure()
static Condition<Event>
finishedWithFailure(Condition<Throwable>... conditions)
static Condition<Event>
nestedContainer(Class<?> clazz)
Create a newCondition
that matches if and only if anEvent
's test descriptor is a container and its unique id contains the simple names of the suppliedClass
and all of its enclosing classes.static Condition<Event>
nestedContainer(Class<?> clazz, Condition<Event> condition)
Create a newCondition
that matches if and only if anEvent
matches the suppliedCondition
, its test descriptor is a container, and its unique id contains the simple names of the suppliedClass
and all of its enclosing classes.static Condition<Event>
reason(String expectedReason)
static Condition<Event>
reason(Predicate<String> predicate)
static Condition<Event>
reportEntry(Map<String,String> keyValuePairs)
Create a newCondition
that matches if and only if anEvent
's payload is an instance ofReportEntry
that contains the supplied key-value pairs.static Condition<Event>
result(Condition<TestExecutionResult> condition)
Create a newCondition
that matches if and only if anEvent
's payload is an instance ofTestExecutionResult
that matches the suppliedCondition
.static Condition<Event>
skippedWithReason(String expectedReason)
static Condition<Event>
skippedWithReason(Predicate<String> predicate)
static Condition<Event>
started()
static Condition<Event>
test()
static Condition<Event>
test(String uniqueIdSubstring)
static Condition<Event>
test(String uniqueIdSubstring, String displayName)
Create a newCondition
that matches if and only if anEvent
's test descriptor is a test, its unique id contains the suppliedString
, and its display name equals the suppliedString
.static Condition<Event>
test(Condition<Event> condition)
Create a newCondition
that matches if and only if anEvent
matches the suppliedCondition
and its test descriptor is a test.static Condition<Event>
type(EventType expectedType)
static Condition<Event>
uniqueIdSubstring(String uniqueIdSubstring)
Create a newCondition
that matches if and only if the unique id of anEvent
's test descriptor contains the suppliedString
.static Condition<Event>
uniqueIdSubstrings(String... uniqueIdSubstrings)
Create a newCondition
that matches if and only if the unique id of anEvent
's test descriptor contains all of the supplied strings.static Condition<Event>
uniqueIdSubstrings(List<String> uniqueIdSubstrings)
Create a newCondition
that matches if and only if the unique id of anEvent
's test descriptor contains all of the supplied strings.
-
Method Details
-
event
-
engine
Create a newCondition
that matches if and only if anEvent
's test descriptor is an instance ofEngineDescriptor
. -
test
Create a newCondition
that matches if and only if anEvent
's test descriptor is a test and its unique id contains the suppliedString
.- See Also:
test()
,uniqueIdSubstring(String)
-
test
Create a newCondition
that matches if and only if anEvent
's test descriptor is a test, its unique id contains the suppliedString
, and its display name equals the suppliedString
. -
test
@API(status=MAINTAINED, since="1.8") public static Condition<Event> test(Condition<Event> condition)Create a newCondition
that matches if and only if anEvent
matches the suppliedCondition
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
-
container
-
container
-
container
Create a newCondition
that matches if and only if anEvent
matches the suppliedCondition
and its test descriptor is a container. -
container
-
nestedContainer
@API(status=MAINTAINED, since="1.8") public static Condition<Event> nestedContainer(Class<?> clazz, Condition<Event> condition)Create a newCondition
that matches if and only if anEvent
matches the suppliedCondition
, its test descriptor is a container, and its unique id contains the simple names of the suppliedClass
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
Create a newCondition
that matches if and only if anEvent
's test descriptor is a container and its unique id contains the simple names of the suppliedClass
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
-
dynamicTestRegistered
Create a newCondition
that matches if and only if anEvent
's type isEventType.DYNAMIC_TEST_REGISTERED
and it matches the suppliedCondition
. -
uniqueIdSubstring
Create a newCondition
that matches if and only if the unique id of anEvent
's test descriptor contains the suppliedString
. -
uniqueIdSubstrings
Create a newCondition
that matches if and only if the unique id of anEvent
's test descriptor contains all of the supplied strings.- Since:
- 1.6
-
uniqueIdSubstrings
Create a newCondition
that matches if and only if the unique id of anEvent
's test descriptor contains all of the supplied strings.- Since:
- 1.6
-
displayName
Create a newCondition
that matches if and only if the display name of anEvent
's test descriptor is equal to the suppliedString
. -
skippedWithReason
Create a newCondition
that matches if and only if anEvent
's type isEventType.SKIPPED
and the reason is equal to the suppliedString
.- See Also:
reason(String)
-
skippedWithReason
Create a newCondition
that matches if and only if anEvent
's type isEventType.SKIPPED
and the reason matches the suppliedPredicate
.- See Also:
reason(Predicate)
-
started
-
abortedWithReason
-
finishedWithFailure
@SafeVarargs public static Condition<Event> finishedWithFailure(Condition<Throwable>... conditions) -
finishedWithFailure
-
finishedSuccessfully
Create a newCondition
that matches if and only if anEvent
's type isEventType.FINISHED
and its result has a status ofSUCCESSFUL
. -
finished
Create a newCondition
that matches if and only if anEvent
's type isEventType.FINISHED
and its payload is an instance ofTestExecutionResult
that matches the suppliedCondition
. -
type
-
result
Create a newCondition
that matches if and only if anEvent
's payload is an instance ofTestExecutionResult
that matches the suppliedCondition
. -
reason
-
reason
-
reportEntry
@API(status=EXPERIMENTAL, since="1.7") public static Condition<Event> reportEntry(Map<String,String> keyValuePairs)Create a newCondition
that matches if and only if anEvent
's payload is an instance ofReportEntry
that contains the supplied key-value pairs.
-