KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > net > sf > cglib > proxy > TestLazyLoader


1 /*
2  * Copyright 2003,2004 The Apache Software Foundation
3  *
4  * Licensed under the Apache License, Version 2.0 (the "License");
5  * you may not use this file except in compliance with the License.
6  * You may obtain a copy of the License at
7  *
8  * http://www.apache.org/licenses/LICENSE-2.0
9  *
10  * Unless required by applicable law or agreed to in writing, software
11  * distributed under the License is distributed on an "AS IS" BASIS,
12  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13  * See the License for the specific language governing permissions and
14  * limitations under the License.
15  */

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 JavaDoc loadObject() {
27                     System.err.println("loading object");
28                     return "foo";
29                 }
30             };
31         Object JavaDoc obj = Enhancer.create(Object JavaDoc.class, loader);
32         assertTrue("foo".equals(obj.toString()));
33     }
34
35     public TestLazyLoader(String JavaDoc testName) {
36         super(testName);
37     }
38     
39     public static void main(String JavaDoc[] 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 JavaDoc loader) throws Throwable JavaDoc {
48     }
49     
50     public void testFailOnMemoryLeak() throws Throwable JavaDoc {
51     }
52     
53 }
54
Popular Tags