Package at.jku.ssw.fp.sect11_3.check4j
Class Result<A>
- java.lang.Object
-
- at.jku.ssw.fp.sect11_3.check4j.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
-
-
Constructor Summary
Constructors Constructor Description Result()
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description void
addSuccess(A a)
Adds a value to the list of successful test values.static <A> Result<A>
create()
Creates an empty result object.boolean
failed()
Tests if there is failed test.void
failWith(A a)
Sets the failed test value.Optional<A>
getFailure()
Gets the failed test value in an optional; maybe empty.List<A>
getSuccesses()
Gets the list of successful test values.String
output()
Returns an output string.boolean
successful()
Tests if the results are all successful.String
toString()
Returns a string representation.
-
-
-
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.
-
output
public String output()
Returns an output string.- Returns:
- the output string
-
-