wuxw
2019-06-02 cebc50ae8295dd24e2fd5ba0d4d236459a5190a3
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
package com.java110.core.proxy;
 
import junit.framework.Test;
import junit.framework.TestCase;
import junit.framework.TestSuite;
 
import java.lang.reflect.Proxy;
 
/**
 * Unit test for simple App.
 */
public class AppProxyTest
        extends TestCase {
    /**
     * Create the test case
     *
     * @param testName name of the test case
     */
    public AppProxyTest(String testName) {
        super(testName);
    }
 
    /**
     * @return the suite of tests being tested
     */
    public static Test suite() {
        return new TestSuite(AppProxyTest.class);
    }
 
    /**
     * Rigourous Test :-)
     */
    public void testApp() {
 
        CglibProxy proxy = new CglibProxy();
        //通过生成子类的方式创建代理类
        ITestService proxyImp = (ITestService)proxy.getProxy(ITestService.class);
        proxyImp.get("123213");
        proxyImp.set("123123");
    }
}