Class Events
java.lang.Object
org.junit.platform.testkit.engine.Events
-
Method Summary
Modifier and TypeMethodDescriptionaborted()Get the abortedEventscontained in thisEventsobject.final voidassertEventsMatchExactly(Condition<? super Event>... conditions) Assert that all events contained in thisEventsobject exactly match the provided conditions.final voidassertEventsMatchLoosely(Condition<? super Event>... conditions) Assert that all provided conditions are matched by an event contained in thisEventsobject, regardless of order.final voidassertEventsMatchLooselyInOrder(Condition<? super Event>... conditions) Assert that all provided conditions are matched by an event contained in thisEventsobject.assertStatistics(Consumer<EventStatistics> statisticsConsumer) Assert statistics for the events contained in thisEventsobject.Shortcut fororg.assertj.core.api.Assertions.assertThat(events.list()).longcount()Get the number of events contained in thisEventsobject.debug()Print all events toSystem.out.debug(OutputStream out) Print all events to the suppliedOutputStream.Print all events to the suppliedWriter.Get the dynamic registrationEventscontained in thisEventsobject.Get theExecutionsfor the current set of events.failed()Get the failedEventscontained in thisEventsobject.Get the file entry publicationEventscontained in thisEventsobject.Shortcut forevents.stream().filter(predicate).finished()Get the finishedEventscontained in thisEventsobject.list()<R> Stream<R> Shortcut forevents.stream().map(mapper).Get the reporting entry publicationEventscontained in thisEventsobject.skipped()Get the skippedEventscontained in thisEventsobject.started()Get the startedEventscontained in thisEventsobject.stream()Get the succeededEventscontained in thisEventsobject.
-
Method Details
-
list
-
stream
-
map
-
filter
Shortcut forevents.stream().filter(predicate).- Parameters:
predicate- aPredicateto apply to each event to decide if it should be included in the filtered stream; nevernull- Returns:
- the filtered stream of events; never
null - See Also:
-
executions
Get theExecutionsfor the current set of events.- Returns:
- an instance of
Executionsfor the current set of events; nevernull
-
count
public long count()Get the number of events contained in thisEventsobject. -
skipped
-
started
-
finished
-
aborted
-
succeeded
-
failed
-
reportingEntryPublished
-
fileEntryPublished
-
dynamicallyRegistered
-
assertStatistics
Assert statistics for the events contained in thisEventsobject.Example
events.assertStatistics(stats -> stats.started(1).succeeded(1).failed(0));- Parameters:
statisticsConsumer- aConsumerofEventStatistics; nevernull- Returns:
- this
Eventsobject for method chaining; nevernull
-
assertEventsMatchExactly
Assert that all events contained in thisEventsobject exactly match the provided conditions.Conditions can be imported statically from
EventConditionsandTestExecutionResultConditions.Example
executionResults.testEvents().assertEventsMatchExactly( event(test("exampleTestMethod"), started()), event(test("exampleTestMethod"), finishedSuccessfully()) );- Parameters:
conditions- the conditions to match against; nevernull- See Also:
-
assertEventsMatchLoosely
Assert that all provided conditions are matched by an event contained in thisEventsobject, regardless of order.Note that this method performs a partial match. Thus, some events may not match any of the provided conditions.
Conditions can be imported statically from
EventConditionsandTestExecutionResultConditions.Example
executionResults.testEvents().assertEventsMatchLoosely( event(test("exampleTestMethod"), started()), event(test("exampleTestMethod"), finishedSuccessfully()) );- Parameters:
conditions- the conditions to match against; nevernull- Since:
- 1.7
- See Also:
-
assertEventsMatchLooselyInOrder
@SafeVarargs public final void assertEventsMatchLooselyInOrder(Condition<? super Event>... conditions) Assert that all provided conditions are matched by an event contained in thisEventsobject.Note that this method performs a partial match. Thus, some events may not match any of the provided conditions; however, the conditions provided must be in the correct order.
Conditions can be imported statically from
EventConditionsandTestExecutionResultConditions.Example
executionResults.testEvents().assertEventsMatchLooselyInOrder( event(test("exampleTestMethod"), started()), event(test("exampleTestMethod"), finishedSuccessfully()) );- Parameters:
conditions- the conditions to match against; nevernull- Since:
- 1.7
- See Also:
-
assertThatEvents
Shortcut fororg.assertj.core.api.Assertions.assertThat(events.list()).- Returns:
- an instance of
ListAssertfor events; nevernull - See Also:
-
debug
Print all events toSystem.out.- Returns:
- this
Eventsobject for method chaining; nevernull
-
debug
Print all events to the suppliedOutputStream.- Parameters:
out- theOutputStreamto print to; nevernull- Returns:
- this
Eventsobject for method chaining; nevernull
-
debug
-