public abstract class AbstractMethodTestDescriptor extends AbstractFWDTestDescriptor
org.junit.platform.engine.support.hierarchical.Node.DynamicTestExecutor, org.junit.platform.engine.support.hierarchical.Node.ExecutionMode, org.junit.platform.engine.support.hierarchical.Node.Invocation<C extends org.junit.platform.engine.support.hierarchical.EngineExecutionContext>, org.junit.platform.engine.support.hierarchical.Node.SkipResult| Modifier and Type | Field and Description |
|---|---|
(package private) java.util.List<java.lang.reflect.Method> |
afterEach
Methods to execute after the main method, if any.
|
(package private) java.util.List<java.lang.reflect.Method> |
beforeEach
Methods to execute before the main method, if any.
|
(package private) java.lang.Class<?> |
clazz
The Java class to create instances of.
|
(package private) java.lang.String |
expectedException
This field, if not empty, contains the name of legacy exception
class expected to be thrown by the test.
|
(package private) java.lang.reflect.Method |
fixture
Optional fixture method
|
(package private) java.lang.reflect.Method |
method
The test method
|
(package private) CallParameter[] |
parameterList
Optional legacy method invocation parameters, used
by test methods with data providers, or
null for no parameters |
parent| Modifier | Constructor and Description |
|---|---|
protected |
AbstractMethodTestDescriptor()
Default constructor.
|
protected |
AbstractMethodTestDescriptor(AbstractClassTestDescriptor parent,
java.lang.Class<?> clazz,
java.lang.reflect.Method execute,
CallParameter[] parameterList,
java.lang.reflect.Method fixture,
java.util.List<java.lang.reflect.Method> beforeEach,
java.util.List<java.lang.reflect.Method> afterEach,
java.lang.String expectedException)
Constructor.
|
protected |
AbstractMethodTestDescriptor(org.junit.platform.engine.UniqueId id,
java.lang.String displayName,
java.lang.Class<?> clazz,
java.lang.reflect.Method execute,
CallParameter[] parameterList,
java.lang.reflect.Method fixture,
java.util.List<java.lang.reflect.Method> beforeEach,
java.util.List<java.lang.reflect.Method> afterEach,
java.lang.String expectedException)
Constructor.
|
| Modifier and Type | Method and Description |
|---|---|
void |
afterImpl()
Execute the after behavior of this node implementation.
|
void |
beforeImpl()
Execute the before behavior of this node implementation.
|
FWDEngineExecutionContext |
execute(FWDEngineExecutionContext context,
org.junit.platform.engine.support.hierarchical.Node.DynamicTestExecutor dynamicTestExecutor)
Execute the behavior of this node.
|
void |
executeImpl()
Execute the implementation behavior of this node.
|
private void |
executeTestMethod()
Execute the test method.
|
java.util.Optional<org.junit.platform.engine.TestSource> |
getSource()
Get the source of the test or container described
by this descriptor, if available.
|
protected java.lang.Object |
getTestObject()
Get test object.
|
void |
readExternal(java.io.ObjectInput in)
The object implements the readExternal method to restore its
contents by calling the methods of DataInput for primitive
types and readObject for objects, strings and arrays.
|
void |
writeExternal(java.io.ObjectOutput out)
The object implements the writeExternal method to save its contents
by calling the methods of DataOutput for its primitive values or
calling the writeObject method of ObjectOutput for objects, strings,
and arrays.
|
after, before, callLFMethodsImpl, callMethodImpl, callMethodImpl, checkInstance, cleanUp, cleanUpImpl, getTags, getTags, prepare, prepareImpl, toStringaddChild, equals, findByUniqueId, getChildren, getDisplayName, getParent, getType, getUniqueId, hashCode, print, removeChild, removeFromHierarchy, setParentclone, finalize, getClass, notify, notifyAll, wait, wait, waitaround, getExclusiveResources, getExecutionMode, nodeFinished, nodeSkipped, shouldBeSkippedjava.util.List<java.lang.reflect.Method> afterEach
java.util.List<java.lang.reflect.Method> beforeEach
java.lang.Class<?> clazz
java.lang.String expectedException
transient java.lang.reflect.Method fixture
java.lang.reflect.Method method
transient CallParameter[] parameterList
null for no parametersprotected AbstractMethodTestDescriptor()
protected AbstractMethodTestDescriptor(AbstractClassTestDescriptor parent, java.lang.Class<?> clazz, java.lang.reflect.Method execute, CallParameter[] parameterList, java.lang.reflect.Method fixture, java.util.List<java.lang.reflect.Method> beforeEach, java.util.List<java.lang.reflect.Method> afterEach, java.lang.String expectedException)
The unique ID and display name for the descriptor are calculated based on the parent descriptor ID and the method name.
parent - the parent descriptorclazz - the Java class to create instancesexecute - the method to executeparameterList - the list of method call parametersfixture - if not null, the method of the same class used as a fixture
for other test method(s)beforeEach - methods to execute before the execute methodafterEach - methods to execute after the execute methodexpectedException - if not null, the expected exception legacy class nameprotected AbstractMethodTestDescriptor(org.junit.platform.engine.UniqueId id,
java.lang.String displayName,
java.lang.Class<?> clazz,
java.lang.reflect.Method execute,
CallParameter[] parameterList,
java.lang.reflect.Method fixture,
java.util.List<java.lang.reflect.Method> beforeEach,
java.util.List<java.lang.reflect.Method> afterEach,
java.lang.String expectedException)
id - thr ID for this test descriptordisplayName - the display nameclazz - the Java class to create instancesexecute - the method to executeparameterList - TODOfixture - if not null, the method of the same class used as a fixture
for other test method(s)beforeEach - methods to execute before the execute methodafterEach - methods to execute after the execute methodexpectedException - if not null, the expected exception legacy class namepublic void afterImpl()
throws ErrorConditionException
This method will be called once after execution of this node.
afterImpl in class AbstractFWDTestDescriptorErrorConditionException - remote code may throw thispublic void beforeImpl()
throws ErrorConditionException
This method will be called once before execution of this node.
beforeImpl in class AbstractFWDTestDescriptorErrorConditionException - remote code may throw thispublic FWDEngineExecutionContext execute(FWDEngineExecutionContext context, org.junit.platform.engine.support.hierarchical.Node.DynamicTestExecutor dynamicTestExecutor) throws ErrorConditionException
Containers typically do not implement this method since the
HierarchicalTestEngine handles execution of their children.
The supplied dynamicTestExecutor may be used to submit
additional dynamic tests for immediate execution.
execute in interface org.junit.platform.engine.support.hierarchical.Node<FWDEngineExecutionContext>execute in class AbstractFWDTestDescriptorcontext - the context to execute indynamicTestExecutor - the executor to submit dynamic tests toErrorConditionExceptionNode.before(C),
Node.after(C)public void executeImpl()
throws ErrorConditionException
executeImpl in class AbstractFWDTestDescriptorErrorConditionException - remote code may throw thispublic java.util.Optional<org.junit.platform.engine.TestSource> getSource()
getSource in interface org.junit.platform.engine.TestDescriptorgetSource in class NoopDescriptorTestSourcepublic void readExternal(java.io.ObjectInput in)
throws java.io.IOException,
java.lang.ClassNotFoundException
readExternal in interface java.io.ExternalizablereadExternal in class AbstractFWDTestDescriptorin - the stream to read data from in order to restore the objectjava.io.IOException - if I/O errors occurjava.lang.ClassNotFoundException - If the class for an object being
restored cannot be found.public void writeExternal(java.io.ObjectOutput out)
throws java.io.IOException
writeExternal in interface java.io.ExternalizablewriteExternal in class AbstractFWDTestDescriptorout - the stream to write the object tojava.io.IOException - Includes any I/O exceptions that may occurprotected java.lang.Object getTestObject()
The value should be null if the test method is a static legacy class method.
getTestObject in class AbstractFWDTestDescriptornullprivate void executeTestMethod()
throws ErrorConditionException,
LegacyErrorException
ErrorConditionException - thrown by the method executedLegacyErrorException - legacy errors are no caught by this method