diff options
Diffstat (limited to 'src/testcases/org/apache/poi/hssf/usermodel/TestOLE2Embeding.java')
-rw-r--r-- | src/testcases/org/apache/poi/hssf/usermodel/TestOLE2Embeding.java | 25 |
1 files changed, 8 insertions, 17 deletions
diff --git a/src/testcases/org/apache/poi/hssf/usermodel/TestOLE2Embeding.java b/src/testcases/org/apache/poi/hssf/usermodel/TestOLE2Embeding.java index dd57531304..661b1d51f1 100644 --- a/src/testcases/org/apache/poi/hssf/usermodel/TestOLE2Embeding.java +++ b/src/testcases/org/apache/poi/hssf/usermodel/TestOLE2Embeding.java @@ -17,36 +17,28 @@ package org.apache.poi.hssf.usermodel; -import java.io.File; -import java.io.FileInputStream; import java.util.List; import junit.framework.TestCase; -public class TestOLE2Embeding extends TestCase { - public void testEmbeding() throws Exception { - String dirname = System.getProperty("HSSF.testdata.path"); - String filename = dirname + "/ole2-embedding.xls"; +import org.apache.poi.hssf.HSSFTestDataSamples; - File file = new File(filename); - FileInputStream in = new FileInputStream(file); - HSSFWorkbook workbook; +/** + * + */ +public final class TestOLE2Embeding extends TestCase { + public void testEmbeding() { // This used to break, until bug #43116 was fixed - workbook = new HSSFWorkbook(in); - - in.close(); + HSSFWorkbook workbook = HSSFTestDataSamples.openSampleWorkbook("ole2-embedding.xls"); // Check we can get at the Escher layer still workbook.getAllPictures(); } public void testEmbeddedObjects() throws Exception { - String dirname = System.getProperty("HSSF.testdata.path"); - String filename = dirname + "/ole2-embedding.xls"; + HSSFWorkbook workbook = HSSFTestDataSamples.openSampleWorkbook("ole2-embedding.xls"); - File file = new File(filename); - HSSFWorkbook workbook = new HSSFWorkbook(new FileInputStream(file)); List objects = workbook.getAllEmbeddedObjects(); assertEquals("Wrong number of objects", 2, objects.size()); assertEquals("Wrong name for first object", "MBD06CAB431", @@ -56,6 +48,5 @@ public class TestOLE2Embeding extends TestCase { ((HSSFObjectData) objects.get(1)).getDirectory().getName()); } - } |