public class TestExceptionAttribute extends AbstractInitializableAttribute implements ExceptionHandler
Yellow (hyzheng) |
Yellow (hyzheng) |
NamedObj.ContainedObjectsIterator
Modifier and Type | Field and Description |
---|---|
StringParameter |
correctExceptionMessage
The correct exception message to be compared against.
|
Parameter |
matchPrefixOfLength
If greater than zero, then check that the first n
characters of the exception message match, where n
is the value of this parameter.
|
static java.lang.String |
TRAINING_MODE_ERROR_MESSAGE
Exception message that is used if we are running under
the nightly build and the trainingMode parameter is true.
|
SharedParameter |
trainingMode
If true, then collect the exception message and set the
correctExceptionMessage parameter with the content of the
exception.
|
_changeListeners, _changeLock, _changeRequests, _debugging, _debugListeners, _deferChangeRequests, _elementName, _isPersistent, _verbose, _workspace, ATTRIBUTES, CLASSNAME, COMPLETE, CONTENTS, DEEP, FULLNAME, LINKS
Constructor and Description |
---|
TestExceptionAttribute(CompositeEntity container,
java.lang.String name)
Create a new actor in the specified container with the specified
name.
|
Modifier and Type | Method and Description |
---|---|
boolean |
handleException(NamedObj context,
java.lang.Throwable exception)
Handle an exception thrown in a test.
|
void |
initialize()
Initialize.
|
void |
wrapup()
Call the super.wrapup() method.
|
_getInitializableContainer, addInitializable, clone, hierarchyChanged, hierarchyWillChange, preinitialize, removeInitializable, setContainer
_checkContainer, _getContainedObject, _propagateExistence, getContainer, moveDown, moveToFirst, moveToIndex, moveToLast, moveUp, setName, updateContent
_addAttribute, _adjustOverride, _attachText, _cloneFixAttributeFields, _containedDecorators, _copyChangeRequestList, _debug, _debug, _debug, _debug, _debug, _description, _executeChangeRequests, _exportMoMLContents, _getIndentPrefix, _isMoMLSuppressed, _markContentsDerived, _notifyHierarchyListenersAfterChange, _notifyHierarchyListenersBeforeChange, _propagateValue, _removeAttribute, _splitName, _stripNumericSuffix, _validateSettables, addChangeListener, addDebugListener, addHierarchyListener, attributeChanged, attributeDeleted, attributeList, attributeList, attributeTypeChanged, clone, containedObjectsIterator, decorators, deepContains, depthInHierarchy, description, description, event, executeChangeRequests, exportMoML, exportMoML, exportMoML, exportMoML, exportMoML, exportMoMLPlain, getAttribute, getAttribute, getAttributes, getChangeListeners, getClassName, getDecoratorAttribute, getDecoratorAttributes, getDerivedLevel, getDerivedList, getDisplayName, getElementName, getFullName, getModelErrorHandler, getName, getName, getPrototypeList, getSource, handleModelError, isDeferringChangeRequests, isOverridden, isPersistent, lazyContainedObjectsIterator, message, notifyOfNameChange, propagateExistence, propagateValue, propagateValues, removeAttribute, removeChangeListener, removeDebugListener, removeHierarchyListener, requestChange, setClassName, setDeferringChangeRequests, setDerivedLevel, setDisplayName, setModelErrorHandler, setPersistent, setSource, sortContainedObjects, toplevel, toString, uniqueName, validateSettables, workspace
equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
description, getContainer, getDisplayName, getFullName, getName, getName, setName
public StringParameter correctExceptionMessage
public Parameter matchPrefixOfLength
public SharedParameter trainingMode
public static final java.lang.String TRAINING_MODE_ERROR_MESSAGE
public TestExceptionAttribute(CompositeEntity container, java.lang.String name) throws NameDuplicationException, IllegalActionException
container
- The container.name
- The name of this actor within the container.IllegalActionException
- If this actor cannot be contained
by the proposed container (see the setContainer() method).NameDuplicationException
- If the name coincides with
an entity already in the container.public void initialize() throws IllegalActionException
initialize
in interface Initializable
initialize
in class AbstractInitializableAttribute
IllegalActionException
- If thrown by a subclass.public boolean handleException(NamedObj context, java.lang.Throwable exception) throws IllegalActionException
handleException
in interface ExceptionHandler
context
- The object in which the error occurred.exception
- The exception to be handled.IllegalActionException
- If cannot get a valid token from
the trainingMode parameter or the exception message is not the same as
the stored message.public void wrapup() throws IllegalActionException
wrapup
in interface Initializable
wrapup
in class AbstractInitializableAttribute
IllegalActionException
- If this actor has not been
invoked to handle exceptions.