From 6f054ddce1f84edc5f2f85f89904c03df3c1727a Mon Sep 17 00:00:00 2001 From: Dominik Stadler Date: Sun, 6 Aug 2023 17:13:46 +0000 Subject: [PATCH] Fix expected exception text and print out which FileHandler failed in integration-tests git-svn-id: https://svn.apache.org/repos/asf/poi/trunk@1911495 13f79535-47bb-0310-9956-ffa450edef68 --- .../org/apache/poi/stress/TestAllFiles.java | 11 ++++++----- test-data/spreadsheet/stress.xls | Bin 39936 -> 40448 bytes 2 files changed, 6 insertions(+), 5 deletions(-) diff --git a/poi-integration/src/test/java/org/apache/poi/stress/TestAllFiles.java b/poi-integration/src/test/java/org/apache/poi/stress/TestAllFiles.java index fcba54a263..a48d0cbc29 100644 --- a/poi-integration/src/test/java/org/apache/poi/stress/TestAllFiles.java +++ b/poi-integration/src/test/java/org/apache/poi/stress/TestAllFiles.java @@ -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 exClass, String exMessage, String password) { - final String errPrefix = file + " - failed. "; + private static void verify(String file, Executable exec, Class 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)) { diff --git a/test-data/spreadsheet/stress.xls b/test-data/spreadsheet/stress.xls index bd7aa3bcc7752f329c42d153b046a39b37201446..6ad5da595b3d9e354dea7c4d0be0213cb4015842 100644 GIT binary patch delta 436 zcmZqJ!PKyaX@UW-4+9hkFfe#+w0+DZ>IoG1_y7NY81@D6CkCG0#PWh&Jj4Q|oQuJ= zB0067Br`v+xRpVG;rHbK+`Wvhn|pZ_6&MRQuh&uM5jSUG2q?-gNG&RuVqjtroV>zb-!QsT46cfefsNsiG(r_S z0|Vm$4hWxti4UxI_ zfjmYgHlRvoAP=I71<2BYt6~N6?!i<|zEc*@m^s;|T!s&1Hc&56Cy2EA9 z3VFr@o9|aBN>AP}IRFiNZJJ`i%xh%Gz~BJVoAc}%@8rPg!jmJW^KkgRHhtZG;wIx{ aMHZ3C4b#6cdQUE$(aa>(xB1r$Hf8{4v~*Vh delta 312 zcmZqJ!_=^YX@UW-Hv<$1Ffe#-w0+FP`|tn%|1j(`*^v4C!~~X2EHBu_eJnsqxfon4 zl2Z#xGV}9_TNwlxS||VK?qzh?+{>e=z?ivty^cB$zdi#)Kv8}{YEen0LSkOZ=C>A$ z*c6{Dh=Q%EW#D081j6Tn2tE@76NB*N4fgtmv6W(QRcs7w3`eCAs@NGA7!Pqk_zX;Z zV0CSq1sqsSH*1z&VVoRZ9>th8`Ql_5zGem%pe!RpGZ3<{Y`#+-!N@2)*|bug@zCbb zN=4~S(=3>I4J{cM9DvFioWF)}PY#?ZJUL<}566Pk?cI4NZZb|*WD%L%F!Kwe*W}V! O%}h&rH~*T&#tZ;3K3GBk