public class MethodStatement extends EntityWithParametersStatement
AbstractStatement.Executer| Modifier and Type | Field and Description |
|---|---|
protected VariableReference |
callee |
protected GenericMethod |
method |
annotations, parameterAnnotations, parametersassertions, comment, logger, retval, tc| Constructor and Description |
|---|
MethodStatement(TestCase tc,
GenericMethod method,
VariableReference callee,
List<VariableReference> parameters)
Constructor for MethodStatement.
|
MethodStatement(TestCase tc,
GenericMethod method,
VariableReference callee,
List<VariableReference> parameters,
VariableReference retVal) |
MethodStatement(TestCase tc,
GenericMethod method,
VariableReference callee,
VariableReference retvar,
List<VariableReference> parameters)
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.
|
GenericMethod |
getAccessibleObject()
Returns the accessibleObject which is used to generate this kind of
statement E.g.
|
VariableReference |
getCallee()
Getter for the field
callee. |
Set<Class<?>> |
getDeclaredExceptions()
getDeclaredExceptions
|
String |
getDeclaringClassName() |
String |
getDescriptor() |
GenericMethod |
getMethod()
Getter for the field
method. |
String |
getMethodName() |
int |
getNumParameters()
Retrieve the number of parameters of this statement
|
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 |
isDeclaredException(Throwable t)
Tests if the throwable defined by t is declared to be thrown by the
underlying type.
|
boolean |
isStatic()
isStatic
|
boolean |
isValid()
Various consistency checks.
|
boolean |
mutate(TestCase test,
TestFactory factory)
Go through parameters of method call and apply local search
|
void |
replace(VariableReference var1,
VariableReference var2)
Replace a VariableReference with another one
|
boolean |
same(Statement s)
Allows the comparing of Statements between TestCases.
|
void |
setCallee(VariableReference callee)
Setter for the field
callee. |
void |
setMethod(GenericMethod method)
Setter for the field
method. |
String |
toString() |
getConstraints, getNumParametersOfType, getParameterReferences, isBounded, mutateParameter, replaceParameterReferenceaddAssertion, addComment, clone, clone, copyAssertions, exceptionHandler, getAssertionCode, getAssertionReferences, getAssertions, getCode, getCode, getComment, getExceptionClass, getPosition, getReturnClass, getReturnType, getReturnValue, getTestCase, hasAssertions, isReflectionStatement, negate, references, removeAssertion, removeAssertions, setAssertions, setRetvalprotected GenericMethod method
protected VariableReference callee
public MethodStatement(TestCase tc, GenericMethod method, VariableReference callee, List<VariableReference> parameters) throws IllegalArgumentException
Constructor for MethodStatement.
tc - a TestCase object.method - a Method object.callee - a VariableReference object.parameters - a List object.IllegalArgumentExceptionpublic MethodStatement(TestCase tc, GenericMethod method, VariableReference callee, List<VariableReference> parameters, VariableReference retVal) throws IllegalArgumentException
IllegalArgumentExceptionpublic MethodStatement(TestCase tc, GenericMethod method, VariableReference callee, VariableReference retvar, List<VariableReference> parameters)
tc - a TestCase object.method - a Method object.callee - a VariableReference object.retvar - a VariableReference object.parameters - a List object.public GenericMethod getMethod()
Getter for the field method.
Method object.public void setMethod(GenericMethod method)
Setter for the field method.
method - a Method object.public VariableReference getCallee()
Getter for the field callee.
VariableReference object.public void setCallee(VariableReference callee)
Setter for the field callee.
callee - a VariableReference object.public boolean isStatic()
isStatic
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 boolean isDeclaredException(Throwable t)
isDeclaredException in interface StatementisDeclaredException in class AbstractStatementt - a Throwable object.public Statement copy(TestCase newTestCase, int offset)
copy
newTestCase - the testcase in which this statement will be insertedoffset - a int.Statement object.public Set<VariableReference> getVariableReferences()
getVariableReferences
getVariableReferences in interface StatementgetVariableReferences in class EntityWithParametersStatementSet object.public void replace(VariableReference var1, VariableReference var2)
replace in interface Statementreplace in class EntityWithParametersStatementvar1 - The old variablevar2 - The new variablepublic int getNumParameters()
StatementgetNumParameters in interface StatementgetNumParameters in class EntityWithParametersStatementpublic boolean equals(Object s)
public int hashCode()
public Set<Class<?>> getDeclaredExceptions()
getDeclaredExceptions
getDeclaredExceptions in interface StatementgetDeclaredExceptions in class AbstractStatementSet object.public List<VariableReference> getUniqueVariableReferences()
getUniqueVariableReferences
getUniqueVariableReferences in interface StatementgetUniqueVariableReferences in class EntityWithParametersStatementList object.public boolean isAccessible()
StatementisAccessible in interface StatementisAccessible in class AbstractStatementpublic boolean isValid()
isValid in interface StatementisValid in class AbstractStatementpublic boolean same(Statement s)
s - a Statement object.public boolean mutate(TestCase test, TestFactory factory)
mutate in interface Statementmutate in class AbstractStatementtest - factory - public GenericMethod getAccessibleObject()
AccessibleObject object.public boolean isAssignmentStatement()
public void changeClassLoader(ClassLoader loader)
changeClassLoader in interface StatementchangeClassLoader in class AbstractStatementloader - a ClassLoader object.public String getDescriptor()
getDescriptor in class EntityWithParametersStatementpublic String getDeclaringClassName()
getDeclaringClassName in class EntityWithParametersStatementpublic String getMethodName()
getMethodName in class EntityWithParametersStatementCopyright © 2010–2017 EvoSuite. All rights reserved.