public class ExpectedExceptionCheckGen
extends java.lang.Object
ExpectedExceptionCheck
object or an EmptyExceptionCheck
. Resulting tests only enforce
expected matching exceptions.Modifier and Type | Field and Description |
---|---|
private AccessibilityPredicate |
accessibility
A predicate to determine accessibility of exception classes.
|
Constructor and Description |
---|
ExpectedExceptionCheckGen(AccessibilityPredicate accessibility)
Create an object that generates expected exception checks for exceptions that satisfy the given
predicate, and empty exception checks for others.
|
Modifier and Type | Method and Description |
---|---|
static java.lang.String |
getCatchClassName(java.lang.Class<? extends java.lang.Throwable> c)
Returns the canonical name for the nearest public class that will catch an exception with the
given class.
|
static java.lang.String |
getCatchClassName(java.lang.Class<? extends java.lang.Throwable> c,
AccessibilityPredicate accessibility)
Returns the canonical name for the nearest accessible class that will catch an exception with
the given class.
|
(package private) ExceptionCheck |
getExceptionCheck(ExceptionalExecution exec,
ExecutableSequence eseq,
int statementIndex)
Constructs an
ExceptionCheck for the given exception and statement based on criteria of
this generator. |
private static java.lang.Class<?> |
nearestAccessibleSuperclass(java.lang.Class<?> c,
AccessibilityPredicate accessibility)
Returns the nearest accessible superclass -- usually the argument itself.
|
private AccessibilityPredicate accessibility
public ExpectedExceptionCheckGen(AccessibilityPredicate accessibility)
accessibility
- a predicate to determine accessibility of exception classesExceptionCheck getExceptionCheck(ExceptionalExecution exec, ExecutableSequence eseq, int statementIndex)
ExceptionCheck
for the given exception and statement based on criteria of
this generator.exec
- the exception outcome of executing the statement in a sequenceeseq
- the sequence where exception occurredstatementIndex
- the position of the statement in the sequenceExpectedExceptionCheck
object for exception and statement if exception is
checked, and an EmptyExceptionCheck
otherwiseprivate static java.lang.Class<?> nearestAccessibleSuperclass(java.lang.Class<?> c, AccessibilityPredicate accessibility)
c
- the class for which superclass is neededaccessibility
- only superclasess satisfying this predicate may be returnedpublic static java.lang.String getCatchClassName(java.lang.Class<? extends java.lang.Throwable> c, AccessibilityPredicate accessibility)
c
- the exception classaccessibility
- only superclasess satisfying this predicate may be returnedpublic static java.lang.String getCatchClassName(java.lang.Class<? extends java.lang.Throwable> c)
c
- the exception class