Author: centic
Date: Sun Mar 29 12:16:10 2020
New Revision: 1875849

URL: http://svn.apache.org/viewvc?rev=1875849&view=rev
Log:
Support building with Gradle in POIFileScanner tests

Modified:
    poi/trunk/src/integrationtest/org/apache/poi/POIFileScanner.java

Modified: poi/trunk/src/integrationtest/org/apache/poi/POIFileScanner.java
URL: 
http://svn.apache.org/viewvc/poi/trunk/src/integrationtest/org/apache/poi/POIFileScanner.java?rev=1875849&r1=1875848&r2=1875849&view=diff
==============================================================================
--- poi/trunk/src/integrationtest/org/apache/poi/POIFileScanner.java (original)
+++ poi/trunk/src/integrationtest/org/apache/poi/POIFileScanner.java Sun Mar 29 
12:16:10 2020
@@ -51,6 +51,16 @@ import static org.junit.Assert.assertEqu
  * Can also be used to get the appropriate FileHandler for a single file.
  */
 public class POIFileScanner {
+    private final static File ROOT_DIR;
+    static {
+        // when running in Gradle, current directory might be 
"build/integrationtest"
+        if(new File("../../test-data").exists()) {
+            ROOT_DIR = new File("../../test-data");
+        } else {
+            ROOT_DIR = new File("test-data");
+        }
+    }
+
     /**
      * Scan a folder for files and return a collection of
      * found files together with the matching {@link FileHandler}.
@@ -195,11 +205,11 @@ public class POIFileScanner {
 
     @Test
     public void testDetectUnnamedFile() throws IOException {
-        POIFileScanner.detectUnnamedFile(new File("test-data/spreadsheet"), 
"49156.xlsx");
+        POIFileScanner.detectUnnamedFile(new File(ROOT_DIR, "spreadsheet"), 
"49156.xlsx");
     }
 
     @Test
     public void test() throws IOException {
-        POIFileScanner.scan(new File("test-data"));
+        POIFileScanner.scan(ROOT_DIR);
     }
 }



---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to