bug #I4LUQ5 默认的slot的dataMap无法放入值为null的对象

This commit is contained in:
bryan31
2021-12-13 18:00:42 +08:00
parent 89637b2aaf
commit 7e2dcdeba6
6 changed files with 33 additions and 129 deletions

View File

@@ -1,6 +1,9 @@
package com.yomahub.liteflow.test.nullParam;
import com.yomahub.liteflow.core.FlowExecutor;
import com.yomahub.liteflow.entity.data.DefaultSlot;
import com.yomahub.liteflow.entity.data.LiteflowResponse;
import org.junit.Assert;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.springframework.beans.factory.annotation.Autowired;
@@ -13,9 +16,8 @@ import org.springframework.test.context.junit4.SpringRunner;
/**
* 单元测试:传递null param导致NPE的优化代码
*
* @Author LeoLee
* @Date 2021/12/9 16:58
* @Version 1.0
* @author LeoLee
* @since 2.6.6
*/
@RunWith(SpringRunner.class)
@TestPropertySource(value = "classpath:/nullParam/application.properties")
@@ -29,15 +31,11 @@ public class NullParamTest {
/**
* 支持无参的flow执行以及param 为null时的异常抛出
* @Author LeoLee
* @Date 17:25 2021/12/9
*/
@Test
public void testNullParam() throws Exception {
//flowExecutor.execute("chain1", null);//NullParamException: data slot can't accept null param
flowExecutor.execute("chain1");
//flowExecutor.execute2Resp("chain1", null);//NullParamException: data slot can't accept null param
flowExecutor.execute2Resp("chain1");
LiteflowResponse<DefaultSlot> response = flowExecutor.execute2Resp("chain1");
Assert.assertTrue(response.isSuccess());
}
}

View File

@@ -1,2 +1 @@
liteflow.rule-source=nullParam/flow.xml
liteflow.print-banner=true

View File

@@ -1,7 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<flow>
<chain name="chain1">
<!--同步执行-->
<then value="a,b"/>
<when value="c"/>
</chain>