|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
ObjectPrimValue
public final class PrimValue extends Object implements ObjectContract
An check recording the value of a primitive value obtained
during execution, (e.g. var3 == 1 where var3
is an integer-valued variable in a Randoop test).
Obviously, this is not a property that must hold of all objects in a test. Randoop creates an instance of this contract when, during execution of a sequence, it determines that the above property holds. The property thus represents a regression as it captures the behavior of the code when it is executed.
| Modifier and Type | Class and Description |
|---|---|
static class |
PrimValue.PrintMode
Specifies how the contract is to be printed. |
| Modifier and Type | Field and Description |
|---|---|
PrimValue.PrintMode |
printMode
|
Object |
value
|
| Constructor and Description |
|---|
PrimValue(Object value,
PrimValue.PrintMode printMode)
|
| Modifier and Type | Method and Description |
|---|---|
boolean |
equals(Object o)
|
boolean |
evalExceptionMeansFailure()
Communicates to Randoop how to interpret exceptional behavior from the evaluate method. |
boolean |
evaluate(Object... objects)
Evaluates the contract on the given values. |
String |
get_observer_str()
Returns a string describing the observer |
int |
getArity()
The number of values that this contract is over. |
int |
hashCode()
|
String |
toCodeString()
A string that can be used as Java source code and will result in the expression being evaluated. |
String |
toCodeStringPreStatement()
|
String |
toCommentString()
A string that will be inserted as a comment in the test before the code corresponding to this contract. |
String |
toString()
|
| Methods inherited from class Object |
|---|
clone, finalize, getClass, notify, notifyAll, wait, wait, wait |
| Field Detail |
|---|
public final Object value
public final PrimValue.PrintMode printMode
| Constructor Detail |
|---|
public PrimValue(Object value,
PrimValue.PrintMode printMode)
value - The value for the expression. Must be a primitive value or string.| Method Detail |
|---|
public boolean equals(Object o)
equals in class Objectpublic int hashCode()
hashCode in class Objectpublic String toCodeStringPreStatement()
public boolean evaluate(Object... objects)
throws Throwable
ObjectContract
When calling this method during execution of a test, Randoop
guarantees that objects does not contain any
null objects, and that
objects.length == getArity().
This method should return true if the contract was
satisfied and false if it was violated.
evaluate in interface ObjectContractThrowablepublic int getArity()
ObjectContract
getArity in interface ObjectContractpublic String toString()
toString in class Objectpublic String get_observer_str()
ObjectContract
get_observer_str in interface ObjectContractpublic String toCodeString()
ObjectContractThe string should be formatted as follows: the N-th object that participates in the contract check should be referred to as "xN" (for N one of 0, ... , 9). For example, if the expression or arity 2 represents a call of the equals method between two objects, the comment should be something like "x0.equals(x1)".
The returned string should not be null.
toCodeString in interface ObjectContractpublic String toCommentString()
ObjectContract
toCommentString in interface ObjectContractpublic boolean evalExceptionMeansFailure()
ObjectContractevaluate method.
If this method returns true, Randoop will interpret
an exception that escapes during evaluation as a failure of the
contract.
If the method returns false, Randoop will interpret
an exception as passing behavior.
evalExceptionMeansFailure in interface ObjectContract
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||