Class Executions


  • @API(status=MAINTAINED,
         since="1.7")
    public final class Executions
    extends java.lang.Object
    Executions is a facade that provides a fluent API for working with executions.
    Since:
    1.4
    • Field Detail

      • executions

        private final java.util.List<Execution> executions
      • category

        private final java.lang.String category
    • Constructor Detail

      • Executions

        private Executions​(java.util.stream.Stream<Execution> executions,
                           java.lang.String category)
      • Executions

        Executions​(java.util.List<Event> events,
                   java.lang.String category)
    • Method Detail

      • list

        public java.util.List<Execution> list()
        Get the executions as a List.
        Returns:
        the list of executions; never null
        See Also:
        stream()
      • stream

        public java.util.stream.Stream<Execution> stream()
        Get the executions as a Stream.
        Returns:
        the stream of executions; never null
        See Also:
        list()
      • map

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

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

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

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

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

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

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

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

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

        public org.assertj.core.api.ListAssert<Execution> assertThatExecutions()
        Shortcut for org.assertj.core.api.Assertions.assertThat(executions.list()).
        Returns:
        an instance of ListAssert for executions; never null
        See Also:
        Assertions.assertThat(List), ListAssert
      • debug

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

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

        public Executions debug​(java.io.Writer writer)
        Print all executions to the supplied Writer.
        Parameters:
        writer - the Writer to print to; never null
        Returns:
        this Executions object for method chaining; never null
      • debug

        private Executions debug​(java.io.PrintWriter printWriter)
      • finishedExecutions

        private java.util.stream.Stream<Execution> finishedExecutions()
      • executionsByTerminationInfo

        private java.util.stream.Stream<Execution> executionsByTerminationInfo​(java.util.function.Predicate<TerminationInfo> predicate)
      • createExecutions

        private static java.util.List<Execution> createExecutions​(java.util.List<Event> events)
        Create executions from the supplied list of events.