Improve error message if we encounter invalid/unexpected files in integration tests
Adjust some tests slightly git-svn-id: https://svn.apache.org/repos/asf/poi/trunk@1799178 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
parent
66bf6c5ad7
commit
2095c92402
@ -19,6 +19,7 @@ package org.apache.poi;
|
||||
|
||||
import static org.junit.Assert.assertFalse;
|
||||
import static org.junit.Assert.assertNotNull;
|
||||
import static org.junit.Assert.fail;
|
||||
|
||||
import java.io.BufferedInputStream;
|
||||
import java.io.File;
|
||||
@ -386,6 +387,10 @@ public class TestAllFiles {
|
||||
|
||||
@Test
|
||||
public void testAllFiles() throws Exception {
|
||||
if(handler == null) {
|
||||
fail("Did not find a handler for file " + file);
|
||||
}
|
||||
|
||||
System.out.println("Reading " + file + " with " + handler.getClass());
|
||||
assertNotNull("Unknown file extension for file: " + file + ": " + getExtension(file), handler);
|
||||
File inputFile = new File(ROOT_DIR, file);
|
||||
|
@ -17,7 +17,6 @@
|
||||
|
||||
package org.apache.poi.xssf.usermodel;
|
||||
|
||||
import static org.junit.Assert.fail;
|
||||
import static org.junit.Assert.assertEquals;
|
||||
|
||||
import java.io.IOException;
|
||||
@ -91,6 +90,7 @@ public final class TestSXSSFBugs extends BaseTestBugzillaIssues {
|
||||
super.bug60197_NamedRangesReferToCorrectSheetWhenSheetOrderIsChanged();
|
||||
} catch (final RuntimeException e) {
|
||||
final Throwable cause = e.getCause();
|
||||
//noinspection StatementWithEmptyBody
|
||||
if (cause instanceof IOException && cause.getMessage().equals("Stream closed")) {
|
||||
// expected on the second time that _testDataProvider.writeOutAndReadBack(SXSSFWorkbook) is called
|
||||
// if the test makes it this far, then we know that XSSFName sheet indices are updated when sheet
|
||||
|
@ -179,7 +179,7 @@ public final class TestHSSFCell extends BaseTestCell {
|
||||
wb2.close();
|
||||
}
|
||||
|
||||
|
||||
|
||||
@Test
|
||||
public void testActiveCellBug56114() throws IOException {
|
||||
Workbook wb = new HSSFWorkbook();
|
||||
@ -197,15 +197,17 @@ public final class TestHSSFCell extends BaseTestCell {
|
||||
assertEquals(0, ((HSSFSheet)wb.getSheetAt(0)).getSheet().getActiveCellCol());
|
||||
|
||||
cell.setAsActiveCell();
|
||||
cell.setCellValue("this should be active");
|
||||
|
||||
assertEquals(1, ((HSSFSheet)wb.getSheetAt(0)).getSheet().getActiveCellRow());
|
||||
assertEquals(3, ((HSSFSheet)wb.getSheetAt(0)).getSheet().getActiveCellCol());
|
||||
|
||||
// FileOutputStream fos = new FileOutputStream("/tmp/56114.xls");
|
||||
//
|
||||
// wb.write(fos);
|
||||
//
|
||||
// fos.close();
|
||||
/*OutputStream fos = new FileOutputStream("c:/temp/56114.xls");
|
||||
try {
|
||||
wb.write(fos);
|
||||
} finally {
|
||||
fos.close();
|
||||
}*/
|
||||
|
||||
Workbook wbBack = _testDataProvider.writeOutAndReadBack(wb);
|
||||
wb.close();
|
||||
@ -217,12 +219,13 @@ public final class TestHSSFCell extends BaseTestCell {
|
||||
|
||||
assertEquals(3, ((HSSFSheet)wbBack.getSheetAt(0)).getSheet().getActiveCellRow());
|
||||
assertEquals(3, ((HSSFSheet)wbBack.getSheetAt(0)).getSheet().getActiveCellCol());
|
||||
|
||||
// fos = new FileOutputStream("/tmp/56114a.xls");
|
||||
//
|
||||
// wbBack.write(fos);
|
||||
//
|
||||
// fos.close();
|
||||
|
||||
/*fos = new FileOutputStream("c:/temp/56114a.xls");
|
||||
try {
|
||||
wb.write(fos);
|
||||
} finally {
|
||||
fos.close();
|
||||
}*/
|
||||
|
||||
Workbook wbBack2 = _testDataProvider.writeOutAndReadBack(wbBack);
|
||||
wbBack.close();
|
||||
@ -336,7 +339,6 @@ public final class TestHSSFCell extends BaseTestCell {
|
||||
* the {@link StringRecord} following the {@link FormulaRecord} after the result type had been
|
||||
* changed to number/boolean/error. Excel silently ignores the extra record, but some POI
|
||||
* versions (prior to bug 46213 / r717883) crash instead.
|
||||
* @throws IOException
|
||||
*/
|
||||
@Test
|
||||
public void testCachedTypeChange() throws IOException {
|
||||
|
Loading…
Reference in New Issue
Block a user