org.eclipse.ease.lang.unittest

## Class DefaultAssertion

- java.lang.Object
- - org.eclipse.ease.lang.unittest.DefaultAssertion

All Implemented Interfaces:
  IAssertion

    public class DefaultAssertion
    extends java.lang.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 and Description
`DefaultAssertion(boolean valid, java.lang.String errorDescription)`
`DefaultAssertion(java.util.List<IScriptDebugFrame> stackTrace, boolean valid, java.lang.String errorDescription)`
`DefaultAssertion(java.lang.String errorDescription)` Default constructor for invalid assertions.

### Method Summary

All Methods Instance Methods Concrete Methods
`java.util.List<IScriptDebugFrame>` `getStackTrace()` Get a stacktrace of the location that raised the assertion.
`boolean` `isValid()` Return `true` when assertion is valid.
`void` `throwOnError()` Throw exception in case `IAssertion.isValid()` is `false`.
`java.lang.String` `toString()`

### Methods inherited from class java.lang.Object

`equals, getClass, hashCode, notify, notifyAll, wait, wait, wait`

### Constructor Detail

#### DefaultAssertion

    public DefaultAssertion(java.util.List<IScriptDebugFrame> stackTrace,
                            boolean valid,
                            java.lang.String errorDescription)

#### DefaultAssertion

    public DefaultAssertion(boolean valid,
                            java.lang.String errorDescription)

#### DefaultAssertion

    public DefaultAssertion(java.lang.String errorDescription)

Default constructor for invalid assertions.

Parameters:
  `errorDescription` - cause of error

### Method Detail

#### isValid

    public boolean isValid()

Description copied from interface: `IAssertion`
Return `true` when assertion is valid.

Specified by:
  `isValid` in interface `IAssertion`
Returns:
  `true` on valid assertion

#### getStackTrace

    public java.util.List<IScriptDebugFrame> getStackTrace()

Get a stacktrace of the location that raised the assertion.

Returns:
  stacktrace or `null`

#### toString

    public java.lang.String toString()

Overrides:
  `toString` in class `java.lang.Object`

#### throwOnError

    public void throwOnError()
                      throws AssertionException

Description copied from interface: `IAssertion`
Throw exception in case `IAssertion.isValid()` is `false`.

Specified by:
  `throwOnError` in interface `IAssertion`
Throws:
  `AssertionException` - when `IAssertion.isValid()` is `false`