1 16 package net.sf.cglib.proxy; 17 18 import net.sf.cglib.CodeGenTestCase; 19 import java.lang.reflect.*; 20 import java.util.*; 21 import junit.framework.*; 22 23 public class TestLazyLoader extends CodeGenTestCase { 24 public void testLazyLoader() { 25 LazyLoader loader = new LazyLoader() { 26 public Object loadObject() { 27 System.err.println("loading object"); 28 return "foo"; 29 } 30 }; 31 Object obj = Enhancer.create(Object .class, loader); 32 assertTrue("foo".equals(obj.toString())); 33 } 34 35 public TestLazyLoader(String testName) { 36 super(testName); 37 } 38 39 public static void main(String [] args) { 40 junit.textui.TestRunner.run(suite()); 41 } 42 43 public static Test suite() { 44 return new TestSuite(TestLazyLoader.class); 45 } 46 47 public void perform(ClassLoader loader) throws Throwable { 48 } 49 50 public void testFailOnMemoryLeak() throws Throwable { 51 } 52 53 } 54 | Popular Tags |