Fix test so it loads data file from the correct place.
git-svn-id: https://svn.apache.org/repos/asf/poi/branches/ooxml@616314 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
parent
9ce000ac3a
commit
0d29a56d2d
@ -17,7 +17,7 @@
|
|||||||
|
|
||||||
package org.apache.poi.xssf.io;
|
package org.apache.poi.xssf.io;
|
||||||
|
|
||||||
import java.net.URL;
|
import java.io.File;
|
||||||
|
|
||||||
import junit.framework.TestCase;
|
import junit.framework.TestCase;
|
||||||
|
|
||||||
@ -26,9 +26,15 @@ import org.apache.poi.xssf.usermodel.XSSFWorkbook;
|
|||||||
|
|
||||||
public class TestLoadSaveXSSF extends TestCase {
|
public class TestLoadSaveXSSF extends TestCase {
|
||||||
|
|
||||||
|
String filename;
|
||||||
|
|
||||||
|
protected void setUp() throws Exception {
|
||||||
|
super.setUp();
|
||||||
|
filename = System.getProperty("HSSF.testdata.path");
|
||||||
|
}
|
||||||
|
|
||||||
public void testLoadSample() throws Exception {
|
public void testLoadSample() throws Exception {
|
||||||
URL url = this.getClass().getResource("sample.xlsx");
|
XSSFWorkbook workbook = new XSSFWorkbook(new File(filename, "sample.xlsx").getAbsolutePath());
|
||||||
XSSFWorkbook workbook = new XSSFWorkbook(url.getFile());
|
|
||||||
assertEquals(3, workbook.getNumberOfSheets());
|
assertEquals(3, workbook.getNumberOfSheets());
|
||||||
assertEquals("Sheet1", workbook.getSheetName(0));
|
assertEquals("Sheet1", workbook.getSheetName(0));
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user