Class Result<A>

  • Type Parameters:
    A - the type of test values

    public class Result<A>
    extends Object
    Test result with the list of successful test values and an optional failed value.
    Author:
    Herbert Praehofer
    • Field Detail

      • successes

        private List<A> successes
        List of successful test values
      • failure

        private Optional<A> failure
        The optional failed test value
    • Constructor Detail

      • Result

        public Result()
    • Method Detail

      • create

        public static <A> Result<A> create()
        Creates an empty result object.
        Type Parameters:
        A - the type of the test values
        Returns:
        an empty result object
      • successful

        public boolean successful()
        Tests if the results are all successful.
        Returns:
        true if all tests were successful
      • failed

        public boolean failed()
        Tests if there is failed test.
        Returns:
        true if a test failed
      • getSuccesses

        public List<A> getSuccesses()
        Gets the list of successful test values.
        Returns:
        the list of successful test values
      • getFailure

        public Optional<A> getFailure()
        Gets the failed test value in an optional; maybe empty.
        Returns:
        the optional with a failed value or empty
      • addSuccess

        public void addSuccess​(A a)
        Adds a value to the list of successful test values.
        Parameters:
        a - the successful test value
      • failWith

        public void failWith​(A a)
        Sets the failed test value.
        Parameters:
        a - the failing test value
      • toString

        public String toString()
        Returns a string representation.
        Overrides:
        toString in class Object
        Returns:
        the string representation of the result
      • output

        public String output()
        Returns an output string.
        Returns:
        the output string