]> source.dussan.org Git - poi.git/commitdiff
Assert that deleting test-files and entries works in tests
authorDominik Stadler <centic@apache.org>
Tue, 3 Oct 2023 06:17:01 +0000 (06:17 +0000)
committerDominik Stadler <centic@apache.org>
Tue, 3 Oct 2023 06:17:01 +0000 (06:17 +0000)
git-svn-id: https://svn.apache.org/repos/asf/poi/trunk@1912709 13f79535-47bb-0310-9956-ffa450edef68

poi-ooxml/src/test/java/org/apache/poi/xssf/streaming/TestSXSSFUnicodeSurrogates.java
poi-ooxml/src/test/java/org/apache/poi/xssf/usermodel/TestXSSFUnicodeSurrogates.java
poi-ooxml/src/test/java/org/apache/poi/xssf/usermodel/TestXSSFWorkbook.java
poi/src/test/java/org/apache/poi/hssf/usermodel/TestPOIFSProperties.java
poi/src/test/java/org/apache/poi/poifs/filesystem/TestPOIFSStream.java

index aba3a2f376801e6193edd687ba9f5b494c084594..360bd0576df2f8f053e9ae717edb76a9ee722d01 100644 (file)
@@ -18,6 +18,7 @@
 package org.apache.poi.xssf.streaming;
 
 import static org.junit.jupiter.api.Assertions.assertEquals;
+import static org.junit.jupiter.api.Assertions.assertTrue;
 
 import org.apache.poi.ss.usermodel.Cell;
 import org.apache.poi.ss.usermodel.Row;
@@ -62,7 +63,7 @@ class TestSXSSFUnicodeSurrogates {
                 assertEquals(unicodeText, cell2.getStringCellValue());
             }
         } finally {
-            tf.delete();
+            assertTrue(tf.delete());
         }
     }
 }
index 506e0dead8b7e28749e1abc803db4ba00e97eac0..48c116eb1578be888b6f1b0fe1c9b99b1edc136d 100644 (file)
@@ -18,6 +18,7 @@
 package org.apache.poi.xssf.usermodel;
 
 import static org.junit.jupiter.api.Assertions.assertEquals;
+import static org.junit.jupiter.api.Assertions.assertTrue;
 
 import org.apache.poi.ss.usermodel.Cell;
 import org.apache.poi.ss.usermodel.Row;
@@ -61,7 +62,7 @@ class TestXSSFUnicodeSurrogates {
                 assertEquals(unicodeText, cell2.getStringCellValue());
             }
         } finally {
-            tf.delete();
+            assertTrue(tf.delete());
         }
     }
 }
index 8d258bb289835101ecb40c6a1cb41598743e36a1..9e1a7cc0f34a96b38ed025061ca4158e392abca2 100644 (file)
@@ -1479,7 +1479,7 @@ public final class TestXSSFWorkbook extends BaseTestXWorkbook {
             }
             assertEquals(2, count);
         } finally {
-            tempFile.delete();
+            assertTrue(tempFile.delete());
         }
     }
 
index 4faf1647314efe3996ef1427f9c05be2e5bcb4ad..e9a6fbf43eb0a582137027080edede480dd1fc2b 100644 (file)
@@ -19,6 +19,7 @@ package org.apache.poi.hssf.usermodel;
 
 import static org.junit.jupiter.api.Assertions.assertEquals;
 import static org.junit.jupiter.api.Assertions.assertNotNull;
+import static org.junit.jupiter.api.Assertions.assertTrue;
 
 import java.io.ByteArrayInputStream;
 import java.io.IOException;
@@ -89,7 +90,7 @@ class TestPOIFSProperties {
 
         summary1.setTitle(title);
         //write the modified property back to POIFS
-        fs.getRoot().getEntryCaseInsensitive(SummaryInformation.DEFAULT_STREAM_NAME).delete();
+        assertTrue(fs.getRoot().getEntryCaseInsensitive(SummaryInformation.DEFAULT_STREAM_NAME).delete());
         fs.createDocument(summary1.toInputStream(), SummaryInformation.DEFAULT_STREAM_NAME);
 
         // check that the information was added successfully to the filesystem object
index 7f25ca751dac38dd65c02cc39bcd7b3f015cda1c..0b97d8eb8c735374afc8b5bf253ec59613523a93 100644 (file)
@@ -1817,7 +1817,7 @@ final class TestPOIFSStream {
                         main4096[4095] = -11;
                         testDir.createDocument("Normal4096", new ByteArrayInputStream(main4096));
 
-                        root.getEntryCaseInsensitive("Tags").delete();
+                        assertTrue(root.getEntryCaseInsensitive("Tags").delete());
 
 
                         // Write out, re-load
@@ -1848,7 +1848,7 @@ final class TestPOIFSStream {
 
 
                             // Delete a directory, and add one more
-                            testDir.getEntryCaseInsensitive("Testing 456").delete();
+                            assertTrue(testDir.getEntryCaseInsensitive("Testing 456").delete());
                             testDir.createDirectory("Testing ABC");
 
 
@@ -1903,7 +1903,7 @@ final class TestPOIFSStream {
 
 
                                     // Delete a mini stream, add one more
-                                    testDir.getEntryCaseInsensitive("Mini").delete();
+                                    assertTrue(testDir.getEntryCaseInsensitive("Mini").delete());
 
                                     byte[] mini3 = new byte[]{42, 0, 42, 0, 42, 0, 42};
                                     testDir.createDocument("Mini3", new ByteArrayInputStream(mini3));
@@ -2179,8 +2179,8 @@ final class TestPOIFSStream {
 
 
                 // Delete a couple of streams
-                miniDoc.delete();
-                normDoc.delete();
+                assertTrue(miniDoc.delete());
+                assertTrue(normDoc.delete());
 
 
                 // Check - will have un-used sectors now