1
2 package net.sf.cglib.transform.impl;
3 import net.sf.cglib.transform.*;
4 import junit.framework.*;
5 /***
6 *
7 * @author baliuka
8 */
9 public class TestAddDelegate extends AbstractTransformTest {
10
11 /*** Creates a new instance of TestAddDelegate */
12 public TestAddDelegate(String name) {
13 super(name);
14 }
15
16 public interface Interface {
17
18 Object getDelegte();
19
20 Object getTarget();
21
22 }
23
24 public void test(){
25
26 Interface i = (Interface)this;
27 assertEquals(i.getTarget(),this);
28
29 }
30
31 public static class ImplExclude implements Interface {
32
33 private Object target;
34
35 public ImplExclude(Object target){
36 this.target = target;
37 }
38
39 public Object getDelegte() {
40 return this;
41 }
42
43 public Object getTarget(){
44 return target;
45 }
46 }
47
48 public TestAddDelegate() {
49 super(null);
50 }
51
52
53 protected ClassTransformerFactory getTransformer() throws Exception {
54
55 return new ClassTransformerFactory(){
56
57 public ClassTransformer newInstance(){
58
59 return new AddDelegateTransformer(new Class[]{Interface.class} , ImplExclude.class );
60
61 }
62
63 };
64
65
66 }
67
68
69 public static void main(String[] args) throws Exception{
70 junit.textui.TestRunner.run(suite());
71 }
72
73 public static Test suite() throws Exception{
74
75 return new TestSuite( new TestAddDelegate().transform() );
76
77 }
78
79 }
This page was automatically generated by Maven