]> source.dussan.org Git - poi.git/commitdiff
Fix expected exception text and print out which FileHandler failed in integration...
authorDominik Stadler <centic@apache.org>
Sun, 6 Aug 2023 17:13:46 +0000 (17:13 +0000)
committerDominik Stadler <centic@apache.org>
Sun, 6 Aug 2023 17:13:46 +0000 (17:13 +0000)
git-svn-id: https://svn.apache.org/repos/asf/poi/trunk@1911495 13f79535-47bb-0310-9956-ffa450edef68

poi-integration/src/test/java/org/apache/poi/stress/TestAllFiles.java
test-data/spreadsheet/stress.xls

index fcba54a263d4b8913eed481dc4ba5abd23fcf317..a48d0cbc2985902d8b5d98059425841477db4d81 100644 (file)
@@ -184,7 +184,7 @@ public class TestAllFiles {
             FileHandler fileHandler = handler.getHandler();
             assertNotNull(fileHandler, "Did not find a handler for file " + file);
             Executable exec = () -> fileHandler.handleExtracting(new File(ROOT_DIR, file));
-            verify(file, exec, exClass, exMessage, password);
+            verify(file, exec, exClass, exMessage, password, fileHandler);
         } finally {
             Thread.currentThread().setName(threadName);
         }
@@ -205,7 +205,7 @@ public class TestAllFiles {
             assertNotNull(fileHandler, "Did not find a handler for file " + file);
             try (InputStream stream = new BufferedInputStream(new FileInputStream(new File(ROOT_DIR, file)), 64 * 1024)) {
                 Executable exec = () -> fileHandler.handleFile(stream, file);
-                verify(file, exec, exClass, exMessage, password);
+                verify(file, exec, exClass, exMessage, password, fileHandler);
             }
         } finally {
             Thread.currentThread().setName(threadName);
@@ -226,15 +226,16 @@ public class TestAllFiles {
             FileHandler fileHandler = handler.getHandler();
             assertNotNull(fileHandler, "Did not find a handler for file " + file);
             Executable exec = () -> fileHandler.handleAdditional(new File(ROOT_DIR, file));
-            verify(file, exec, exClass, exMessage, password);
+            verify(file, exec, exClass, exMessage, password, fileHandler);
         } finally {
             Thread.currentThread().setName(threadName);
         }
     }
 
     @SuppressWarnings("unchecked")
-    private static void verify(String file, Executable exec, Class<? extends Throwable> exClass, String exMessage, String password) {
-        final String errPrefix = file + " - failed. ";
+    private static void verify(String file, Executable exec, Class<? extends Throwable> exClass, String exMessage, String password,
+            FileHandler fileHandler) {
+        final String errPrefix = file + " - failed for handler " + fileHandler.getClass().getSimpleName() + ": ";
         // this also removes the password for non encrypted files
         Biff8EncryptionKey.setCurrentUserPassword(password);
         if (exClass != null && AssertionFailedError.class.isAssignableFrom(exClass)) {
index bd7aa3bcc7752f329c42d153b046a39b37201446..6ad5da595b3d9e354dea7c4d0be0213cb4015842 100644 (file)
Binary files a/test-data/spreadsheet/stress.xls and b/test-data/spreadsheet/stress.xls differ