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.booleanisValid()Returntruewhen assertion is valid.voidthrowOnError()Throw exception in caseIAssertion.isValid()isfalse.StringtoString()
-
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:IAssertionReturntruewhen assertion is valid.- Specified by:
isValidin interfaceIAssertion- Returns:
trueon valid assertion
-
getStackTrace
Get a stacktrace of the location that raised the assertion.- Returns:
- stacktrace or
null
-
toString
-
throwOnError
Description copied from interface:IAssertionThrow exception in caseIAssertion.isValid()isfalse.- Specified by:
throwOnErrorin interfaceIAssertion- Throws:
AssertionException- whenIAssertion.isValid()isfalse
-