|
|||||||||
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.CreateTestCase
public class CreateTestCase
CreateTestCase is a kind of test case that constructs a single object. This kind of TestCase encapsulates a single Constructor under test. Before the Constructor is executed, a set of input values is synthesised as arguments for the input parameters of the Constructor, if it has any. The Constructor is invoked to create the target, an instance of the test class, which is returned as the result.
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 | |
---|---|
CreateTestCase(java.lang.reflect.Constructor<?> constructor)
Creates a CreateTestCase for a Constructor. |
Method Summary | |
---|---|
java.lang.Object |
execute(ObjectGenerator generator,
java.lang.Object target)
Executes this CreateTestCase, returning the constructor's result. |
java.lang.String |
getKey(ObjectGenerator generator)
Returns a unique indexing key for this CreateTestCase. |
java.lang.reflect.Constructor<?> |
getOperation()
Returns the tested operation for this CreateTestCase. |
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 CreateTestCase. |
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 CreateTestCase(java.lang.reflect.Constructor<?> constructor)
constructor
- the Constructor under test.Method Detail |
---|
public java.lang.reflect.Constructor<?> 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)
TestClass target = new TestClass(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 |