MCPcopy Create free account
hub / github.com/crossoverJie/JCSprout / JDKProxyTest

Class JDKProxyTest

src/test/java/com/crossoverjie/proxy/JDKProxyTest.java:17–40  ·  view source on GitHub ↗

Function: JDK 代理单测 @author crossoverJie Date: 23/12/2017 22:40 @since JDK 1.8

Source from the content-addressed store, hash-verified

15 * @since JDK 1.8
16 */
17public class JDKProxyTest {
18
19 @Test
20 public void test(){
21 CustomizeHandle handle = new CustomizeHandle(ISubjectImpl.class) ;
22 ISubject subject = (ISubject) Proxy.newProxyInstance(JDKProxyTest.class.getClassLoader(), new Class[]{ISubject.class}, handle);
23 subject.execute() ;
24 }
25
26 @Test
27 public void clazzTest(){
28// byte[] proxyClassFile = ProxyGenerator.generateProxyClass(
29// "$Proxy1", new Class[]{ISubject.class}, 1);
30// try {
31// FileOutputStream out = new FileOutputStream("/Users/chenjie/Documents/$Proxy1.class") ;
32// out.write(proxyClassFile);
33// out.close();
34// } catch (FileNotFoundException e) {
35// e.printStackTrace();
36// } catch (IOException e) {
37// e.printStackTrace();
38// }
39 }
40}

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected