poi-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From one...@apache.org
Subject svn commit: r1722667 - /poi/trunk/src/testcases/org/apache/poi/sl/usermodel/BaseTestSlideShowFactory.java
Date Sat, 02 Jan 2016 21:20:44 GMT
Author: onealj
Date: Sat Jan  2 21:20:43 2016
New Revision: 1722667

URL: http://svn.apache.org/viewvc?rev=1722667&view=rev
Log:
rearrange unit tests into more, smaller functions

Modified:
    poi/trunk/src/testcases/org/apache/poi/sl/usermodel/BaseTestSlideShowFactory.java

Modified: poi/trunk/src/testcases/org/apache/poi/sl/usermodel/BaseTestSlideShowFactory.java
URL: http://svn.apache.org/viewvc/poi/trunk/src/testcases/org/apache/poi/sl/usermodel/BaseTestSlideShowFactory.java?rev=1722667&r1=1722666&r2=1722667&view=diff
==============================================================================
--- poi/trunk/src/testcases/org/apache/poi/sl/usermodel/BaseTestSlideShowFactory.java (original)
+++ poi/trunk/src/testcases/org/apache/poi/sl/usermodel/BaseTestSlideShowFactory.java Sat
Jan  2 21:20:43 2016
@@ -30,19 +30,24 @@ import org.apache.poi.poifs.filesystem.N
 public class BaseTestSlideShowFactory {
     private static POIDataSamples _slTests = POIDataSamples.getSlideShowInstance();
 
-    public void testFactory(String file, String protectedFile, String password)
-    throws Exception {
+    private static void testFactoryFromFile(String file) throws Exception {
         SlideShow<?,?> ss;
         // from file
         ss = SlideShowFactory.create(fromFile(file));
         assertNotNull(ss);
         ss.close();
+    }
 
+    private static void testFactoryFromStream(String file) throws Exception {
+        SlideShow<?,?> ss;
         // from stream
         ss = SlideShowFactory.create(fromStream(file));
         assertNotNull(ss);
         ss.close();
+    }
 
+    private static void testFactoryFromNative(String file) throws Exception {
+        SlideShow<?,?> ss;
         // from NPOIFS
         if (!file.contains("pptx")) {
             NPOIFSFileSystem npoifs = new NPOIFSFileSystem(fromFile(file));
@@ -51,17 +56,26 @@ public class BaseTestSlideShowFactory {
             npoifs.close();
             ss.close();
         }
+    }
 
-        // from protected file
+    private static void testFactoryFromProtectedFile(String protectedFile, String password)
throws Exception {
+        SlideShow<?,?> ss;
+        // from protected file 
         ss = SlideShowFactory.create(fromFile(protectedFile), password);
         assertNotNull(ss);
         ss.close();
+    }
 
+    private static void testFactoryFromProtectedStream(String protectedFile, String password)
throws Exception {
+        SlideShow<?,?> ss;
         // from protected stream
         ss = SlideShowFactory.create(fromStream(protectedFile), password);
         assertNotNull(ss);
         ss.close();
+    }
 
+    private static void testFactoryFromProtectedNative(String protectedFile, String password)
throws Exception {
+        SlideShow<?,?> ss;
         // from protected NPOIFS
         NPOIFSFileSystem npoifs = new NPOIFSFileSystem(fromFile(protectedFile));
         ss = SlideShowFactory.create(npoifs, password);
@@ -69,6 +83,17 @@ public class BaseTestSlideShowFactory {
         npoifs.close();
         ss.close();
     }
+
+    public static void testFactory(String file, String protectedFile, String password)
+    throws Exception {
+        testFactoryFromFile(file);
+        testFactoryFromStream(file);
+        testFactoryFromNative(file);
+
+        testFactoryFromProtectedFile(protectedFile, password);
+        testFactoryFromProtectedStream(protectedFile, password);
+        testFactoryFromProtectedNative(protectedFile, password);
+    }
     
     private static File fromFile(String file) {
         return (file.contains("/") || file.contains("\\"))
@@ -81,4 +106,5 @@ public class BaseTestSlideShowFactory {
             ? new FileInputStream(file)
             : _slTests.openResourceAsStream(file);
     }
+
 }



---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@poi.apache.org
For additional commands, e-mail: commits-help@poi.apache.org


Mime
View raw message