KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > logicalcobwebs > cglib > EnhancerTest


1 /*
2  * This software is released under a licence similar to the Apache Software Licence.
3  * See org.logicalcobwebs.proxool.package.html for details.
4  * The latest version is available at http://proxool.sourceforge.net
5  */

6 package org.logicalcobwebs.cglib;
7
8 import org.logicalcobwebs.proxool.AbstractProxoolTest;
9 import org.logicalcobwebs.cglib.proxy.Enhancer;
10
11 /**
12  * A test test class (!) to help me understand the Enhancer. It fails. Or at least,
13  * it would do if I uncommented the assert. But that fines. It's a learning process.
14  * @version $Revision: 1.2 $, $Date: 2004/06/02 20:55:54 $
15  * @author billhorsman
16  * @author $Author: billhorsman $ (current maintainer)
17  */

18 public class EnhancerTest extends AbstractProxoolTest {
19
20     public EnhancerTest(String JavaDoc alias) {
21         super(alias);
22     }
23
24     public void testConcreteClassEnhancer() {
25
26         MyInterfaceIF mi = (MyInterfaceIF) Enhancer.create(
27                 null,
28                 new Class JavaDoc[] {MyInterfaceIF.class},
29                 new MyProxy(new MyConcreteClass()));
30
31         mi.bar();
32         try {
33             MyConcreteClass mcc = (MyConcreteClass) mi;
34         } catch (ClassCastException JavaDoc e) {
35             // Expected this :(
36
}
37         // This fails
38
// assertEquals("foo()", "proxiedFoo", mcc.foo());
39
}
40
41 }
42
43 /*
44  Revision history:
45  $Log: EnhancerTest.java,v $
46  Revision 1.2 2004/06/02 20:55:54 billhorsman
47  Make sure test doesn't throw a ClassCastException
48
49  Revision 1.1 2004/06/02 20:54:57 billhorsman
50  Learning test class for Enhancer. It fails (or would if the assert was uncommented). Left in for knowledge.
51
52 */
Popular Tags