fix(功能用例): 脑图文本节点名称不能为空

This commit is contained in:
guoyuqi 2024-06-24 16:31:17 +08:00 committed by 刘瑞斌
parent 501c5b44a5
commit 0e964a9443
6 changed files with 33 additions and 0 deletions

View File

@ -101,6 +101,7 @@ minder_extra_node.steps_expected_result=预期结果
minder_extra_node.text_description=文本描述 minder_extra_node.text_description=文本描述
minder_extra_node.text_expected_result=预期结果 minder_extra_node.text_expected_result=预期结果
minder_extra_node.description=备注信息 minder_extra_node.description=备注信息
minder_extra_node.text_node_empty=文本节点名称不能为空
#moduleCaseReview #moduleCaseReview
case_review.id.not_blank=ID不能为空 case_review.id.not_blank=ID不能为空
case_review.name.length_range=名称长度必须在1-200之间 case_review.name.length_range=名称长度必须在1-200之间

View File

@ -137,6 +137,7 @@ minder_extra_node.steps_expected_result=ExpectedResult
minder_extra_node.text_description=TextDescription minder_extra_node.text_description=TextDescription
minder_extra_node.text_expected_result=ExpectedResult minder_extra_node.text_expected_result=ExpectedResult
minder_extra_node.description=Description minder_extra_node.description=Description
minder_extra_node.text_node_empty=Text node name cannot be empty
#moduleCaseReview #moduleCaseReview
case_review.id.not_blank=ID cannot be empty case_review.id.not_blank=ID cannot be empty
case_review.name.length_range=The name length must be between 1 and 200 case_review.name.length_range=The name length must be between 1 and 200

View File

@ -136,6 +136,7 @@ minder_extra_node.steps_expected_result=预期结果
minder_extra_node.text_description=文本描述 minder_extra_node.text_description=文本描述
minder_extra_node.text_expected_result=预期结果 minder_extra_node.text_expected_result=预期结果
minder_extra_node.description=备注信息 minder_extra_node.description=备注信息
minder_extra_node.text_node_empty=文本节点名称不能为空
#moduleCaseReview #moduleCaseReview
case_review.id.not_blank=ID不能为空 case_review.id.not_blank=ID不能为空
case_review.name.length_range=名称长度必须在1-200之间 case_review.name.length_range=名称长度必须在1-200之间

View File

@ -137,6 +137,7 @@ minder_extra_node.steps_expected_result=預期結果
minder_extra_node.text_description=文字描述 minder_extra_node.text_description=文字描述
minder_extra_node.text_expected_result=預期結果 minder_extra_node.text_expected_result=預期結果
minder_extra_node.description=備註資訊 minder_extra_node.description=備註資訊
minder_extra_node.text_node_empty=文字節點名稱不能為空
#moduleCaseReview #moduleCaseReview
case_review.id.not_blank=ID不能為空 case_review.id.not_blank=ID不能為空
case_review.name.length_range=名稱長度必須在1-200之間 case_review.name.length_range=名稱長度必須在1-200之間

View File

@ -738,6 +738,9 @@ public class FunctionalCaseMinderService {
if (mindAdditionalNodeRequest.getName().length()>255) { if (mindAdditionalNodeRequest.getName().length()>255) {
mindAdditionalNodeRequest.setName(mindAdditionalNodeRequest.getName().substring(0,249)); mindAdditionalNodeRequest.setName(mindAdditionalNodeRequest.getName().substring(0,249));
} }
if (StringUtils.isBlank(mindAdditionalNodeRequest.getName())) {
throw new MSException(Translator.get("minder_extra_node.text_node_empty"));
}
mindAdditionalNode.setName(mindAdditionalNodeRequest.getName()); mindAdditionalNode.setName(mindAdditionalNodeRequest.getName());
mindAdditionalNode.setParentId(mindAdditionalNodeRequest.getParentId()); mindAdditionalNode.setParentId(mindAdditionalNodeRequest.getParentId());
mindAdditionalNode.setUpdateTime(System.currentTimeMillis()); mindAdditionalNode.setUpdateTime(System.currentTimeMillis());
@ -753,6 +756,9 @@ public class FunctionalCaseMinderService {
if (mindAdditionalNodeRequest.getName().length()>255) { if (mindAdditionalNodeRequest.getName().length()>255) {
mindAdditionalNodeRequest.setName(mindAdditionalNodeRequest.getName().substring(0,249)); mindAdditionalNodeRequest.setName(mindAdditionalNodeRequest.getName().substring(0,249));
} }
if (StringUtils.isBlank(mindAdditionalNodeRequest.getName())) {
throw new MSException(Translator.get("minder_extra_node.text_node_empty"));
}
mindAdditionalNode.setName(mindAdditionalNodeRequest.getName()); mindAdditionalNode.setName(mindAdditionalNodeRequest.getName());
mindAdditionalNode.setParentId(mindAdditionalNodeRequest.getParentId()); mindAdditionalNode.setParentId(mindAdditionalNodeRequest.getParentId());
mindAdditionalNode.setProjectId(request.getProjectId()); mindAdditionalNode.setProjectId(request.getProjectId());

View File

@ -24,6 +24,8 @@ import java.nio.charset.StandardCharsets;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.List; import java.util.List;
import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.status;
@SpringBootTest(webEnvironment = SpringBootTest.WebEnvironment.RANDOM_PORT) @SpringBootTest(webEnvironment = SpringBootTest.WebEnvironment.RANDOM_PORT)
@TestMethodOrder(MethodOrderer.OrderAnnotation.class) @TestMethodOrder(MethodOrderer.OrderAnnotation.class)
@AutoConfigureMockMvc @AutoConfigureMockMvc
@ -329,6 +331,27 @@ public class FunctionalCaseMinderControllerTest extends BaseTest {
this.requestPostWithOkAndReturn(FUNCTIONAL_CASE_EDIT_URL, request); this.requestPostWithOkAndReturn(FUNCTIONAL_CASE_EDIT_URL, request);
functionalCases = functionalCaseMapper.selectByExample(functionalCaseExample); functionalCases = functionalCaseMapper.selectByExample(functionalCaseExample);
Assertions.assertTrue(CollectionUtils.isNotEmpty(functionalCases)); Assertions.assertTrue(CollectionUtils.isNotEmpty(functionalCases));
mindAdditionalNodeRequest = new MindAdditionalNodeRequest();
mindAdditionalNodeRequest.setId("sss2");
mindAdditionalNodeRequest.setType("ADD");
mindAdditionalNodeRequest.setName("");
mindAdditionalNodeRequest.setParentId("TEST_MINDER_MODULE_ID_GYQ");
additionalNodeList.add(mindAdditionalNodeRequest);
request.setAdditionalNodeList(additionalNodeList);
this.requestPost(FUNCTIONAL_CASE_EDIT_URL, request).andExpect(status().is5xxServerError());
request.getAdditionalNodeList().remove(additionalNodeList.size()-1);
mindAdditionalNodeRequest = new MindAdditionalNodeRequest();
mindAdditionalNodeRequest.setId("additional2");
mindAdditionalNodeRequest.setType("UPDATE");
mindAdditionalNodeRequest.setName("");
mindAdditionalNodeRequest.setParentId("TEST_MINDER_MODULE_ID_GYQ");
additionalNodeList.add(mindAdditionalNodeRequest);
request.setAdditionalNodeList(additionalNodeList);
this.requestPost(FUNCTIONAL_CASE_EDIT_URL, request).andExpect(status().is5xxServerError());
} }
@Test @Test