Package org.powermock.core.transformers
Class TestClassTransformer<T,M>
- java.lang.Object
-
- org.powermock.core.transformers.TestClassTransformer<T,M>
-
- All Implemented Interfaces:
MockTransformer<T>
- Direct Known Subclasses:
JavaAssistTestClassTransformer
public abstract class TestClassTransformer<T,M> extends java.lang.Object implements MockTransformer<T>
MockTransformer implementation that will make PowerMock test-class enhancements for four purposes... 1) Make test-class static initializer and constructor send crucial details (for PowerMockTestListener events) to GlobalNotificationBuildSupport so that this information can be forwarded to whichever facility is used for composing the PowerMockTestListener events. 2) Removal of test-method annotations as a mean to achieve test-suite chunking! 3) Restore original test-class constructors` accesses (in case they have all been made public byConstructorsMockTransformer
) - to avoid that multiple public test-class constructors cause a delegate runner from JUnit (or 3rd party) to bail out with an error message such as "Test class can only have one constructor". 4) Set test-class defer constructor (if exist) as protected instead of public. Otherwise a delegate runner from JUnit (or 3rd party) might get confused by the presence of more than one test-class constructor and bail out with an error message such as "Test class can only have one constructor".The #3 and #4 enhancements will also be enforced on the constructors of classes that are nested within the test-class.
-
-
Field Summary
Fields Modifier and Type Field Description private MethodSignatureWriter<M>
methodSignatureWriter
private java.lang.Class<?>
testClass
private java.lang.Class<? extends java.lang.annotation.Annotation>
testMethodAnnotationType
-
Constructor Summary
Constructors Constructor Description TestClassTransformer(java.lang.Class<?> testClass, java.lang.Class<? extends java.lang.annotation.Annotation> testMethodAnnotationType, MethodSignatureWriter<M> methodSignatureWriter)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected java.lang.Class<?>
getTestClass()
protected java.lang.Class<? extends java.lang.annotation.Annotation>
getTestMethodAnnotationType()
protected java.lang.String
signatureOf(java.lang.reflect.Method m)
protected java.lang.String
signatureOf(M method)
-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface org.powermock.core.transformers.MockTransformer
transform
-
-
-
-
Field Detail
-
testClass
private final java.lang.Class<?> testClass
-
testMethodAnnotationType
private final java.lang.Class<? extends java.lang.annotation.Annotation> testMethodAnnotationType
-
methodSignatureWriter
private final MethodSignatureWriter<M> methodSignatureWriter
-
-
Constructor Detail
-
TestClassTransformer
public TestClassTransformer(java.lang.Class<?> testClass, java.lang.Class<? extends java.lang.annotation.Annotation> testMethodAnnotationType, MethodSignatureWriter<M> methodSignatureWriter)
-
-
Method Detail
-
signatureOf
protected java.lang.String signatureOf(M method)
-
signatureOf
protected java.lang.String signatureOf(java.lang.reflect.Method m)
-
getTestMethodAnnotationType
protected java.lang.Class<? extends java.lang.annotation.Annotation> getTestMethodAnnotationType()
-
getTestClass
protected java.lang.Class<?> getTestClass()
-
-