fix(测试跟踪): 用例导出步骤描述兼容旧数据

--bug=1020198 --user=陈建星 【测试跟踪】github#20007老版本升级新版本2.3.1后,测试用例--steps字段中未对预期结果为空时做兼容处理,导致测试用例导出报空指针错误 https://www.tapd.cn/55049933/s/1303458
This commit is contained in:
chenjianxing 2022-11-23 20:44:46 +08:00 committed by jianxing
parent 109dd8cc27
commit 0d66e08f98
1 changed files with 4 additions and 4 deletions

View File

@ -1771,11 +1771,11 @@ public class TestCaseService {
for (int j = 0; j < jsonArray.size(); j++) { for (int j = 0; j < jsonArray.size(); j++) {
// 将步骤存储起来之后生成多条数据再合并单元格 // 将步骤存储起来之后生成多条数据再合并单元格
Map item = (Map) jsonArray.get(j); Map item = (Map) jsonArray.get(j);
String stepDesc = item.get("desc").toString(); String stepDesc = Optional.ofNullable(item.get("desc")).orElse(StringUtils.EMPTY).toString();
String stepResult = item.get("result").toString(); String stepResult = Optional.ofNullable(item.get("result")).orElse(StringUtils.EMPTY).toString();
if (StringUtils.isNotBlank(stepDesc) || StringUtils.isNotBlank(stepResult)) { if (StringUtils.isNotBlank(stepDesc) || StringUtils.isNotBlank(stepResult)) {
stepDescList.add(Optional.ofNullable(stepDesc).orElse(StringUtils.EMPTY)); stepDescList.add(stepDesc);
stepResultList.add(Optional.ofNullable(stepResult).orElse(StringUtils.EMPTY)); stepResultList.add(stepResult);
} }
} }
} }