Class Events
- java.lang.Object
-
- org.junit.platform.testkit.engine.Events
-
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description Eventsaborted()Get the abortedEventscontained in thisEventsobject.voidassertEventsMatchExactly(Condition<? super Event>... conditions)Assert that all events contained in thisEventsobject exactly match the provided conditions.EventsassertStatistics(Consumer<EventStatistics> statisticsConsumer)Assert statistics for the events contained in thisEventsobject.ListAssert<Event>assertThatEvents()Shortcut fororg.assertj.core.api.Assertions.assertThat(events.list()).longcount()Get the number of events contained in thisEventsobject.Eventsdebug()Print all events toSystem.out.Eventsdebug(OutputStream out)Print all events to the suppliedOutputStream.Eventsdebug(Writer writer)Print all events to the suppliedWriter.EventsdynamicallyRegistered()Get the dynamic registrationEventscontained in thisEventsobject.Executionsexecutions()Get theExecutionsfor the current set of events.Eventsfailed()Get the failedEventscontained in thisEventsobject.Stream<Event>filter(Predicate<? super Event> predicate)Shortcut forevents.stream().filter(predicate).Eventsfinished()Get the finishedEventscontained in thisEventsobject.List<Event>list()<R> Stream<R>map(Function<? super Event,? extends R> mapper)Shortcut forevents.stream().map(mapper).EventsreportingEntryPublished()Get the reporting entry publicationEventscontained in thisEventsobject.Eventsskipped()Get the skippedEventscontained in thisEventsobject.Eventsstarted()Get the startedEventscontained in thisEventsobject.Stream<Event>stream()Eventssucceeded()Get the succeededEventscontained in thisEventsobject.
-
-
-
Method Detail
-
map
public <R> Stream<R> map(Function<? super Event,? extends R> mapper)
Shortcut forevents.stream().map(mapper).- Parameters:
mapper- aFunctionto apply to each event; nevernull- Returns:
- the mapped stream of events; never
null - See Also:
stream(),Stream.map(Function)
-
filter
public Stream<Event> filter(Predicate<? super Event> predicate)
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:
stream(),Stream.filter(Predicate)
-
executions
public Executions 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
public Events skipped()
Get the skippedEventscontained in thisEventsobject.- Returns:
- the filtered
Events; nevernull
-
started
public Events started()
Get the startedEventscontained in thisEventsobject.- Returns:
- the filtered
Events; nevernull
-
finished
public Events finished()
Get the finishedEventscontained in thisEventsobject.- Returns:
- the filtered
Events; nevernull
-
aborted
public Events aborted()
Get the abortedEventscontained in thisEventsobject.- Returns:
- the filtered
Events; nevernull
-
succeeded
public Events succeeded()
Get the succeededEventscontained in thisEventsobject.- Returns:
- the filtered
Events; nevernull
-
failed
public Events failed()
Get the failedEventscontained in thisEventsobject.- Returns:
- the filtered
Events; nevernull
-
reportingEntryPublished
public Events reportingEntryPublished()
Get the reporting entry publicationEventscontained in thisEventsobject.- Returns:
- the filtered
Events; nevernull
-
dynamicallyRegistered
public Events dynamicallyRegistered()
Get the dynamic registrationEventscontained in thisEventsobject.- Returns:
- the filtered
Events; nevernull
-
assertStatistics
public Events assertStatistics(Consumer<EventStatistics> statisticsConsumer)
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
@SafeVarargs public final void assertEventsMatchExactly(Condition<? super Event>... conditions)
Assert that all events contained in thisEventsobject exactly match the provided conditions.Conditions can be imported statically from
EventConditionsandTestExecutionResultConditions.Example
executionResults.tests().assertEventsMatchExactly( event(test("exampleTestMethod"), started()), event(test("exampleTestMethod"), finishedSuccessfully()) );- Parameters:
conditions- the conditions to match against; nevernull- See Also:
EventConditions,TestExecutionResultConditions
-
assertThatEvents
public ListAssert<Event> assertThatEvents()
Shortcut fororg.assertj.core.api.Assertions.assertThat(events.list()).- Returns:
- an instance of
ListAssertfor events; nevernull - See Also:
Assertions.assertThat(List),ListAssert
-
debug
public Events debug()
Print all events toSystem.out.- Returns:
- this
Eventsobject for method chaining; nevernull
-
debug
public Events debug(OutputStream out)
Print all events to the suppliedOutputStream.- Parameters:
out- theOutputStreamto print to; nevernull- Returns:
- this
Eventsobject for method chaining; nevernull
-
-