public class ExpectedExceptionCheck extends ExceptionCheck
ExceptionCheck that enforces the expectation of an exception being thrown. In
particular,
exception, statementIndex| Constructor and Description |
|---|
ExpectedExceptionCheck(java.lang.Throwable exception,
int statementIndex,
java.lang.String catchClassName)
Creates check that enforces expectation that an exception is thrown by the statement at the
statement index.
|
| Modifier and Type | Method and Description |
|---|---|
protected void |
appendCatchBehavior(java.lang.StringBuilder b)
Appends code for catch block behavior corresponding to an expected exception.
|
protected void |
appendTryBehavior(java.lang.StringBuilder b)
Appends code to follow the statement throwing expected exception in try block.
|
private @PolyNull java.lang.String |
toAscii(@PolyNull java.lang.String str)
Converts the given string to ASCII.
|
equals, getException, getExceptionName, hashCode, toCodeStringPostStatement, toCodeStringPreStatement, toStringpublic ExpectedExceptionCheck(java.lang.Throwable exception,
int statementIndex,
java.lang.String catchClassName)
These are created before the test is classified as normal, exceptional, or invalid behavior. For example, this could be created with a TimeoutException, but the sequence would later be classified as invalid.
exception - the expected exceptionstatementIndex - the index of the statement in the sequence where exception is throwncatchClassName - the name of exception to be caughtprotected void appendTryBehavior(java.lang.StringBuilder b)
Appends a fail assertion after statement in try block.
appendTryBehavior in class ExceptionCheckb - the string builder to which code text is addedprivate @PolyNull java.lang.String toAscii(@PolyNull java.lang.String str)
str - the string to convert to ASCIIprotected void appendCatchBehavior(java.lang.StringBuilder b)
Appends assertion to confirm expected exception caught.
appendCatchBehavior in class ExceptionCheckb - the string builder to which code text is to be added