1 16 package net.sf.cglib.transform; 17 18 import junit.framework.*; 19 import net.sf.cglib.core.CodeGenerationException; 20 21 25 abstract public class AbstractTransformTest extends TestCase { 26 27 28 29 public AbstractTransformTest() { 30 super(null); 31 } 32 33 34 public AbstractTransformTest(String s) { 35 super(s); 36 } 37 38 protected abstract ClassTransformerFactory getTransformer() throws Exception ; 39 40 public Class transform() throws Exception { 41 ClassLoader loader = 42 new TransformingClassLoader(AbstractTransformTest.class.getClassLoader(), 43 new ClassFilter(){ 44 public boolean accept(String name){ 45 return !(name.startsWith("java") 46 || name.startsWith("junit") 47 || name.endsWith("Exclude")); 48 } 49 }, 50 getTransformer()); 51 try { 52 return loader.loadClass(getClass().getName()); 53 } catch (Exception e) { 54 e.printStackTrace(System.err); 55 throw e; 56 } 57 } 58 59 protected void postProcess(Class c) { 60 } 61 } 62 | Popular Tags |