public abstract class AbstractTestWrapper extends java.lang.Object implements TestWrapper
TestWrapper
interface so it can be called by another application.Modifier and Type | Field and Description |
---|---|
protected boolean |
failed |
protected java.lang.Object |
test |
protected java.lang.Class<?> |
testClass |
protected java.lang.String |
testClassName |
protected TestListener |
testListener |
protected java.lang.String |
testMethod |
protected long |
testMethodStart |
Constructor and Description |
---|
AbstractTestWrapper(java.lang.Class<?> testClass)
Creates a wrapper instance for the specified test class.
|
Modifier and Type | Method and Description |
---|---|
java.lang.String |
getTestClass() |
protected void |
reportError(java.lang.Throwable error)
Called by generated wrappers to report an error.
|
protected void |
reportFailure(java.lang.AssertionError error)
Called by generated wrappers to report a failure.
|
protected void |
reportSuccess()
Called by generated wrappers to report a success.
|
boolean |
run(TestListener listener) |
protected abstract void |
runAfterClassMethods()
To be implemented by generated subclasses, triggers the execution of methods tagged with
AfterClass |
protected abstract void |
runAfterMethods()
To be implemented by generated subclasses, triggers the execution of methods tagged with
After |
protected abstract void |
runBeforeClassMethods()
To be implemented by generated subclasses, triggers the execution of methods tagged with
BeforeClass |
protected abstract void |
runBeforeMethods()
To be implemented by generated subclasses, triggers the execution of methods tagged with
Before |
protected abstract void |
runTestMethods()
To be implemented by generated subclasses, triggers the execution of test methods tagged with
Test |
protected void |
testFinalize(boolean success)
Called by generated subclasses to trigger test finalization, by reporting the test execution status and calling
the After methods.
|
protected boolean |
testInitialize(java.lang.String testMethodName)
Called by generated subclasses to trigger test initialization, by instantiating the test class and calling the
Before methods. |
protected final java.lang.Class<?> testClass
protected final java.lang.String testClassName
protected boolean failed
protected java.lang.String testMethod
protected long testMethodStart
protected java.lang.Object test
protected TestListener testListener
public AbstractTestWrapper(java.lang.Class<?> testClass)
Queries and store the class name, so clients of the wrappers can look them up by name if necessary.
testClass
- the test class to instantiate.protected void reportError(java.lang.Throwable error)
If a listener has been passed to run(TestListener)
, then the
TestListener.testError(String, String, long, Throwable, String)
is called.
error
- the Throwable
that caused the error.run(TestListener)
protected void reportFailure(java.lang.AssertionError error)
If a listener has been passed to run(TestListener)
, then the
TestListener.testFailure(String, String, long, Throwable, String)
is called.
error
- the AssertionError
that caused the failure.run(TestListener)
protected void reportSuccess()
If a listener has been passed to run(TestListener)
, then the
TestListener.testSuccess(String, String, long)
is called.
run(TestListener)
protected abstract void runBeforeClassMethods() throws java.lang.Exception
BeforeClass
java.lang.Exception
- if one of the BeforeClass
methods throws one.protected abstract void runAfterClassMethods() throws java.lang.Exception
AfterClass
java.lang.Exception
- if one of the AfterClass
methods throws one.protected abstract void runBeforeMethods() throws java.lang.Exception
Before
java.lang.Exception
- if one of the Before
methods throws one.protected abstract void runAfterMethods() throws java.lang.Exception
After
java.lang.Exception
- if one of the BeforeClass
methods throws one.protected abstract void runTestMethods()
Test
protected final boolean testInitialize(java.lang.String testMethodName)
Before
methods.testMethodName
- the name of the test method to initialize.protected final void testFinalize(boolean success)
success
- if true, test success success will be reportedpublic java.lang.String getTestClass()
getTestClass
in interface TestWrapper
public boolean run(TestListener listener)
run
in interface TestWrapper