Class EolAssertionException
- java.lang.Object
-
- java.lang.Throwable
-
- java.lang.Exception
-
- org.eclipse.epsilon.eol.exceptions.EolRuntimeException
-
- org.eclipse.epsilon.eol.exceptions.EolAssertionException
-
- All Implemented Interfaces:
Serializable
- Direct Known Subclasses:
EUnitFailedModelComparisonException
public class EolAssertionException extends EolRuntimeException
Exception which is thrown when the expectations in a test case are not met. These exceptions include information about the expected value and the value which was obtained, if available. Optionally, a custom object representing the difference between the expected and actual value can be stored.- See Also:
- Serialized Form
-
-
Field Summary
-
Fields inherited from class org.eclipse.epsilon.eol.exceptions.EolRuntimeException
ast, context, message, reason
-
-
Constructor Summary
Constructors Constructor Description EolAssertionException(String reason, ModuleElement ast, Object expected, Object actual, Object delta)
Creates a new instance.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description Object
getActual()
Returns the actual value, ornull
if not available.Object
getDelta()
Returns the precomputed difference between the expected and the actual value, ornull
if not available.Object
getExpected()
Returns the expected value, ornull
if not available.-
Methods inherited from class org.eclipse.epsilon.eol.exceptions.EolRuntimeException
findCause, getAst, getColumn, getLine, getMessage, getReason, propagate, propagateDetailed, setAst, setMessage, setReason, toString, wrap
-
Methods inherited from class java.lang.Throwable
addSuppressed, fillInStackTrace, getCause, getLocalizedMessage, getStackTrace, getSuppressed, initCause, printStackTrace, printStackTrace, printStackTrace, setStackTrace
-
-
-
-
Constructor Detail
-
EolAssertionException
public EolAssertionException(String reason, ModuleElement ast, Object expected, Object actual, Object delta)
Creates a new instance. There are three acceptable combinations for the values of
expected
,actual
anddelta
:- None are
null
: expected and actual values are available, and their difference has been precomputed. delta
isnull
: expected and actual values are available, but the difference has not been precomputed. A regular text-based line-by-line comparison will be used.- All three are
null
: no information is available. This may happen when calling thefail(msg)
built-in operation, for instance, or when using assertNotEquals (it may not make sense to present differences when they are really the same).
- Parameters:
reason
- String explaining the expectation which was not met.ast
- AST node of the call to the assertion operation whose test failed.expected
- Expected value, if applicable. Otherwise,null
.actual
- Actual value, if applicable. Otherwise,null
.delta
- Precomputed delta between the values, if available. Otherwise,null
.
- None are
-
-
Method Detail
-
getExpected
public Object getExpected()
Returns the expected value, ornull
if not available.
-
getActual
public Object getActual()
Returns the actual value, ornull
if not available.
-
getDelta
public Object getDelta()
Returns the precomputed difference between the expected and the actual value, ornull
if not available.
-
-