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,7 +1,10 @@
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 com.yomahub.liteflow.test.BaseTest;
import org.junit.Assert;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.springframework.test.context.ContextConfiguration;
@@ -11,10 +14,8 @@ import javax.annotation.Resource;
/**
* 单元测试:传递null param导致NPE的优化代码
*
* @Author LeoLee
* @Date 2021/12/11
* @Version V1.0
* @author LeoLee
* @since 2.6.6
**/
@RunWith(SpringRunner.class)
@ContextConfiguration("classpath:/nullParam/application-local.xml")
@@ -25,14 +26,10 @@ public class NullParamTest extends BaseTest {
/**
* 支持无参的flow执行以及param 为null时的异常抛出
* @Author: LeoLee
* @Date: 2021/12/11 21:38
*/
@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());
}
}