1 16 17 package net.sf.cglib.transform.impl; 18 19 import net.sf.cglib.transform.*; 20 import junit.framework.*; 21 22 26 public class TestProvideFields extends AbstractTransformTest{ 27 28 String field = "test"; 29 30 31 public TestProvideFields() { 32 } 33 34 35 public TestProvideFields(String name) { 36 super(name); 37 } 38 39 40 public void test(){ 41 42 FieldProvider provider = (FieldProvider)this; 43 assertEquals(field,provider.getField("field")); 44 String value = "tst2"; 45 provider.setField("field", value ); 46 assertEquals(field,value); 47 48 49 50 } 51 52 protected ClassTransformerFactory getTransformer() throws Exception { 53 54 return new ClassTransformerFactory (){ 55 56 public ClassTransformer newInstance(){ 57 58 return new FieldProviderTransformer(); 59 } 60 }; 61 } 62 63 64 public static void main(String [] args) throws Exception { 65 junit.textui.TestRunner.run(suite()); 66 } 67 68 public static Test suite() throws Exception { 69 return new TestSuite( new TestProvideFields( ).transform() ); 70 } 71 72 73 74 75 } 76 | Popular Tags |