SbloodyS commented on code in PR #17283:
URL: 
https://github.com/apache/dolphinscheduler/pull/17283#discussion_r2182300729


##########
dolphinscheduler-alert/dolphinscheduler-alert-plugins/dolphinscheduler-alert-email/src/test/java/org/apache/dolphinscheduler/plugin/alert/email/ExcelUtilsTest.java:
##########
@@ -74,4 +83,33 @@ public void testGenExcelFileByCheckDir() {
         file.delete();
         Assertions.assertFalse(file.exists());
     }
+    
+    @Test
+    void testGenExcelFile_TruncateLongString() throws Exception {
+        String title = "truncate_test";
+        String longStrKey = "longStr";
+        int maxLen = SpreadsheetVersion.EXCEL2007.getMaxTextLength();
+        // 构造超长字符串
+        StringBuilder sb = new StringBuilder();
+        for (int i = 0; i < maxLen + 100; i++) {
+            sb.append('X');
+        }
+        String longValue = sb.toString();
+        // 构造内容

Review Comment:
   Same here.



##########
dolphinscheduler-alert/dolphinscheduler-alert-plugins/dolphinscheduler-alert-email/src/test/java/org/apache/dolphinscheduler/plugin/alert/email/ExcelUtilsTest.java:
##########
@@ -74,4 +83,33 @@ public void testGenExcelFileByCheckDir() {
         file.delete();
         Assertions.assertFalse(file.exists());
     }
+    
+    @Test
+    void testGenExcelFile_TruncateLongString() throws Exception {
+        String title = "truncate_test";
+        String longStrKey = "longStr";
+        int maxLen = SpreadsheetVersion.EXCEL2007.getMaxTextLength();
+        // 构造超长字符串
+        StringBuilder sb = new StringBuilder();
+        for (int i = 0; i < maxLen + 100; i++) {
+            sb.append('X');
+        }
+        String longValue = sb.toString();
+        // 构造内容
+        String content = "[{\"" + longStrKey + "\":\"" + longValue + "\"}]";
+    
+        // 生成文件
+        ExcelUtils.genExcelFile(content, title, xlsFilePath);
+    
+        // 检查生成的Excel内容

Review Comment:
   Same here.



##########
dolphinscheduler-alert/dolphinscheduler-alert-plugins/dolphinscheduler-alert-email/src/test/java/org/apache/dolphinscheduler/plugin/alert/email/ExcelUtilsTest.java:
##########
@@ -74,4 +83,33 @@ public void testGenExcelFileByCheckDir() {
         file.delete();
         Assertions.assertFalse(file.exists());
     }
+    
+    @Test
+    void testGenExcelFile_TruncateLongString() throws Exception {
+        String title = "truncate_test";
+        String longStrKey = "longStr";
+        int maxLen = SpreadsheetVersion.EXCEL2007.getMaxTextLength();
+        // 构造超长字符串

Review Comment:
   Please using english to describe.



##########
dolphinscheduler-alert/dolphinscheduler-alert-plugins/dolphinscheduler-alert-email/src/test/java/org/apache/dolphinscheduler/plugin/alert/email/ExcelUtilsTest.java:
##########
@@ -74,4 +83,33 @@ public void testGenExcelFileByCheckDir() {
         file.delete();
         Assertions.assertFalse(file.exists());
     }
+    
+    @Test
+    void testGenExcelFile_TruncateLongString() throws Exception {
+        String title = "truncate_test";
+        String longStrKey = "longStr";
+        int maxLen = SpreadsheetVersion.EXCEL2007.getMaxTextLength();
+        // 构造超长字符串
+        StringBuilder sb = new StringBuilder();
+        for (int i = 0; i < maxLen + 100; i++) {
+            sb.append('X');
+        }
+        String longValue = sb.toString();
+        // 构造内容
+        String content = "[{\"" + longStrKey + "\":\"" + longValue + "\"}]";
+    
+        // 生成文件

Review Comment:
   Same here.



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to