Interface Result<RT extends Result<RT,AT,TT,ET>,AT extends Actual,TT extends Test<TT,ET,RT,AT>,ET extends Expected>
- All Known Subinterfaces:
ResultOfCall,ResultOfExceptionalCall<T>,ResultOfFail,ResultOfObject<T>
- All Known Implementing Classes:
BasicResult,BasicResultOfCall,BasicResultOfExceptionalCall,BasicResultOfFail,BasicResultOfObject
public interface Result<RT extends Result<RT,AT,TT,ET>,AT extends Actual,TT extends Test<TT,ET,RT,AT>,ET extends Expected>
A type representing the result of a Test.
-
Nested Class Summary
Nested Classes -
Method Summary
Modifier and TypeMethodDescriptionactual()Returns the actual of this result.cause()If this result is not successful() due to an exception, this method returns the causing exception.check(Context context, PreCommentSupplier<? super RT> preCommentSupplier) If this result is not successful, this method throws anAssertionFailedErrorinforming about the failure.default ETexpected()Returns the expected behavior of this result.default booleanReturns if the test was successful.test()Returns the test this result belongs to.
-
Method Details
-
actual
AT actual()Returns the actual of this result.
If the test has failed due to an exception, the actual might be
nulland the exception trace can be retrieved usingcause().- Returns:
- the actual result of the test or
null
-
cause
Exception cause()If this result is not successful() due to an exception, this method returns the causing exception. Otherwise null is returned.
- Returns:
- the exception or null
-
check
RT check(Context context, PreCommentSupplier<? super RT> preCommentSupplier) throws org.opentest4j.AssertionFailedError If this result is not successful, this method throws an
AssertionFailedErrorinforming about the failure.- Parameters:
context- the context of the testpreCommentSupplier- the function for the pre-comment- Returns:
- this result
- Throws:
org.opentest4j.AssertionFailedError- if not successful
-
expected
Returns the expected behavior of this result.
- Returns:
- the expected behavior of this result
-
successful
default boolean successful()Returns if the test was successful.
- Returns:
- if the test was successful
-
test
TT test()Returns the test this result belongs to.
- Returns:
- the test
-