public class ProjectGraph extends Object
Class representing the class graph. For each class (CUT and non-testable), not only we want to know its hierarchy (parents, interfaces, subclasses, etc) but also where in the project it is used by other classes as input.
For definition of CUT, see ProjectStaticData
| Constructor and Description |
|---|
ProjectGraph(ProjectStaticData data)
Main constructor
|
| Modifier and Type | Method and Description |
|---|---|
Set<String> |
getAllCUTsParents(String aClass)
Return all the CUT classes that this
aClass extends/implements
(ie, parent hierarchy). |
Set<String> |
getAllCUTsSubclasses(String aClass)
Return all the child hierarchy of the
aClass. |
Set<String> |
getCUTsDirectlyUsedAsInput(String cut,
boolean includeSubclasses)
Return the full qualifying names of all classes that are CUTs and that
are used as input in any of the public methods of
cut (but
not of any of its parent hierarchy). |
Set<String> |
getCUTsThatUseThisCUTasInput(String cut,
boolean includeSuperClasses)
Calculate all the CUTs that use the given
cut as input in
any of their public methods |
boolean |
isAbstract(String className)
Is the given class name representing an abstract class in the SUT?
|
boolean |
isConcrete(String className)
Is the given class name representing a concrete class in the SUT?
|
boolean |
isInterface(String className)
Is the given class name representing an interface in the SUT?
|
protected Set<String> |
recursionToSearchDirectInputs(String aClass,
boolean includeSubclasses) |
protected Set<String> |
recursionToSearchWhatUsesItAsInput(String aClass,
boolean includeSuperClasses) |
public ProjectGraph(ProjectStaticData data)
data - public Set<String> getCUTsDirectlyUsedAsInput(String cut, boolean includeSubclasses) throws IllegalArgumentException
Return the full qualifying names of all classes that are CUTs and that
are used as input in any of the public methods of cut (but
not of any of its parent hierarchy).
If a method takes as input a reference of a non-SUT class (e.g.,
java.lang.Object), but then there is a cast to a CUT (e.g. a
class X), then X will be added in the returned set.
If a method takes as input a reference of a SUT class X that is not a CUT
(e.g., an interface with no code), then X will not be added in the
returned set, although based on includeSubclasses we might
add its subclasses.
cut - the class under test (CUT)includeSubclasses - If a class X is in the returned set, then normally no subclass
Y of X would be added in the returned set, unless Y is
directly used in the CUT as input.IllegalArgumentException - if the input cut is not a CUTprotected Set<String> recursionToSearchDirectInputs(String aClass, boolean includeSubclasses)
public Set<String> getCUTsThatUseThisCUTasInput(String cut, boolean includeSuperClasses) throws IllegalArgumentException
cut as input in
any of their public methodscut - the class under test (CUT)includeSuperClasses - not only using as input the
cut, but also any of its CUT ancestors/interfaces
IllegalArgumentException - if the input cut is not a CUTprotected Set<String> recursionToSearchWhatUsesItAsInput(String aClass, boolean includeSuperClasses)
public boolean isInterface(String className) throws IllegalArgumentException
className - IllegalArgumentExceptionpublic boolean isConcrete(String className) throws IllegalArgumentException
className - IllegalArgumentExceptionpublic boolean isAbstract(String className) throws IllegalArgumentException
className - IllegalArgumentExceptionpublic Set<String> getAllCUTsSubclasses(String aClass) throws IllegalArgumentException
aClass. Include only classes
that are CUTs.
This aClass will not be part of the returned set, even if it is a CUTaClass - a class belonging to the SUT, but not necessarily a CUTIllegalArgumentException - if the input aClass does not belong to the SUTpublic Set<String> getAllCUTsParents(String aClass) throws IllegalArgumentException
aClass extends/implements
(ie, parent hierarchy).
This aClass will not be part of the returned set, even if it is a CUTaClass - a class belonging to the SUT, but not necessarily a CUTIllegalArgumentException - if the input aClass does not belong to the SUTCopyright © 2010–2016 EvoSuite. All rights reserved.