01: /*
02: * Copyright 2003,2004 The Apache Software Foundation
03: *
04: * Licensed under the Apache License, Version 2.0 (the "License");
05: * you may not use this file except in compliance with the License.
06: * You may obtain a copy of the License at
07: *
08: * http://www.apache.org/licenses/LICENSE-2.0
09: *
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 {
27: HashMap identity = new HashMap();
28: Person person = (Person) BeanMapProxy.newInstance(identity,
29: new Class[] { Person.class });
30: person.setName("Chris");
31: assertTrue("Chris".equals(person.getName()));
32: assertTrue("Chris".equals(identity.get("Name")));
33: }
34:
35: public interface Person {
36: public String getName();
37:
38: public void setName(String name);
39: }
40:
41: public TestBeanMapProxy(String testName) {
42: super (testName);
43: }
44:
45: public static void main(String[] args) {
46: junit.textui.TestRunner.run(suite());
47: }
48:
49: public static Test suite() {
50: return new TestSuite(TestBeanMapProxy.class);
51: }
52:
53: public void perform(ClassLoader loader) throws Throwable {
54: //nothing to test at this time
55: }
56:
57: public void testFailOnMemoryLeak() throws Throwable {
58: }
59:
60: }
|