Class PowerMockJUnit44RunnerDelegateImpl
- java.lang.Object
-
- org.junit.runner.Runner
-
- org.powermock.modules.junit4.internal.impl.PowerMockJUnit44RunnerDelegateImpl
-
- All Implemented Interfaces:
org.junit.runner.Describable
,org.junit.runner.manipulation.Filterable
,org.junit.runner.manipulation.Sortable
,PowerMockJUnitRunnerDelegate
- Direct Known Subclasses:
PowerMockJUnit47RunnerDelegateImpl
public class PowerMockJUnit44RunnerDelegateImpl extends org.junit.runner.Runner implements org.junit.runner.manipulation.Filterable, org.junit.runner.manipulation.Sortable, PowerMockJUnitRunnerDelegate
A JUnit4 test runner that only runs a specified set of test methods in a test class.
Many parts of this class are essentially a rip off from
JUnit4ClassRunner
used in JUnit 4.4. It does however not extend this class because we cannot let it perform the stuff it does in its constructor. Another thing that different is that if an exception is thrown in the test we add a tip to error message asking the user if they've not forgot to add a class to test. Yet another difference is that this runner notifies the PowerMock listeners of certain events.- See Also:
JUnit4ClassRunner
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description protected class
PowerMockJUnit44RunnerDelegateImpl.PowerMockJUnit44MethodRunner
-
Field Summary
Fields Modifier and Type Field Description private PowerMockTestNotifier
powerMockTestNotifier
private org.junit.internal.runners.TestClass
testClass
private java.util.List<java.lang.reflect.Method>
testMethods
-
Constructor Summary
Constructors Constructor Description PowerMockJUnit44RunnerDelegateImpl(java.lang.Class<?> klass)
PowerMockJUnit44RunnerDelegateImpl(java.lang.Class<?> klass, java.lang.String[] methodsToRun)
PowerMockJUnit44RunnerDelegateImpl(java.lang.Class<?> klass, java.lang.String[] methodsToRun, PowerMockTestListener[] listeners)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected java.lang.annotation.Annotation[]
classAnnotations()
protected PowerMockJUnit44RunnerDelegateImpl.PowerMockJUnit44MethodRunner
createPowerMockRunner(java.lang.Object testInstance, org.junit.internal.runners.TestMethod testMethod, org.junit.runner.notification.RunNotifier notifier, org.junit.runner.Description description, boolean extendsFromTestCase)
protected java.lang.Object
createTest()
private java.lang.Object
createTestInstance()
void
filter(org.junit.runner.manipulation.Filter filter)
org.junit.runner.Description
getDescription()
protected java.lang.String
getName()
java.lang.Class<?>
getTestClass()
int
getTestCount()
protected java.util.List<java.lang.reflect.Method>
getTestMethods(java.lang.Class<?> klass, java.lang.String[] methodsToRun)
protected org.junit.internal.runners.TestClass
getTestWrappedClass()
protected void
invokeTestMethod(java.lang.reflect.Method method, org.junit.runner.notification.RunNotifier notifier)
protected org.junit.runner.Description
methodDescription(java.lang.reflect.Method method)
void
run(org.junit.runner.notification.RunNotifier notifier)
protected void
runMethods(org.junit.runner.notification.RunNotifier notifier)
void
sort(org.junit.runner.manipulation.Sorter sorter)
private void
testAborted(org.junit.runner.notification.RunNotifier notifier, org.junit.runner.Description description, java.lang.Throwable e)
protected java.lang.annotation.Annotation[]
testAnnotations(java.lang.reflect.Method method)
protected java.lang.String
testName(java.lang.reflect.Method method)
protected void
validate()
protected org.junit.internal.runners.TestMethod
wrapMethod(java.lang.reflect.Method method)
-
-
-
Field Detail
-
testMethods
private final java.util.List<java.lang.reflect.Method> testMethods
-
testClass
private final org.junit.internal.runners.TestClass testClass
-
powerMockTestNotifier
private final PowerMockTestNotifier powerMockTestNotifier
-
-
Constructor Detail
-
PowerMockJUnit44RunnerDelegateImpl
public PowerMockJUnit44RunnerDelegateImpl(java.lang.Class<?> klass, java.lang.String[] methodsToRun, PowerMockTestListener[] listeners) throws org.junit.internal.runners.InitializationError
- Throws:
org.junit.internal.runners.InitializationError
-
PowerMockJUnit44RunnerDelegateImpl
public PowerMockJUnit44RunnerDelegateImpl(java.lang.Class<?> klass, java.lang.String[] methodsToRun) throws org.junit.internal.runners.InitializationError
- Throws:
org.junit.internal.runners.InitializationError
-
PowerMockJUnit44RunnerDelegateImpl
public PowerMockJUnit44RunnerDelegateImpl(java.lang.Class<?> klass) throws org.junit.internal.runners.InitializationError
- Throws:
org.junit.internal.runners.InitializationError
-
-
Method Detail
-
getTestMethods
protected final java.util.List<java.lang.reflect.Method> getTestMethods(java.lang.Class<?> klass, java.lang.String[] methodsToRun)
-
validate
protected final void validate() throws org.junit.internal.runners.InitializationError
- Throws:
org.junit.internal.runners.InitializationError
-
run
public void run(org.junit.runner.notification.RunNotifier notifier)
- Specified by:
run
in interfacePowerMockJUnitRunnerDelegate
- Specified by:
run
in classorg.junit.runner.Runner
-
runMethods
protected void runMethods(org.junit.runner.notification.RunNotifier notifier)
-
getDescription
public org.junit.runner.Description getDescription()
- Specified by:
getDescription
in interfaceorg.junit.runner.Describable
- Specified by:
getDescription
in interfacePowerMockJUnitRunnerDelegate
- Specified by:
getDescription
in classorg.junit.runner.Runner
-
classAnnotations
protected java.lang.annotation.Annotation[] classAnnotations()
-
getName
protected java.lang.String getName()
-
createTest
protected java.lang.Object createTest() throws java.lang.Exception
- Throws:
java.lang.Exception
-
createTestInstance
private java.lang.Object createTestInstance() throws java.lang.InstantiationException, java.lang.IllegalAccessException, java.lang.reflect.InvocationTargetException, java.lang.NoSuchMethodException
- Throws:
java.lang.InstantiationException
java.lang.IllegalAccessException
java.lang.reflect.InvocationTargetException
java.lang.NoSuchMethodException
-
invokeTestMethod
protected void invokeTestMethod(java.lang.reflect.Method method, org.junit.runner.notification.RunNotifier notifier)
-
createPowerMockRunner
protected PowerMockJUnit44RunnerDelegateImpl.PowerMockJUnit44MethodRunner createPowerMockRunner(java.lang.Object testInstance, org.junit.internal.runners.TestMethod testMethod, org.junit.runner.notification.RunNotifier notifier, org.junit.runner.Description description, boolean extendsFromTestCase)
-
testAborted
private void testAborted(org.junit.runner.notification.RunNotifier notifier, org.junit.runner.Description description, java.lang.Throwable e)
-
wrapMethod
protected org.junit.internal.runners.TestMethod wrapMethod(java.lang.reflect.Method method)
-
testName
protected java.lang.String testName(java.lang.reflect.Method method)
-
methodDescription
protected org.junit.runner.Description methodDescription(java.lang.reflect.Method method)
-
testAnnotations
protected java.lang.annotation.Annotation[] testAnnotations(java.lang.reflect.Method method)
-
filter
public void filter(org.junit.runner.manipulation.Filter filter) throws org.junit.runner.manipulation.NoTestsRemainException
- Specified by:
filter
in interfaceorg.junit.runner.manipulation.Filterable
- Throws:
org.junit.runner.manipulation.NoTestsRemainException
-
sort
public void sort(org.junit.runner.manipulation.Sorter sorter)
- Specified by:
sort
in interfaceorg.junit.runner.manipulation.Sortable
-
getTestWrappedClass
protected org.junit.internal.runners.TestClass getTestWrappedClass()
-
getTestCount
public int getTestCount()
- Specified by:
getTestCount
in interfacePowerMockJUnitRunnerDelegate
-
getTestClass
public java.lang.Class<?> getTestClass()
- Specified by:
getTestClass
in interfacePowerMockJUnitRunnerDelegate
-
-