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:
parent
d747590977
commit
87ec46ff34
@ -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();
|
||||
|
@ -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));
|
||||
|
Loading…
Reference in New Issue
Block a user