Class Events

    • Method Detail

      • map

        public <R> Stream<R> map​(Function<? super Event,​? extends R> mapper)
        Shortcut for events.stream().map(mapper).
        Parameters:
        mapper - a Function to apply to each event; never null
        Returns:
        the mapped stream of events; never null
        See Also:
        stream(), Stream.map(Function)
      • filter

        public Stream<Event> filter​(Predicate<? super Event> predicate)
        Shortcut for events.stream().filter(predicate).
        Parameters:
        predicate - a Predicate to apply to each event to decide if it should be included in the filtered stream; never null
        Returns:
        the filtered stream of events; never null
        See Also:
        stream(), Stream.filter(Predicate)
      • executions

        public Executions executions()
        Get the Executions for the current set of events.
        Returns:
        an instance of Executions for the current set of events; never null
      • count

        public long count()
        Get the number of events contained in this Events object.
      • skipped

        public Events skipped()
        Get the skipped Events contained in this Events object.
        Returns:
        the filtered Events; never null
      • started

        public Events started()
        Get the started Events contained in this Events object.
        Returns:
        the filtered Events; never null
      • finished

        public Events finished()
        Get the finished Events contained in this Events object.
        Returns:
        the filtered Events; never null
      • aborted

        public Events aborted()
        Get the aborted Events contained in this Events object.
        Returns:
        the filtered Events; never null
      • succeeded

        public Events succeeded()
        Get the succeeded Events contained in this Events object.
        Returns:
        the filtered Events; never null
      • failed

        public Events failed()
        Get the failed Events contained in this Events object.
        Returns:
        the filtered Events; never null
      • reportingEntryPublished

        public Events reportingEntryPublished()
        Get the reporting entry publication Events contained in this Events object.
        Returns:
        the filtered Events; never null
      • dynamicallyRegistered

        public Events dynamicallyRegistered()
        Get the dynamic registration Events contained in this Events object.
        Returns:
        the filtered Events; never null
      • assertStatistics

        public Events assertStatistics​(Consumer<EventStatistics> statisticsConsumer)
        Assert statistics for the events contained in this Events object.

        Example

        events.assertStatistics(stats -> stats.started(1).succeeded(1).failed(0));

        Parameters:
        statisticsConsumer - a Consumer of EventStatistics; never null
        Returns:
        this Events object for method chaining; never null
      • assertEventsMatchExactly

        @SafeVarargs
        public final void assertEventsMatchExactly​(Condition<? super Event>... conditions)
        Assert that all events contained in this Events object exactly match the provided conditions.

        Conditions can be imported statically from EventConditions and TestExecutionResultConditions.

        Example

         executionResults.tests().assertEventsMatchExactly(
             event(test("exampleTestMethod"), started()),
             event(test("exampleTestMethod"), finishedSuccessfully())
         );
         
        Parameters:
        conditions - the conditions to match against; never null
        See Also:
        EventConditions, TestExecutionResultConditions
      • debug

        public Events debug()
        Print all events to System.out.
        Returns:
        this Events object for method chaining; never null
      • debug

        public Events debug​(OutputStream out)
        Print all events to the supplied OutputStream.
        Parameters:
        out - the OutputStream to print to; never null
        Returns:
        this Events object for method chaining; never null
      • debug

        public Events debug​(Writer writer)
        Print all events to the supplied Writer.
        Parameters:
        writer - the Writer to print to; never null
        Returns:
        this Events object for method chaining; never null