fix(idea 插件): 导入接口空指针报错

This commit is contained in:
zhangdahai112 2022-08-09 18:13:10 +08:00 committed by zhangdahai112
parent 5eb01804d5
commit 5b05eadeb8
2 changed files with 3 additions and 3 deletions

View File

@ -994,7 +994,7 @@ public class ApiDefinitionService {
apiTestCaseWithBLOBs.setApiDefinitionId(apiDefinition.getId());
apiTestCaseWithBLOBs.setCreateUserId(Objects.requireNonNull(SessionUtils.getUser()).getId());
apiTestCaseWithBLOBs.setUpdateUserId(Objects.requireNonNull(SessionUtils.getUser()).getId());
if (apiDefinition.getToBeUpdated() != null && !apiTestCaseWithBLOBs.getVersionId().equals("cover")) {
if (apiDefinition.getToBeUpdated() != null && !StringUtils.equalsIgnoreCase(apiTestCaseWithBLOBs.getVersionId(), "cover")) {
apiTestCaseWithBLOBs.setToBeUpdated(true);
//TODO:check setting
} else {
@ -1153,7 +1153,7 @@ public class ApiDefinitionService {
if (CollectionUtils.isEmpty(caseList)) {
apiDefinition.setToBeUpdated(false);
} else {
List<ApiTestCaseWithBLOBs> cover = caseList.stream().filter(t -> !t.getVersionId().equals("cover") && StringUtils.isNotBlank(t.getId())).collect(Collectors.toList());
List<ApiTestCaseWithBLOBs> cover = caseList.stream().filter(t -> !StringUtils.equalsIgnoreCase("cover", t.getVersionId()) && StringUtils.isNotBlank(t.getId())).collect(Collectors.toList());
if (CollectionUtils.isEmpty(cover)) {
apiDefinition.setToBeUpdated(false);
} else {

View File

@ -1346,7 +1346,7 @@ public class ApiModuleService extends NodeTreeService<ApiModuleDTO> {
}
List<ApiTestCaseWithBLOBs> caseWithBLOBs = definitionIdCaseMAp.get(apiDefinitionWithBLOBs.getId());
if (CollectionUtils.isNotEmpty(caseWithBLOBs)) {
return caseWithBLOBs.stream().filter(t -> !t.getVersionId().equals("create_repeat")).collect(Collectors.toMap(ApiTestCase::getName, testCase -> testCase));
return caseWithBLOBs.stream().filter(t -> !StringUtils.equalsIgnoreCase("create_repeat", t.getVersionId())).collect(Collectors.toMap(ApiTestCase::getName, testCase -> testCase));
} else {
return null;
}