01: /*
02: * This software is released under a licence similar to the Apache Software Licence.
03: * See org.logicalcobwebs.proxool.package.html for details.
04: * The latest version is available at http://proxool.sourceforge.net
05: */
06: package org.logicalcobwebs.cglib;
07:
08: import org.logicalcobwebs.proxool.AbstractProxoolTest;
09: 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 alias) {
21: super (alias);
22: }
23:
24: public void testConcreteClassEnhancer() {
25:
26: MyInterfaceIF mi = (MyInterfaceIF) Enhancer.create(null,
27: new Class[] { MyInterfaceIF.class }, new MyProxy(
28: new MyConcreteClass()));
29:
30: mi.bar();
31: try {
32: MyConcreteClass mcc = (MyConcreteClass) mi;
33: } catch (ClassCastException e) {
34: // Expected this :(
35: }
36: // This fails
37: // assertEquals("foo()", "proxiedFoo", mcc.foo());
38: }
39:
40: }
41:
42: /*
43: Revision history:
44: $Log: EnhancerTest.java,v $
45: Revision 1.2 2004/06/02 20:55:54 billhorsman
46: Make sure test doesn't throw a ClassCastException
47:
48: Revision 1.1 2004/06/02 20:54:57 billhorsman
49: Learning test class for Enhancer. It fails (or would if the assert was uncommented). Left in for knowledge.
50:
51: */
|