From 0f609b18b017bef362bd6068591e5ee1124b8ecf Mon Sep 17 00:00:00 2001 From: Javen O'Neal Date: Sun, 3 Jan 2016 01:26:29 +0000 Subject: [PATCH] test XSLF SlideShowFactory creation methods individually for more granular unit test results git-svn-id: https://svn.apache.org/repos/asf/poi/trunk@1722695 13f79535-47bb-0310-9956-ffa450edef68 --- .../usermodel/TestXSLFSlideShowFactory.java | 43 ++++++++++++++++--- .../usermodel/BaseTestSlideShowFactory.java | 12 +++--- 2 files changed, 44 insertions(+), 11 deletions(-) diff --git a/src/ooxml/testcases/org/apache/poi/xslf/usermodel/TestXSLFSlideShowFactory.java b/src/ooxml/testcases/org/apache/poi/xslf/usermodel/TestXSLFSlideShowFactory.java index b4a87337ab..2c9492c983 100644 --- a/src/ooxml/testcases/org/apache/poi/xslf/usermodel/TestXSLFSlideShowFactory.java +++ b/src/ooxml/testcases/org/apache/poi/xslf/usermodel/TestXSLFSlideShowFactory.java @@ -36,13 +36,46 @@ import org.junit.Test; public final class TestXSLFSlideShowFactory extends BaseTestSlideShowFactory { private static POIDataSamples _slTests = POIDataSamples.getSlideShowInstance(); - + private static final String filename = "SampleShow.pptx"; + private static final String password = "opensesame"; + + @Test + public void testFactoryFromFile() throws Exception { + testFactoryFromFile(filename); + } + + @Test + public void testFactoryFromStream() throws Exception { + testFactoryFromStream(filename); + } + + @Test + public void testFactoryFromNative() throws Exception { + testFactoryFromNative(filename); + } + @Test - public void testFactory() throws Exception { - File pFile = createProtected("SampleShow.pptx", "foobaa"); - testFactory("SampleShow.pptx", pFile.getAbsolutePath(), "foobaa"); + public void testFactoryFromProtectedFile() throws Exception { + File pFile = createProtected(); + testFactoryFromProtectedFile(pFile.getAbsolutePath(), password); } - + + @Test + public void testFactoryFromProtectedStream() throws Exception { + File pFile = createProtected(); + testFactoryFromProtectedStream(pFile.getAbsolutePath(), password); + } + + @Test + public void testFactoryFromProtectedNative() throws Exception { + File pFile = createProtected(); + testFactoryFromProtectedNative(pFile.getAbsolutePath(), password); + } + + private static File createProtected() throws IOException, GeneralSecurityException { + return createProtected(filename, password); + } + private static File createProtected(String basefile, String password) throws IOException, GeneralSecurityException { NPOIFSFileSystem fs = new NPOIFSFileSystem(); diff --git a/src/testcases/org/apache/poi/sl/usermodel/BaseTestSlideShowFactory.java b/src/testcases/org/apache/poi/sl/usermodel/BaseTestSlideShowFactory.java index afffbf44f2..a2998053b5 100644 --- a/src/testcases/org/apache/poi/sl/usermodel/BaseTestSlideShowFactory.java +++ b/src/testcases/org/apache/poi/sl/usermodel/BaseTestSlideShowFactory.java @@ -30,7 +30,7 @@ import org.apache.poi.poifs.filesystem.NPOIFSFileSystem; public class BaseTestSlideShowFactory { private static POIDataSamples _slTests = POIDataSamples.getSlideShowInstance(); - private static void testFactoryFromFile(String file) throws Exception { + protected static void testFactoryFromFile(String file) throws Exception { SlideShow ss; // from file ss = SlideShowFactory.create(fromFile(file)); @@ -38,7 +38,7 @@ public class BaseTestSlideShowFactory { ss.close(); } - private static void testFactoryFromStream(String file) throws Exception { + protected static void testFactoryFromStream(String file) throws Exception { SlideShow ss; // from stream ss = SlideShowFactory.create(fromStream(file)); @@ -46,7 +46,7 @@ public class BaseTestSlideShowFactory { ss.close(); } - private static void testFactoryFromNative(String file) throws Exception { + protected static void testFactoryFromNative(String file) throws Exception { SlideShow ss; // from NPOIFS if (!file.contains("pptx")) { @@ -58,7 +58,7 @@ public class BaseTestSlideShowFactory { } } - private static void testFactoryFromProtectedFile(String protectedFile, String password) throws Exception { + protected static void testFactoryFromProtectedFile(String protectedFile, String password) throws Exception { SlideShow ss; // from protected file ss = SlideShowFactory.create(fromFile(protectedFile), password); @@ -66,7 +66,7 @@ public class BaseTestSlideShowFactory { ss.close(); } - private static void testFactoryFromProtectedStream(String protectedFile, String password) throws Exception { + protected static void testFactoryFromProtectedStream(String protectedFile, String password) throws Exception { SlideShow ss; // from protected stream ss = SlideShowFactory.create(fromStream(protectedFile), password); @@ -74,7 +74,7 @@ public class BaseTestSlideShowFactory { ss.close(); } - private static void testFactoryFromProtectedNative(String protectedFile, String password) throws Exception { + protected static void testFactoryFromProtectedNative(String protectedFile, String password) throws Exception { SlideShow ss; // from protected NPOIFS NPOIFSFileSystem npoifs = new NPOIFSFileSystem(fromFile(protectedFile)); -- 2.39.5