public abstract class TestClassTransformer extends Object implements MockTransformer
AbstractMainMockTransformer.setAllConstructorsToPublic(javassist.CtClass)
)
- 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.Modifier and Type | Class and Description |
---|---|
static interface |
TestClassTransformer.ForTestClass |
Modifier and Type | Method and Description |
---|---|
static TestClassTransformer.ForTestClass |
forTestClass(Class<?> testClass) |
javassist.CtClass |
transform(javassist.CtClass clazz)
Transforms the
clazz . |
public static TestClassTransformer.ForTestClass forTestClass(Class<?> testClass)
public javassist.CtClass transform(javassist.CtClass clazz) throws Exception
MockTransformer
clazz
.transform
in interface MockTransformer
clazz
- The class to be
transform into a mock enabled class.CtClass
representation of the mocked class.Exception
Copyright © 2007–2019. All rights reserved.