T - public abstract class PrimitiveStatement<T> extends AbstractStatement
AbstractStatement.Executer| Modifier and Type | Field and Description |
|---|---|
protected T |
value
The value
|
assertions, comment, logger, retval, tc| Constructor and Description |
|---|
PrimitiveStatement(TestCase tc,
GenericClass clazz,
T value) |
PrimitiveStatement(TestCase tc,
Type type,
T value)
Constructor
|
PrimitiveStatement(TestCase tc,
VariableReference varRef,
T value)
Constructor for PrimitiveStatement.
|
| Modifier and Type | Method and Description |
|---|---|
void |
changeClassLoader(ClassLoader loader)
Class instances are bound to a class loader - if we want to reexecute a
test on a different classloader we need to be able to change the class of
the reflection object
|
Statement |
copy(TestCase newTestCase,
int offset)
copy
|
abstract void |
delta()
Add a random delta to the value
|
boolean |
equals(Object s)
Equality check
|
Throwable |
execute(Scope scope,
PrintStream out)
This method executes the statement under the given scope.
|
GenericAccessibleObject<?> |
getAccessibleObject()
Returns the accessibleObject which is used to generate this kind of
statement E.g.
|
static PrimitiveStatement<?> |
getPrimitiveStatement(TestCase tc,
Class<?> clazz) |
static PrimitiveStatement<?> |
getPrimitiveStatement(TestCase tc,
GenericClass genericClass)
Generate a primitive statement for given type initialized with default
value (0)
|
static PrimitiveStatement<?> |
getRandomStatement(TestCase tc,
GenericClass clazz,
int position)
Create random primitive statement
|
List<VariableReference> |
getUniqueVariableReferences()
getUniqueVariableReferences
|
T |
getValue()
Access the value
|
Set<VariableReference> |
getVariableReferences()
getVariableReferences
|
int |
hashCode()
Generate hash code
|
boolean |
hasMoreThanOneValue() |
boolean |
isAssignmentStatement()
Returns true if this statement should be handled as an
AssignmentStatement.
|
boolean |
mutate(TestCase test,
TestFactory factory)
mutate
|
abstract void |
randomize()
Set to a random value
|
void |
replace(VariableReference var1,
VariableReference var2)
Replace a VariableReference with another one
|
boolean |
same(Statement s)
Allows the comparing of Statements between TestCases.
|
void |
setValue(T val)
Set the value
|
String |
toString() |
abstract void |
zero()
Reset value to default value 0
|
addAssertion, addComment, clone, clone, copyAssertions, exceptionHandler, getAssertionCode, getAssertionReferences, getAssertions, getCode, getCode, getComment, getDeclaredExceptions, getExceptionClass, getNumParameters, getPosition, getReturnClass, getReturnType, getReturnValue, getTestCase, hasAssertions, isAccessible, isDeclaredException, isReflectionStatement, isValid, negate, references, removeAssertion, removeAssertions, setAssertions, setRetvalprotected transient T value
public PrimitiveStatement(TestCase tc, VariableReference varRef, T value)
Constructor for PrimitiveStatement.
tc - a TestCase object.varRef - a VariableReference object.value - a T object.public PrimitiveStatement(TestCase tc, GenericClass clazz, T value)
public T getValue()
public void setValue(T val)
val - a T object.public boolean hasMoreThanOneValue()
public static PrimitiveStatement<?> getPrimitiveStatement(TestCase tc, Class<?> clazz)
public static PrimitiveStatement<?> getPrimitiveStatement(TestCase tc, GenericClass genericClass)
tc - a TestCase object.genericClass - a Type object.PrimitiveStatement object.public static PrimitiveStatement<?> getRandomStatement(TestCase tc, GenericClass clazz, int position)
tc - a TestCase object.clazz - a Type object.position - an integer.PrimitiveStatement object.public Statement copy(TestCase newTestCase, int offset)
copy
newTestCase - the testcase in which this statement will be insertedoffset - a int.Statement object.public Throwable execute(Scope scope, PrintStream out) throws InvocationTargetException, IllegalArgumentException, IllegalAccessException, InstantiationException
scope - the scope under which the statement is executedout - a PrintStream object.InvocationTargetException - if any.IllegalArgumentException - if any.IllegalAccessException - if any.InstantiationException - if any.public Set<VariableReference> getVariableReferences()
getVariableReferences
Set object.public void replace(VariableReference var1, VariableReference var2)
var1 - The old variablevar2 - The new variablepublic boolean equals(Object s)
public int hashCode()
public abstract void delta()
public abstract void zero()
public List<VariableReference> getUniqueVariableReferences()
getUniqueVariableReferences
List object.public boolean same(Statement s)
s - a Statement object.public boolean mutate(TestCase test, TestFactory factory)
mutate
mutate in interface Statementmutate in class AbstractStatementtest - a TestCase object.factory - a TestFactory object.public abstract void randomize()
public GenericAccessibleObject<?> getAccessibleObject()
AccessibleObject object.public boolean isAssignmentStatement()
public void changeClassLoader(ClassLoader loader)
changeClassLoader in interface StatementchangeClassLoader in class AbstractStatementloader - a ClassLoader object.Copyright © 2010–2017 EvoSuite. All rights reserved.