|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object org.jwalk.core.TestCase org.jwalk.core.ParamTestCase org.jwalk.core.InvokeTestCase
public class InvokeTestCase
InvokeTestCase is a kind of test case that invokes a single method. This kind of TestCase encapsulates a single Method under test. Before the Method is executed, a set of input values is synthesised as arguments for the input parameters of the method, if it has any. The Method is invoked on a target object, an instance of the test class, and the result is returned.
Field Summary |
---|
Fields inherited from class org.jwalk.core.ParamTestCase |
---|
isBinary, paramTypes, paramValues |
Fields inherited from class org.jwalk.core.TestCase |
---|
inspector, state |
Constructor Summary | |
---|---|
InvokeTestCase(java.lang.reflect.Method method)
Creates an InvokeTestCase for a Method. |
Method Summary | |
---|---|
java.lang.Object |
execute(ObjectGenerator generator,
java.lang.Object target)
Executes this InvokeTestCase, returning the invoked method's result. |
java.lang.String |
getKey(ObjectGenerator generator)
Returns a unique indexing key for this InvokeTestCase. |
java.lang.reflect.Method |
getOperation()
Returns the tested operation for this InvokeTestCase. |
java.lang.Class<?> |
getReturnType()
Returns the result type of the tested operation. |
java.lang.String |
toString(ObjectGenerator generator)
Returns a pretty-printed representation of this InvokeTestCase. |
Methods inherited from class org.jwalk.core.ParamTestCase |
---|
clone |
Methods inherited from class org.jwalk.core.TestCase |
---|
getState, setInspector |
Methods inherited from class java.lang.Object |
---|
equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public InvokeTestCase(java.lang.reflect.Method method)
method
- the Method under test.Method Detail |
---|
public java.lang.reflect.Method getOperation()
getOperation
. It is possible to access the name
of a Member using getName()
.
getOperation
in class TestCase
public java.lang.Class<?> getReturnType()
getReturnType
in class TestCase
public java.lang.Object execute(ObjectGenerator generator, java.lang.Object target) throws java.lang.reflect.InvocationTargetException, GeneratorException, ExecutionException
execute
in class ParamTestCase
generator
- the ObjectGenerator for synthesising test inputs.target
- the target object, initially null.
java.lang.reflect.InvocationTargetException
- if the tested operation raises
an exception internally. This is later handled by TestSequence, which
reports the exception as the result of the test.
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, or if it exhibited unpredictable random behaviour.public java.lang.String getKey(ObjectGenerator generator)
getKey
in class ParamTestCase
generator
- the ObjectGenerator which synthesised the parameters.
public java.lang.String toString(ObjectGenerator generator)
target.method(type_i value_i, ...);
toString
in class ParamTestCase
generator
- the ObjectGenerator which synthesised the parameters.
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |