public class FieldStatement extends AbstractStatement
AbstractStatement.Executer| Modifier and Type | Field and Description |
|---|---|
protected GenericField |
field |
protected VariableReference |
source |
assertions, comment, logger, retval, tc| Constructor and Description |
|---|
FieldStatement(TestCase tc,
GenericField field,
VariableReference source)
Constructor for FieldStatement.
|
FieldStatement(TestCase tc,
GenericField field,
VariableReference source,
VariableReference ret_var)
This constructor allows you to use an already existing VariableReference
as retvar.
|
| 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
|
boolean |
equals(Object s)
Equality check
|
Throwable |
execute(Scope scope,
PrintStream out)
This method executes the statement under the given scope.
|
GenericField |
getAccessibleObject()
Returns the accessibleObject which is used to generate this kind of
statement E.g.
|
GenericField |
getField()
Getter for the field
field. |
int |
getNumParameters()
Retrieve the number of parameters of this statement
|
VariableReference |
getSource()
Getter for the field
source. |
List<VariableReference> |
getUniqueVariableReferences()
getUniqueVariableReferences
|
Set<VariableReference> |
getVariableReferences()
getVariableReferences
|
int |
hashCode()
Generate hash code
|
boolean |
isAccessible()
Determine if the underlying reflection object is currently accessible
|
boolean |
isAssignmentStatement()
Returns true if this statement should be handled as an
AssignmentStatement.
|
boolean |
isStatic()
isStatic
|
boolean |
mutate(TestCase test,
TestFactory factory)
Try to replace source of field with all possible choices
|
void |
replace(VariableReference var1,
VariableReference var2)
Replace a VariableReference with another one
|
boolean |
same(Statement s)
Allows the comparing of Statements between TestCases.
|
void |
setField(GenericField field)
Setter for the field
field. |
void |
setSource(VariableReference source)
Setter for the field
source. |
addAssertion, addComment, clone, clone, copyAssertions, exceptionHandler, getAssertionCode, getAssertionReferences, getAssertions, getCode, getCode, getComment, getDeclaredExceptions, getExceptionClass, getPosition, getReturnClass, getReturnType, getReturnValue, getTestCase, hasAssertions, isDeclaredException, isReflectionStatement, isValid, negate, references, removeAssertion, removeAssertions, setAssertions, setRetvalprotected GenericField field
protected VariableReference source
public FieldStatement(TestCase tc, GenericField field, VariableReference source)
Constructor for FieldStatement.
tc - a TestCase object.field - a Field object.source - a VariableReference object.type - a Type object.public FieldStatement(TestCase tc, GenericField field, VariableReference source, VariableReference ret_var)
tc - a TestCase object.field - a Field object.source - a VariableReference object.ret_var - a VariableReference object.public VariableReference getSource()
Getter for the field source.
VariableReference object.public boolean mutate(TestCase test, TestFactory factory)
mutate in interface Statementmutate in class AbstractStatementtest - statement - objective - public void setSource(VariableReference source)
Setter for the field source.
source - a VariableReference object.public boolean isAccessible()
StatementisAccessible in interface StatementisAccessible in class AbstractStatementpublic boolean isStatic()
isStatic
public int getNumParameters()
StatementgetNumParameters in interface StatementgetNumParameters in class AbstractStatementpublic 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 GenericField getField()
Getter for the field field.
Field object.public void setField(GenericField field)
Setter for the field field.
field - a Field object.public List<VariableReference> getUniqueVariableReferences()
getUniqueVariableReferences
List object.public boolean same(Statement s)
s - a Statement object.public GenericField 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.