From 22f37b99ce712e61eef9ed046e7b2bc6836a5595 Mon Sep 17 00:00:00 2001 From: tianqiao Date: Fri, 1 Jun 2018 10:51:38 +0800 Subject: [PATCH] bugfix maven test for System.out .print --- .../ql/util/express/example/WorkflowTest.java | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-) diff --git a/src/test/java/com/ql/util/express/example/WorkflowTest.java b/src/test/java/com/ql/util/express/example/WorkflowTest.java index ffdc7f1..a1c53a7 100644 --- a/src/test/java/com/ql/util/express/example/WorkflowTest.java +++ b/src/test/java/com/ql/util/express/example/WorkflowTest.java @@ -13,6 +13,14 @@ import com.ql.util.express.example.operator.ApproveOperator; * */ public class WorkflowTest { + + public void print(String s) { + System.out.print(s); + } + + public void println(String s) { + System.out.println(s); + } /** * 执行一段文本 @@ -49,7 +57,7 @@ public class WorkflowTest { runner.addOperatorWithAlias("否则", "else",null); runner.addOperatorWithAlias("大于", ">",null); // - runner.addFunctionOfServiceMethod("打印", System.out, "println",new String[] { "String" }, null); + runner.addFunctionOfServiceMethod("打印", new WorkflowTest(), "println",new String[] { "String" }, null); //定义方法 runner.addFunction("审批通过", new ApproveOperator(1)); runner.addFunction("报销入账", new ApproveOperator(2)); @@ -77,7 +85,7 @@ public class WorkflowTest { runner.addOperatorWithAlias("否则", "else",null); runner.addOperatorWithAlias("大于", ">",null); // - runner.addFunctionOfServiceMethod("打印", System.out, "println",new String[] { "String" }, null); + runner.addFunctionOfServiceMethod("打印", new WorkflowTest(), "println",new String[] { "String" }, null); //定义方法 runner.addFunction("审批通过", new ApproveOperator(1)); runner.addFunction("报销入账", new ApproveOperator(2)); @@ -109,7 +117,7 @@ public class WorkflowTest { runner.addOperatorWithAlias("否则", "else",null); runner.addOperatorWithAlias("大于", ">",null); // - runner.addFunctionOfServiceMethod("打印", System.out, "println",new String[] { "String" }, null); + runner.addFunctionOfServiceMethod("打印", new WorkflowTest(), "println",new String[] { "String" }, null); //加载文件 runner.loadExpress("example/approve"); //设置上下文变量 @@ -135,7 +143,7 @@ public class WorkflowTest { runner.addOperatorWithAlias("否则", "else",null); runner.addOperatorWithAlias("大于", ">",null); // - runner.addFunctionOfServiceMethod("打印", System.out, "println",new String[] { "String" }, null); + runner.addFunctionOfServiceMethod("打印", new WorkflowTest(), "println",new String[] { "String" }, null); //加载文件 runner.loadExpress("example/approve1"); -- GitLab