public class ConstructorStatement extends EntityWithParametersStatement
AbstractStatement.Executerannotations, parameterAnnotations, parametersassertions, comment, logger, retval, tc| Modifier | Constructor and Description |
|---|---|
|
ConstructorStatement(TestCase tc,
GenericConstructor constructor,
List<VariableReference> parameters)
Constructor for ConstructorStatement.
|
|
ConstructorStatement(TestCase tc,
GenericConstructor constructor,
VariableReference retvar,
List<VariableReference> parameters)
This constructor allows you to use an already existing VariableReference
as retvar.
|
protected |
ConstructorStatement(TestCase tc,
GenericConstructor constructor,
VariableReference retvar,
List<VariableReference> parameters,
boolean check)
Constructor for ConstructorStatement.
|
| 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.
|
GenericConstructor |
getAccessibleObject()
Returns the accessibleObject which is used to generate this kind of
statement E.g.
|
GenericConstructor |
getConstructor()
Getter for the field
constructor. |
Set<Class<?>> |
getDeclaredExceptions()
getDeclaredExceptions
|
String |
getDeclaringClassName() |
String |
getDescriptor() |
String |
getMethodName() |
int |
getNumParameters()
Retrieve the number of parameters of this statement
|
List<VariableReference> |
getParameterReferences()
getParameterReferences
|
static String |
getReturnType(Class<?> clazz)
getReturnType
|
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 |
isValid()
Various consistency checks.
|
boolean |
mutate(TestCase test,
TestFactory factory)
Go through parameters of constructor call and apply local search
|
boolean |
same(Statement s)
Allows the comparing of Statements between TestCases.
|
void |
setConstructor(GenericConstructor constructor)
Setter for the field
constructor. |
String |
toString() |
getConstraints, getNumParametersOfType, getUniqueVariableReferences, getVariableReferences, isBounded, mutateParameter, replace, replaceParameterReferenceaddAssertion, addComment, clone, clone, copyAssertions, exceptionHandler, getAssertionCode, getAssertionReferences, getAssertions, getCode, getCode, getComment, getExceptionClass, getPosition, getReturnClass, getReturnType, getReturnValue, getTestCase, hasAssertions, isDeclaredException, isReflectionStatement, negate, references, removeAssertion, removeAssertions, setAssertions, setRetvalpublic ConstructorStatement(TestCase tc, GenericConstructor constructor, List<VariableReference> parameters)
Constructor for ConstructorStatement.
tc - a TestCase object.constructor - a Constructor object.parameters - a List object.public ConstructorStatement(TestCase tc, GenericConstructor constructor, VariableReference retvar, List<VariableReference> parameters)
tc - a TestCase object.constructor - a Constructor object.retvar - a VariableReference object.parameters - a List object.protected ConstructorStatement(TestCase tc, GenericConstructor constructor, VariableReference retvar, List<VariableReference> parameters, boolean check)
Constructor for ConstructorStatement.
tc - a TestCase object.constructor - a Constructor object.retvar - a VariableReference object.parameters - a List object.check - a boolean.public GenericConstructor getConstructor()
Getter for the field constructor.
Constructor object.public void setConstructor(GenericConstructor constructor)
Setter for the field constructor.
constructor - a Constructor object.public Throwable execute(Scope scope, PrintStream out) throws InvocationTargetException, IllegalArgumentException, InstantiationException, IllegalAccessException
scope - the scope under which the statement is executedout - a PrintStream object.InvocationTargetException - if any.IllegalArgumentException - if any.InstantiationException - if any.IllegalAccessException - if any.public Statement copy(TestCase newTestCase, int offset)
copy
newTestCase - the testcase in which this statement will be insertedoffset - a int.Statement object.public List<VariableReference> getParameterReferences()
getParameterReferences
getParameterReferences in class EntityWithParametersStatementList object.public 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 boolean mutate(TestCase test, TestFactory factory)
mutate in interface Statementmutate in class AbstractStatementtest - factory - 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 GenericConstructor 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.