|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
ObjectContractCheckingVisitor
public final class ContractCheckingVisitor extends Object implements ExecutionVisitor
An execution visitor that checks unary and binary object contracts on the
values created by the sequence. It does this only after the last statement
has been executed. For each contract violation, the visitor adds an Check to
the last index in the sequence.
These checks can be added at any time; however, Randoop usually adds these
checks (vian an ExecutionVisitor as the execution unfolds, based on
observing the result of executing the statements in the sequence. For
example, a RegressionCaptureVisitor creates NotNull
checks as the sequence is executed, for those statments that return non-null
values.
If the sequence throws an exception, the visitor does not check any contracts
[[ TODO update]]. If it does not throw an exception, it checks all contracts
on each object returned by each statement, except objects that are boxed
primitives or Strings.
| Constructor and Description |
|---|
ContractCheckingVisitor(List<ObjectContract> contracts,
boolean checkAfterLast)
Create a new visitor that checks the given contracts after the last statement in a sequence is executed. |
| Modifier and Type | Method and Description |
|---|---|
void |
initialize(ExecutableSequence s)
Called before execution of a sequence, to allow the visitor to perform any initialization steps required before execution. |
void |
visitAfter(ExecutableSequence s,
int idx)
If idx is the last index, checks contracts. |
void |
visitBefore(ExecutableSequence sequence,
int i)
Invoked by ExecutableSequence.execute before the i-th statement executes. |
| Methods inherited from class Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Constructor Detail |
|---|
public ContractCheckingVisitor(List<ObjectContract> contracts,
boolean checkAfterLast)
contracts - Expected to be unary contracts, i.e. for each contract
c, c.getArity() == 1.checkAfterLast - If true, checks contracts only when the last statement
is visited. If false, checks contracts after each
statement is visited.| Method Detail |
|---|
public void initialize(ExecutableSequence s)
ExecutionVisitor
initialize in interface ExecutionVisitor
public void visitBefore(ExecutableSequence sequence,
int i)
ExecutionVisitor
visitBefore in interface ExecutionVisitor
public void visitAfter(ExecutableSequence s,
int idx)
visitAfter in interface ExecutionVisitor
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||