mirror of
https://gitee.com/dromara/liteFlow.git
synced 2026-05-14 20:22:07 +08:00
bug #I4LUQ5 默认的slot的dataMap无法放入值为null的对象
This commit is contained in:
@@ -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());
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -1,2 +1 @@
|
||||
liteflow.rule-source=nullParam/flow.xml
|
||||
liteflow.print-banner=true
|
||||
|
||||
@@ -1,7 +1,6 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<flow>
|
||||
<chain name="chain1">
|
||||
<!--同步执行-->
|
||||
<then value="a,b"/>
|
||||
<when value="c"/>
|
||||
</chain>
|
||||
|
||||
Reference in New Issue
Block a user