1 2 package net.sf.cglib.transform.impl; 3 4 import net.sf.cglib.transform.*; 5 import junit.framework.*; 6 7 /*** 8 * 9 * @author baliuka 10 */ 11 public class TestProvideFields extends AbstractTransformTest{ 12 13 String field = "test"; 14 15 /*** Creates a new instance of TestProvideFields */ 16 public TestProvideFields() { 17 } 18 19 /*** Creates a new instance of TestProvideFields */ 20 public TestProvideFields(String name) { 21 super(name); 22 } 23 24 25 public void test(){ 26 27 FieldProvider provider = (FieldProvider)this; 28 assertEquals(field,provider.getField("field")); 29 String value = "tst2"; 30 provider.setField("field", value ); 31 assertEquals(field,value); 32 33 34 35 } 36 37 protected ClassTransformerFactory getTransformer() throws Exception { 38 39 return new ClassTransformerFactory (){ 40 41 public ClassTransformer newInstance(){ 42 43 return new FieldProviderTransformer(); 44 } 45 }; 46 } 47 48 49 public static void main(String[] args) throws Exception{ 50 junit.textui.TestRunner.run(suite()); 51 } 52 53 public static Test suite() throws Exception{ 54 return new TestSuite( new TestProvideFields( ).transform() ); 55 } 56 57 58 59 60 }

This page was automatically generated by Maven