diff --git a/backend/src/main/java/io/metersphere/xmind/XmindCaseParser.java b/backend/src/main/java/io/metersphere/xmind/XmindCaseParser.java index 9eb6277108..2084c51a13 100644 --- a/backend/src/main/java/io/metersphere/xmind/XmindCaseParser.java +++ b/backend/src/main/java/io/metersphere/xmind/XmindCaseParser.java @@ -82,7 +82,8 @@ public class XmindCaseParser { for (int i = 0; i < nodes.length; i++) { if (i != 0 && StringUtils.equals(nodes[i].trim(), "")) { process.append(Translator.get("module_not_null") + "; "); - break; + } else if (nodes[i].trim().length() > 30) { + process.append(nodes[i].trim() + ":" + Translator.get("test_track.length_less_than") + "30 ;"); } } }); @@ -95,7 +96,6 @@ public class XmindCaseParser { item.setParent(parent); this.newTestCase(item.getTitle(), parent.getPath(), item.getChildren() != null ? item.getChildren().getAttached() : null); } else { - validLength(item.getTitle()); String nodePath = parent.getPath() + "/" + item.getTitle(); item.setPath(nodePath); item.setParent(parent); @@ -222,13 +222,6 @@ public class XmindCaseParser { compartDatas.add(compartData); } - private void validLength(String title) { - if (StringUtils.equals(title.trim(), "")) - process.append(Translator.get("module_not_null") + "; "); - if (title.length() > 30) - process.append(title + ":" + Translator.get("test_track.length_less_than") + "30 ;"); - } - // 验证合法性 private boolean validate(TestCaseWithBLOBs data) { String nodePath = data.getNodePath(); @@ -244,6 +237,9 @@ public class XmindCaseParser { if (i != 0 && StringUtils.equals(nodes[i].trim(), "")) { stringBuilder.append(Translator.get("module_not_null") + "; "); break; + } else if (nodes[i].trim().length() > 30) { + stringBuilder.append(nodes[i].trim() + ":" + Translator.get("test_track.length_less_than") + "30 ;"); + break; } } } @@ -281,7 +277,6 @@ public class XmindCaseParser { if (isAvailable(item.getTitle(), "(?:tc:|tc:|tc)")) { // 用例 return replace(item.getTitle(), "(?:tc:|tc:|tc)") + ":" + Translator.get("test_case_create_module_fail"); } else { - validLength(item.getTitle()); item.setPath(item.getTitle()); if (item.getChildren() != null && !item.getChildren().getAttached().isEmpty()) { recursion(processBuffer, item, 1, item.getChildren().getAttached());