|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object org.jwalk.JWalker org.jwalk.core.ClassInspector
public class ClassInspector
ClassInspector detects the public method interface of the test class. A ClassInspector inspects a class and extracts all of the constructors and methods in its public interface. These include public methods inherited from all of its ancestors, back to the root Object class. By default, the built-in methods from Object are excluded; but they may be selectively included. The ClassInspector uses Java's reflection to extract lists of Constructor and Method objects.
Field Summary | |
---|---|
protected java.util.List<java.lang.Enum<?>> |
constants
The list of inspected constants. |
protected java.util.List<java.lang.reflect.Constructor<?>> |
constructors
The list of inspected constructors. |
protected java.util.List<java.lang.reflect.Method> |
methods
The list of inspected methods. |
protected java.lang.Class<?> |
testClass
The test class. |
Fields inherited from class org.jwalk.JWalker |
---|
channels, settings |
Constructor Summary | |
---|---|
ClassInspector(Settings settings,
Channels channels)
Creates a ClassInspector using the settings and channels. |
Method Summary | |
---|---|
boolean |
classIsAbstract()
Reports if the test class is abstract. |
boolean |
classIsEnum()
Reports if the test class is an enumerated type. |
boolean |
classIsInterface()
Reports if the test class is an interface. |
boolean |
classNotPublic()
Reports if the test class is not public. |
int |
countActiveEdges(int cycle)
Counts the number of active edges on a given test cycle. |
int |
countConstants()
Counts the number of enumerated constants. |
int |
countConstructors()
Counts the number of Constructors. |
int |
countMethods()
Counts the number of Methods. |
long |
countPermutations()
Counts the number of TestSequence permutations. |
void |
execute()
Executes this ClassInspector. |
java.util.List<java.lang.Enum<?>> |
getConstants()
Returns the enumerated constants of the test class. |
java.util.List<java.lang.reflect.Constructor<?>> |
getConstructors()
Returns the public constructors of the test class. |
java.util.List<java.lang.reflect.Method> |
getMethods()
Returns the public methods of the test class. |
java.lang.Class<?> |
getTestClass()
Returns the test class. |
void |
inspectProtocols()
Inspects the public interface of the test class by introspection. |
Methods inherited from class org.jwalk.JWalker |
---|
getChannels, getSettings, outOfMemory, run, userAborted |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
protected java.lang.Class<?> testClass
protected java.util.List<java.lang.Enum<?>> constants
protected java.util.List<java.lang.reflect.Constructor<?>> constructors
protected java.util.List<java.lang.reflect.Method> methods
Constructor Detail |
---|
public ClassInspector(Settings settings, Channels channels)
settings
- the test parameter settings to use.channels
- the callback channels to report on.Method Detail |
---|
public java.lang.Class<?> getTestClass()
getTestClass
in class JWalker
public boolean classIsInterface()
public boolean classIsAbstract()
public boolean classIsEnum()
public boolean classNotPublic()
public java.util.List<java.lang.Enum<?>> getConstants()
public java.util.List<java.lang.reflect.Constructor<?>> getConstructors()
public java.util.List<java.lang.reflect.Method> getMethods()
public int countConstants()
public int countConstructors()
public int countMethods()
public long countPermutations()
public int countActiveEdges(int cycle)
cycle
- the test cycle number, 0..n.
public void inspectProtocols() throws PermissionException
equals()
,
getClass()
, hashCode()
and
toString()
are included from Object. If the convention
is COMPLETE, all of Object's methods are included. However, if the
test class is in fact java.lang.Object
, the COMPLETE
Convention is automatically selected.
PermissionException
- if the test class refused permission to
access either its constructors or methods.public void execute() throws PermissionException, GeneratorException, ExecutionException
inspectProtocols()
to extract the public Constructor and Method interface of the test
class, according to the current settings. Descendants of
ClassInspector will also execute the test class dynamically to infer
its algebraic structure or high-level state space.
execute
in class JWalker
GeneratorException
- if any constructor or method argument value
could not be synthesised. A CustomGenerator must be provided that is
capable of synthesising values of the argument type.
ExecutionException
- if any constructor or method could not be
invoked, for reasons of visibility, security or bad arguments, or if
it is detected that a constructor or method behaves randomly.
PermissionException
- if the loaded test class, or any custom
generator, could not be instantiated, either for reasons of security,
or visibility, or because it was abstract, or an interface.
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |