]> source.dussan.org Git - poi.git/commitdiff
Extract ROOT_DIR into constant, ignore .csv files
authorDominik Stadler <centic@apache.org>
Fri, 2 Jan 2015 21:07:14 +0000 (21:07 +0000)
committerDominik Stadler <centic@apache.org>
Fri, 2 Jan 2015 21:07:14 +0000 (21:07 +0000)
git-svn-id: https://svn.apache.org/repos/asf/poi/trunk@1649124 13f79535-47bb-0310-9956-ffa450edef68

src/integrationtest/org/apache/poi/TestAllFiles.java

index 65e59276086b12e9d1b1885dc509149b1ca33e78..f560892d379bdefc722595addcb987cdc6466391 100644 (file)
@@ -65,7 +65,9 @@ import org.junit.runners.Parameterized.Parameters;
  */
 @RunWith(Parameterized.class)
 public class TestAllFiles {
-       // map file extensions to the actual mappers
+       private static final File ROOT_DIR = new File("test-data");
+
+    // map file extensions to the actual mappers
        private static final Map<String, FileHandler> HANDLERS = new HashMap<String, FileHandler>();
        static {
                // Excel
@@ -136,6 +138,7 @@ public class TestAllFiles {
                HANDLERS.put(".wav", new NullFileHandler());
                HANDLERS.put(".pfx", new NullFileHandler());
                HANDLERS.put(".xml", new NullFileHandler());
+               HANDLERS.put(".csv", new NullFileHandler());
                
                // map some files without extension
                HANDLERS.put("spreadsheet/BigSSTRecord", new NullFileHandler());
@@ -223,7 +226,7 @@ public class TestAllFiles {
     @Parameters(name="{index}: {0} using {1}")
     public static Iterable<Object[]> files() {
         DirectoryScanner scanner = new DirectoryScanner();
-        scanner.setBasedir(new File("test-data"));
+        scanner.setBasedir(ROOT_DIR);
         scanner.setExcludes(new String[] { "**/.svn/**" });
         
         scanner.scan();
@@ -248,7 +251,7 @@ public class TestAllFiles {
     @Test
     public void testAllFiles() throws Exception {
                assertNotNull("Unknown file extension for file: " + file + ": " + getExtension(file), handler);
-               InputStream stream = new BufferedInputStream(new FileInputStream(new File("test-data", file)),100);
+               InputStream stream = new BufferedInputStream(new FileInputStream(new File(ROOT_DIR, file)),100);
                try {
                        handler.handleFile(stream);
                        
@@ -263,7 +266,7 @@ public class TestAllFiles {
                        stream.close();
                }
        }
-       
+
        private static String getExtension(String file) {
                int pos = file.lastIndexOf('.');
                if(pos == -1 || pos == file.length()-1) {