Class Events
- java.lang.Object
-
- org.junit.platform.testkit.engine.Events
-
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description Events
aborted()
Get the abortedEvents
contained in thisEvents
object.void
assertEventsMatchExactly(Condition<? super Event>... conditions)
Assert that all events contained in thisEvents
object exactly match the provided conditions.Events
assertStatistics(Consumer<EventStatistics> statisticsConsumer)
Assert statistics for the events contained in thisEvents
object.ListAssert<Event>
assertThatEvents()
Shortcut fororg.assertj.core.api.Assertions.assertThat(events.list())
.long
count()
Get the number of events contained in thisEvents
object.Events
debug()
Print all events toSystem.out
.Events
debug(OutputStream out)
Print all events to the suppliedOutputStream
.Events
debug(Writer writer)
Print all events to the suppliedWriter
.Events
dynamicallyRegistered()
Get the dynamic registrationEvents
contained in thisEvents
object.Executions
executions()
Get theExecutions
for the current set of events.Events
failed()
Get the failedEvents
contained in thisEvents
object.Stream<Event>
filter(Predicate<? super Event> predicate)
Shortcut forevents.stream().filter(predicate)
.Events
finished()
Get the finishedEvents
contained in thisEvents
object.List<Event>
list()
<R> Stream<R>
map(Function<? super Event,? extends R> mapper)
Shortcut forevents.stream().map(mapper)
.Events
reportingEntryPublished()
Get the reporting entry publicationEvents
contained in thisEvents
object.Events
skipped()
Get the skippedEvents
contained in thisEvents
object.Events
started()
Get the startedEvents
contained in thisEvents
object.Stream<Event>
stream()
Events
succeeded()
Get the succeededEvents
contained in thisEvents
object.
-
-
-
Method Detail
-
map
public <R> Stream<R> map(Function<? super Event,? extends R> mapper)
Shortcut forevents.stream().map(mapper)
.- Parameters:
mapper
- aFunction
to 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
- aPredicate
to 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 theExecutions
for the current set of events.- Returns:
- an instance of
Executions
for the current set of events; nevernull
-
count
public long count()
Get the number of events contained in thisEvents
object.
-
skipped
public Events skipped()
Get the skippedEvents
contained in thisEvents
object.- Returns:
- the filtered
Events
; nevernull
-
started
public Events started()
Get the startedEvents
contained in thisEvents
object.- Returns:
- the filtered
Events
; nevernull
-
finished
public Events finished()
Get the finishedEvents
contained in thisEvents
object.- Returns:
- the filtered
Events
; nevernull
-
aborted
public Events aborted()
Get the abortedEvents
contained in thisEvents
object.- Returns:
- the filtered
Events
; nevernull
-
succeeded
public Events succeeded()
Get the succeededEvents
contained in thisEvents
object.- Returns:
- the filtered
Events
; nevernull
-
failed
public Events failed()
Get the failedEvents
contained in thisEvents
object.- Returns:
- the filtered
Events
; nevernull
-
reportingEntryPublished
public Events reportingEntryPublished()
Get the reporting entry publicationEvents
contained in thisEvents
object.- Returns:
- the filtered
Events
; nevernull
-
dynamicallyRegistered
public Events dynamicallyRegistered()
Get the dynamic registrationEvents
contained in thisEvents
object.- Returns:
- the filtered
Events
; nevernull
-
assertStatistics
public Events assertStatistics(Consumer<EventStatistics> statisticsConsumer)
Assert statistics for the events contained in thisEvents
object.Example
events.assertStatistics(stats -> stats.started(1).succeeded(1).failed(0));
- Parameters:
statisticsConsumer
- aConsumer
ofEventStatistics
; nevernull
- Returns:
- this
Events
object for method chaining; nevernull
-
assertEventsMatchExactly
@SafeVarargs public final void assertEventsMatchExactly(Condition<? super Event>... conditions)
Assert that all events contained in thisEvents
object exactly match the provided conditions.Conditions can be imported statically from
EventConditions
andTestExecutionResultConditions
.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
ListAssert
for events; nevernull
- See Also:
Assertions.assertThat(List)
,ListAssert
-
debug
public Events debug()
Print all events toSystem.out
.- Returns:
- this
Events
object for method chaining; nevernull
-
debug
public Events debug(OutputStream out)
Print all events to the suppliedOutputStream
.- Parameters:
out
- theOutputStream
to print to; nevernull
- Returns:
- this
Events
object for method chaining; nevernull
-
-