]> source.dussan.org Git - poi.git/commitdiff
integration tests: NullPointerExceptions contain now a description in Java 16+
authorAndreas Beeker <kiwiwings@apache.org>
Sat, 16 Jan 2021 09:55:42 +0000 (09:55 +0000)
committerAndreas Beeker <kiwiwings@apache.org>
Sat, 16 Jan 2021 09:55:42 +0000 (09:55 +0000)
git-svn-id: https://svn.apache.org/repos/asf/poi/trunk@1885549 13f79535-47bb-0310-9956-ffa450edef68

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

index 9bce94f0dbc55718aabc300848ac3f6c9e6fa8e1..347559330f9281d159fa6b642edc156c59883c45 100644 (file)
@@ -88,7 +88,15 @@ import org.opentest4j.AssertionFailedError;
 @Execution(ExecutionMode.CONCURRENT)
 public class TestAllFiles {
     private static final File ROOT_DIR = new File("test-data");
-
+    private static final int jreVersion;
+
+    static {
+        String version = System.getProperty("java.version");
+        String major = version.startsWith("1.")
+            ? version.substring(2, 3)
+            : version.substring(0, version.indexOf("."));
+        jreVersion = Integer.parseInt(major);
+    }
 
     public static final String[] SCAN_EXCLUDES = {
         "**/.svn/**",
@@ -204,7 +212,7 @@ public class TestAllFiles {
         } else if (exClass != null) {
             Exception e = assertThrows((Class<? extends Exception>)exClass, exec);
             String actMsg = e.getMessage();
-            if (exMessage == null) {
+            if ((NullPointerException.class.isAssignableFrom(exClass) && jreVersion < 16) || exMessage == null) {
                 assertNull(actMsg);
             } else {
                 assertNotNull(actMsg);
index 004069cffe2dc1d2186633ab7fdb02d443084794..065ad65564bf825eb53dd468be2f636755fd3888 100644 (file)
Binary files a/test-data/spreadsheet/stress.xls and b/test-data/spreadsheet/stress.xls differ