java.lang.Object
org.junit.platform.testkit.engine.Events
Events is a facade that provides a fluent API for working with
events.- Since:
- 1.4
-
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionaborted()Get the abortedEventscontained in thisEventsobject.private static voidassertEventsMatchExactly(List<Event> events, org.assertj.core.api.Condition<? super Event>... conditions) final voidassertEventsMatchExactly(org.assertj.core.api.Condition<? super Event>... conditions) Assert that all events contained in thisEventsobject exactly match the provided conditions.private static voidassertEventsMatchLoosely(List<Event> events, org.assertj.core.api.Condition<? super Event>... conditions) final voidassertEventsMatchLoosely(org.assertj.core.api.Condition<? super Event>... conditions) Assert that all provided conditions are matched by an event contained in thisEventsobject, regardless of order.private static voidassertEventsMatchLooselyInOrder(List<Event> events, org.assertj.core.api.Condition<? super Event>... conditions) final voidassertEventsMatchLooselyInOrder(org.assertj.core.api.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.org.assertj.core.api.ListAssert<Event> Shortcut fororg.assertj.core.api.Assertions.assertThat(events.list()).private static voidcheckCondition(List<Event> events, org.assertj.core.api.SoftAssertions softly, org.assertj.core.api.Condition<? super Event> condition) longcount()Get the number of events contained in thisEventsobject.debug()Print all events toSystem.out.debug(OutputStream out) Print all events to the suppliedOutputStream.private Eventsdebug(PrintWriter printWriter) Print all events to the suppliedWriter.Get the dynamic registrationEventscontained in thisEventsobject.eventsByType(EventType type) Get theExecutionsfor the current set of events.failed()Get the failedEventscontained in thisEventsobject.Shortcut forevents.stream().filter(predicate).private static EventfindEvent(List<Event> events, org.assertj.core.api.SoftAssertions softly, org.assertj.core.api.Condition<? super Event> condition) finished()Get the finishedEventscontained in thisEventsobject.(package private) Stringprivate static booleanisNotInIncreasingOrder(List<Integer> indices) 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.
-
Field Details
-
events
-
category
-
-
Constructor Details
-
Events
-
Events
-
-
Method Details
-
getCategory
String getCategory() -
list
- Returns:
- the list of events; never
null - See Also:
-
stream
- Returns:
- the stream of events; never
null - See Also:
-
map
Shortcut forevents.stream().map(mapper).- Parameters:
mapper- aFunctionto apply to each event; nevernull- Returns:
- the mapped stream of events; never
null - See Also:
-
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
Get the skippedEventscontained in thisEventsobject.- Returns:
- the filtered
Events; nevernull
-
started
Get the startedEventscontained in thisEventsobject.- Returns:
- the filtered
Events; nevernull
-
finished
Get the finishedEventscontained in thisEventsobject.- Returns:
- the filtered
Events; nevernull
-
aborted
Get the abortedEventscontained in thisEventsobject.- Returns:
- the filtered
Events; nevernull
-
succeeded
Get the succeededEventscontained in thisEventsobject.- Returns:
- the filtered
Events; nevernull
-
failed
Get the failedEventscontained in thisEventsobject.- Returns:
- the filtered
Events; nevernull
-
reportingEntryPublished
Get the reporting entry publicationEventscontained in thisEventsobject.- Returns:
- the filtered
Events; nevernull
-
dynamicallyRegistered
Get the dynamic registrationEventscontained in thisEventsobject.- Returns:
- the filtered
Events; nevernull
-
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
@SafeVarargs public final void assertEventsMatchExactly(org.assertj.core.api.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.testEvents().assertEventsMatchExactly( event(test("exampleTestMethod"), started()), event(test("exampleTestMethod"), finishedSuccessfully()) );- Parameters:
conditions- the conditions to match against; nevernull- See Also:
-
assertEventsMatchLoosely
@SafeVarargs public final void assertEventsMatchLoosely(org.assertj.core.api.Condition<? super Event>... conditions) 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(org.assertj.core.api.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
Print all events to the suppliedWriter.- Parameters:
writer- theWriterto print to; nevernull- Returns:
- this
Eventsobject for method chaining; nevernull
-
debug
-
eventsByType
-
finishedEventsByStatus
-
assertEventsMatchExactly
@SafeVarargs private static void assertEventsMatchExactly(List<Event> events, org.assertj.core.api.Condition<? super Event>... conditions) -
assertEventsMatchLoosely
@SafeVarargs private static void assertEventsMatchLoosely(List<Event> events, org.assertj.core.api.Condition<? super Event>... conditions) -
assertEventsMatchLooselyInOrder
@SafeVarargs private static void assertEventsMatchLooselyInOrder(List<Event> events, org.assertj.core.api.Condition<? super Event>... conditions) -
isNotInIncreasingOrder
-
checkCondition
-
findEvent
-