KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > net > sf > cglib > beans > TestBeanMapProxy


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.beans;
17
18 import junit.framework.*;
19 import java.util.*;
20
21 /**
22  * @author Chris Nokleberg <a HREF="mailto:chris@nokleberg.com">chris@nokleberg.com</a>
23  * @version $Id: TestBeanMapProxy.java,v 1.3 2004/06/24 21:15:17 herbyderby Exp $
24  */

25 public class TestBeanMapProxy extends net.sf.cglib.CodeGenTestCase {
26     public void testBeanMap() throws Exception JavaDoc {
27         HashMap identity = new HashMap();
28         Person person = (Person)BeanMapProxy.newInstance(identity, new Class JavaDoc[]{ Person.class });
29         person.setName("Chris");
30         assertTrue("Chris".equals(person.getName()));
31         assertTrue("Chris".equals(identity.get("Name")));
32     }
33
34    public interface Person {
35         public String JavaDoc getName();
36         public void setName(String JavaDoc name);
37     }
38
39     public TestBeanMapProxy(String JavaDoc testName) {
40         super(testName);
41     }
42     
43     public static void main(String JavaDoc[] args) {
44         junit.textui.TestRunner.run(suite());
45     }
46     
47     public static Test suite() {
48         return new TestSuite(TestBeanMapProxy.class);
49     }
50     
51     public void perform(ClassLoader JavaDoc loader) throws Throwable JavaDoc {
52       //nothing to test at this time
53
}
54     
55     public void testFailOnMemoryLeak() throws Throwable JavaDoc {
56     }
57     
58 }
59
Popular Tags