public class TestCluster extends Object
| Modifier and Type | Field and Description |
|---|---|
protected static org.slf4j.Logger |
logger |
| Modifier | Constructor and Description |
|---|---|
protected |
TestCluster() |
| Modifier and Type | Method and Description |
|---|---|
void |
addCastClassForContainer(Class<?> clazz)
Add a new class observed at runtime for container methods
|
void |
addEnvironmentTestCall(GenericAccessibleObject<?> call) |
void |
addGenerator(GenericClass target,
GenericAccessibleObject<?> call)
Add a generator reflection object
|
void |
addModifier(GenericClass target,
GenericAccessibleObject<?> call)
Add a modifier reflection object
|
void |
addTestCall(GenericAccessibleObject<?> call)
Add a test call
|
void |
clearGeneratorCache(GenericClass target)
Forget everything we have cached
|
Set<Class<?>> |
getAnalyzedClasses()
Deprecated.
|
Set<GenericAccessibleObject<?>> |
getCallsFor(GenericClass clazz,
boolean resolve)
Return all calls that have a parameter with given type
|
Class<?> |
getClass(String name)
Find a class that matches the given name
|
Set<GenericAccessibleObject<?>> |
getGenerators()
Retrieve all generators
|
Set<GenericAccessibleObject<?>> |
getGenerators(GenericClass clazz,
boolean resolve)
Get a list of all generator objects for the type
|
static InheritanceTree |
getInheritanceTree() |
static TestCluster |
getInstance()
Instance accessor
|
Collection<Class<?>> |
getKnownMatchingClasses(String name)
Retrieve all classes that match the given postfix
|
Set<GenericAccessibleObject<?>> |
getModifiers()
Retrieve all modifiers
|
int |
getNumOfEnvironmentCalls() |
int |
getNumTestCalls() |
Set<GenericAccessibleObject<?>> |
getObjectGenerators()
Determine the set of generators for an Object.class instance
|
GenericAccessibleObject<?> |
getRandomCallFor(GenericClass clazz,
TestCase test,
int position) |
GenericAccessibleObject<?> |
getRandomGenerator(GenericClass clazz)
Randomly select one generator
|
GenericAccessibleObject<?> |
getRandomGenerator(GenericClass clazz,
Set<GenericAccessibleObject<?>> excluded,
TestCase test,
int position,
VariableReference generatorRefToExclude,
int recursionDepth)
Randomly select one generator
|
List<GenericAccessibleObject<?>> |
getRandomizedCallsToEnvironment() |
GenericAccessibleObject<?> |
getRandomObjectGenerator()
Randomly select a generator for an Object.class instance
|
GenericAccessibleObject<?> |
getRandomTestCall(TestCase test)
Get random method or constructor of unit under test
|
List<GenericAccessibleObject<?>> |
getTestCalls()
Get a list of all test calls (i.e., constructors and methods)
|
void |
handleRuntimeAccesses(TestCase test) |
boolean |
hasGenerator(GenericClass clazz)
Determine if there are generators
|
boolean |
hasGenerator(Type type)
Determine if there are generators
|
Class<?> |
importClass(String name)
Integrate a new class into the test cluster
|
void |
invalidateGeneratorCache(GenericClass klass) |
static boolean |
isTargetClassName(String className) |
void |
removeTestCall(GenericAccessibleObject<?> call) |
void |
removeUnusableGenerators()
A generator for X might be a non-static method M of Y, but what if Y itself has no generator?
In that case, M should not be a generator for X, as it is impossible to instantiate Y
|
static void |
reset() |
protected static void |
setInheritanceTree(InheritanceTree inheritancetree) |
String |
toString() |
public static TestCluster getInstance()
public static void reset()
public void removeUnusableGenerators()
public void invalidateGeneratorCache(GenericClass klass)
public void handleRuntimeAccesses(TestCase test)
public static InheritanceTree getInheritanceTree()
protected static void setInheritanceTree(InheritanceTree inheritancetree)
inheritancetree - the inheritancetree to setpublic static boolean isTargetClassName(String className)
public void addGenerator(GenericClass target, GenericAccessibleObject<?> call)
target - is assumed to have wildcard typescall - public void addModifier(GenericClass target, GenericAccessibleObject<?> call)
target - is assumed to have wildcard typescall - public void addTestCall(GenericAccessibleObject<?> call) throws IllegalArgumentException
IllegalArgumentExceptionpublic void removeTestCall(GenericAccessibleObject<?> call)
public void addEnvironmentTestCall(GenericAccessibleObject<?> call) throws IllegalArgumentException
IllegalArgumentExceptionpublic void addCastClassForContainer(Class<?> clazz)
clazz - public void clearGeneratorCache(GenericClass target)
target - @Deprecated public Set<Class<?>> getAnalyzedClasses()
public Set<GenericAccessibleObject<?>> getCallsFor(GenericClass clazz, boolean resolve) throws ConstructionFailedException
clazz - resolve - ConstructionFailedExceptionpublic GenericAccessibleObject<?> getRandomCallFor(GenericClass clazz, TestCase test, int position) throws ConstructionFailedException
ConstructionFailedExceptionpublic Class<?> getClass(String name) throws ClassNotFoundException
name - ClassNotFoundExceptionpublic Set<GenericAccessibleObject<?>> getGenerators()
public Set<GenericAccessibleObject<?>> getGenerators(GenericClass clazz, boolean resolve) throws ConstructionFailedException
clazz - resolve - ConstructionFailedExceptionpublic Collection<Class<?>> getKnownMatchingClasses(String name)
name - public Set<GenericAccessibleObject<?>> getModifiers()
public Set<GenericAccessibleObject<?>> getObjectGenerators()
CastClassManager; cannot be null>.public GenericAccessibleObject<?> getRandomGenerator(GenericClass clazz) throws ConstructionFailedException
clazz - ConstructionFailedExceptionpublic GenericAccessibleObject<?> getRandomGenerator(GenericClass clazz, Set<GenericAccessibleObject<?>> excluded, TestCase test, int position, VariableReference generatorRefToExclude, int recursionDepth) throws ConstructionFailedException
clazz - excluded - test - null if there is no valid generatorConstructionFailedExceptionpublic GenericAccessibleObject<?> getRandomObjectGenerator() throws ConstructionFailedException
nullConstructionFailedExceptionpublic List<GenericAccessibleObject<?>> getRandomizedCallsToEnvironment()
public int getNumOfEnvironmentCalls()
public GenericAccessibleObject<?> getRandomTestCall(TestCase test) throws ConstructionFailedException
ConstructionFailedExceptionpublic int getNumTestCalls()
public List<GenericAccessibleObject<?>> getTestCalls()
ConstructionFailedExceptionpublic boolean hasGenerator(GenericClass clazz)
clazz - public boolean hasGenerator(Type type)
type - public Class<?> importClass(String name) throws ClassNotFoundException
name - ClassNotFoundExceptionCopyright © 2010–2017 EvoSuite. All rights reserved.