Package org.eclipse.ease.lang.unittest
Class DefaultAssertion
java.lang.Object
org.eclipse.ease.lang.unittest.DefaultAssertion
- All Implemented Interfaces:
IAssertion
public class DefaultAssertion extends Object implements IAssertion
A default implementation for
IAssertion
that adds support for error messages.-
Field Summary
Fields inherited from interface org.eclipse.ease.lang.unittest.IAssertion
INVALID, VALID
-
Constructor Summary
Constructors Constructor Description DefaultAssertion(boolean valid, String errorDescription)
DefaultAssertion(String errorDescription)
Default constructor for invalid assertions.DefaultAssertion(List<IScriptDebugFrame> stackTrace, boolean valid, String errorDescription)
-
Method Summary
Modifier and Type Method Description List<IScriptDebugFrame>
getStackTrace()
Get a stacktrace of the location that raised the assertion.boolean
isValid()
Returntrue
when assertion is valid.void
throwOnError()
Throw exception in caseIAssertion.isValid()
isfalse
.String
toString()
-
Constructor Details
-
DefaultAssertion
public DefaultAssertion(List<IScriptDebugFrame> stackTrace, boolean valid, String errorDescription) -
DefaultAssertion
-
DefaultAssertion
Default constructor for invalid assertions.- Parameters:
errorDescription
- cause of error
-
-
Method Details
-
isValid
public boolean isValid()Description copied from interface:IAssertion
Returntrue
when assertion is valid.- Specified by:
isValid
in interfaceIAssertion
- Returns:
true
on valid assertion
-
getStackTrace
Get a stacktrace of the location that raised the assertion.- Returns:
- stacktrace or
null
-
toString
-
throwOnError
Description copied from interface:IAssertion
Throw exception in caseIAssertion.isValid()
isfalse
.- Specified by:
throwOnError
in interfaceIAssertion
- Throws:
AssertionException
- whenIAssertion.isValid()
isfalse
-