Top Description Constructors Methods
org.junit.platform.testkit.engine

public final Class EventConditions

extends Object
Class Inheritance
Annotations
@API
status:MAINTAINED
since:1.7
Static Imports
java.util.function.Predicate.isEqual, org.apiguardian.api.API.Status.EXPERIMENTAL, .API.Status.MAINTAINED, .API.Status.STABLE, org.assertj.core.api.Assertions.allOf, org.junit.platform.commons.util.FunctionUtils.where, org.junit.platform.engine.TestExecutionResult.Status.ABORTED, .TestExecutionResult.Status.FAILED, .TestExecutionResult.Status.SUCCESSFUL, org.junit.platform.testkit.engine.Event.byPayload, .Event.byTestDescriptor, .Event.byType, .EventType.DYNAMIC_TEST_REGISTERED, .EventType.FINISHED, .EventType.SKIPPED, .EventType.STARTED

Collection of AssertJ conditions for Event.
Since
1.4
See Also
TestExecutionResultConditions

Constructor Summary

AccessConstructor and Description
private

Method Summary

Modifier and TypeMethod and Description
public static Condition<Event>
abortedWithReason(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.

public static 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.

public static 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.

public static Condition<Event>
container(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.

public static Condition<Event>
container()

Create a new Condition that matches if and only if an Event's test descriptor is a container.

public static 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.

public static 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.

public static Condition<Event>
dynamicTestRegistered(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.

public static Condition<Event>
engine()

Create a new Condition that matches if and only if an Event's test descriptor is an instance of EngineDescriptor.

public static Condition<Event>
event(Condition<? super Event>... conditions)

Create a new Condition that matches if and only if an Event matches all the supplied conditions.

public static Condition<Event>
fileEntry(Predicate<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.

public static Condition<Event>
finished(Condition<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.

public static 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 Condition<Event>
public static Condition<Event>
finishedWithFailure(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.

public static 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.

public static Condition<Event>
legacyReportingName(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.

public static Condition<Event>
nestedContainer(Class<?> clazz, 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.

public static 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.

public static 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.

public static 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.

public static 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.

public static Condition<Event>
result(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.

public static 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.

public static 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.

public static Condition<Event>
started()

Create a new Condition that matches if and only if an Event's type is EventType#STARTED.

public static 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.

public static 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.

public static Condition<Event>
test(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.

public static Condition<Event>
test()

Create a new Condition that matches if and only if an Event's test descriptor is a test.

public static 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.

public static Condition<Event>
uniqueId(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.

public static Condition<Event>
uniqueId(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.

public static Condition<Event>
uniqueId(Condition<? super 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.

public static 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.

public static 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.

public static 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.

Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Constructor Detail

EventConditionsback to summary
private EventConditions()

Method Detail

abortedWithReasonback to summary
public static Condition<Event> abortedWithReason(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.

Annotations
@SafeVarargs
containerback to summary
public static 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.

containerback to summary
public static 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.

containerback to summary
public static Condition<Event> container(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.

containerback to summary
public static Condition<Event> container()

Create a new Condition that matches if and only if an Event's test descriptor is a container.

displayNameback to summary
public static 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.

dynamicTestRegisteredback to summary
public static 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.

dynamicTestRegisteredback to summary
public static Condition<Event> dynamicTestRegistered(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.

engineback to summary
public static Condition<Event> engine()

Create a new Condition that matches if and only if an Event's test descriptor is an instance of EngineDescriptor.

eventback to summary
public static Condition<Event> event(Condition<? super Event>... conditions)

Create a new Condition that matches if and only if an Event matches all the supplied conditions.

Annotations
@SafeVarargs
@SuppressWarnings:varargs
fileEntryback to summary
public static Condition<Event> fileEntry(Predicate<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.

Annotations
@API
status:MAINTAINED
since:1.13.3
Since
1.12
finishedback to summary
public static Condition<Event> finished(Condition<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.

finishedSuccessfullyback to summary
public static 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.

finishedWithCauseback to summary
private static Condition<Event> finishedWithCause(TestExecutionResult.Status expectedStatus, Condition<Throwable>... conditions)
Annotations
@SuppressWarnings:unchecked
finishedWithFailureback to summary
public static Condition<Event> finishedWithFailure(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.

Annotations
@SafeVarargs
finishedWithFailureback to summary
public static 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.

legacyReportingNameback to summary
public static Condition<Event> legacyReportingName(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.

Annotations
@API
status:EXPERIMENTAL
since:6.0
Since
1.13
nestedContainerback to summary
public static Condition<Event> nestedContainer(Class<?> clazz, 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).

Annotations
@API
status:MAINTAINED
since:1.8
Since
1.8
See Also
nestedContainer(Class)
nestedContainerback to summary
public static 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
nestedContainer(Class, Condition)
reasonback to summary
public static 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.

reasonback to summary
public static 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.

reportEntryback to summary
public static 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.

Annotations
@API
status:STABLE
since:1.10
resultback to summary
public static Condition<Event> result(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.

skippedWithReasonback to summary
public static 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
reason(String)
skippedWithReasonback to summary
public static 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
reason(Predicate)
startedback to summary
public static Condition<Event> started()

Create a new Condition that matches if and only if an Event's type is EventType#STARTED.

testback to summary
public static 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(), uniqueIdSubstring(String)
testback to summary
public static 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(), test(Condition), uniqueIdSubstring(String), displayName(String)
testback to summary
public static Condition<Event> test(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.

Annotations
@API
status:MAINTAINED
since:1.8
Since
1.8
See Also
test(String), test(String, String), displayName(String)
testback to summary
public static Condition<Event> test()

Create a new Condition that matches if and only if an Event's test descriptor is a test.

typeback to summary
public static 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.

uniqueIdback to summary
public static Condition<Event> uniqueId(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.

Annotations
@API
status:EXPERIMENTAL
since:6.0
Since
1.13
uniqueIdback to summary
public static Condition<Event> uniqueId(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.

Annotations
@API
status:EXPERIMENTAL
since:6.0
Since
1.13
uniqueIdback to summary
public static Condition<Event> uniqueId(Condition<? super 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.

Annotations
@API
status:EXPERIMENTAL
since:6.0
Since
1.13
uniqueIdSubstringback to summary
public static 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.

uniqueIdSubstringsback to summary
public static 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
uniqueIdSubstringsback to summary
public static 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