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 |
reportSkip(String message)
Called by generated wrappers to report that a test was skipped.
|
protected void |
reportTestEnd() |
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()
Called by generated subclasses to trigger test finalization.
|
protected void |
testFinalize(boolean success)
Called by generated subclasses to trigger test finalization.
|
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 TestWrapperprotected void reportError(Throwable error)
If a listener has been passed to run(TestListener), then the
TestListener.onError(String, String, 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.onFailure(String, String, String) is called.
error - the AssertionError that caused the failure.run(TestListener)protected void reportSkip(String message)
If a listener has been passed to run(TestListener), then the TestListener.onSkip(String) is
called.
message - the message associated with the test skiprun(TestListener)protected void reportTestEnd()
public boolean run(TestListener listener)
run in interface TestWrapperprotected abstract void runAfterClassMethods()
throws Exception
AfterClassException - if one of the AfterClass methods throws one.protected abstract void runAfterMethods()
throws Exception
AfterException - if one of the BeforeClass methods throws one.protected abstract void runBeforeClassMethods()
throws Exception
BeforeClassException - if one of the BeforeClass methods throws one.protected abstract void runBeforeMethods()
throws Exception
Beforeprotected abstract void runTestMethods()
Testprotected final void testFinalize()
protected final void testFinalize(boolean success)
success - is ignoredprotected final boolean testInitialize(String testMethodName)
Before methods.testMethodName - the name of the test method to initialize.