public abstract class AbstractTestWrapper extends Object implements TestWrapper
TestWrapper
interface so it can be called by another application.Modifier and Type | Field and Description |
---|---|
protected boolean |
failed |
protected Object |
test |
protected Class<?> |
testClass |
protected String |
testClassName |
protected TestListener |
testListener |
protected String |
testMethod |
protected long |
testMethodStart |
Constructor and Description |
---|
AbstractTestWrapper(Class<?> testClass)
Creates a wrapper instance for the specified test class.
|
Modifier and Type | Method and Description |
---|---|
String |
getTestClass() |
protected void |
reportError(Throwable error)
Called by generated wrappers to report an error.
|
protected void |
reportFailure(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(String testMethodName)
Called by generated subclasses to trigger test initialization, by instantiating the test class and calling the
Before methods. |
protected boolean failed
protected Object test
protected final Class<?> testClass
protected final String testClassName
protected TestListener testListener
protected String testMethod
protected long testMethodStart
public AbstractTestWrapper(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.public String getTestClass()
getTestClass
in interface TestWrapper
protected void reportError(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(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)
public boolean run(TestListener listener)
run
in interface TestWrapper
protected abstract void runAfterClassMethods() throws Exception
AfterClass
Exception
- if one of the AfterClass
methods throws one.protected abstract void runAfterMethods() throws Exception
After
Exception
- if one of the BeforeClass
methods throws one.protected abstract void runBeforeClassMethods() throws Exception
BeforeClass
Exception
- if one of the BeforeClass
methods throws one.protected abstract void runBeforeMethods() throws Exception
Before
protected abstract void runTestMethods()
Test
protected final void testFinalize(boolean success)
success
- if true, test success success will be reportedprotected final boolean testInitialize(String testMethodName)
Before
methods.testMethodName
- the name of the test method to initialize.