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
This commit is contained in:
Javen O'Neal 2016-01-03 01:26:29 +00:00
parent 9ff52e8254
commit 0f609b18b0
2 changed files with 44 additions and 11 deletions

View File

@ -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 testFactory() throws Exception {
File pFile = createProtected("SampleShow.pptx", "foobaa");
testFactory("SampleShow.pptx", pFile.getAbsolutePath(), "foobaa");
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 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();

View File

@ -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));