From 7da179c0002df53fffe72221ac17cf87b3482708 Mon Sep 17 00:00:00 2001
From: wuxw <928255095@qq.com>
Date: 星期五, 06 九月 2019 18:37:28 +0800
Subject: [PATCH] 测试 javassist 成功
---
java110-service/src/test/java/com/java110/service/smo/impl/QueryServiceSMOImplTest.java | 9 +++++++--
1 files changed, 7 insertions(+), 2 deletions(-)
diff --git a/java110-service/src/test/java/com/java110/service/smo/impl/QueryServiceSMOImplTest.java b/java110-service/src/test/java/com/java110/service/smo/impl/QueryServiceSMOImplTest.java
index c800ea3..5cbbce3 100644
--- a/java110-service/src/test/java/com/java110/service/smo/impl/QueryServiceSMOImplTest.java
+++ b/java110-service/src/test/java/com/java110/service/smo/impl/QueryServiceSMOImplTest.java
@@ -17,9 +17,11 @@
public void testJava() throws CannotCompileException, NoSuchMethodException, InvocationTargetException, IllegalAccessException {
- String javaCode = "public static void testJava2() { System.out.println(\"123213\");\n}\n";
- String javaCode2 ="public static void testJava1() { testJava2(); System.out.println(\"223213\");\n}";
+ String javaCode = "public static void testJava2() { DataQuery dataQuery = new DataQuery();\n dataQuery.setServiceCode(\"鏈嶅姟缂栫爜\"); System.out.println(dataQuery.getServiceCode());\n}\n";
+ String javaCode2 ="public static void testJava1() { testJava2(); ServiceSql serviceSql = new ServiceSql(); System.out.println(\"623213\");\n}";
ClassPool classPool = ClassPool.getDefault();
+ classPool.importPackage("com.java110.entity.service.DataQuery");
+ classPool.importPackage("com.java110.entity.service.ServiceSql");
CtClass ctClass = classPool.makeClass("com.java110.service.smo.WuxwTest");
CtMethod helloM = CtNewMethod.make(javaCode, ctClass);
ctClass.addMethod(helloM);
@@ -32,6 +34,9 @@
Constructor<?> con=pc.getConstructor(new Class[]{});
move.invoke(con);
+
+
+
}
--
Gitblit v1.8.0