poi-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From cen...@apache.org
Subject svn commit: r1799178 - in /poi/trunk/src: integrationtest/org/apache/poi/TestAllFiles.java ooxml/testcases/org/apache/poi/xssf/usermodel/TestSXSSFBugs.java testcases/org/apache/poi/hssf/usermodel/TestHSSFCell.java
Date Mon, 19 Jun 2017 11:05:20 GMT
Author: centic
Date: Mon Jun 19 11:05:20 2017
New Revision: 1799178

URL: http://svn.apache.org/viewvc?rev=1799178&view=rev
Log:
Improve error message if we encounter invalid/unexpected files in integration tests
Adjust some tests slightly

Modified:
    poi/trunk/src/integrationtest/org/apache/poi/TestAllFiles.java
    poi/trunk/src/ooxml/testcases/org/apache/poi/xssf/usermodel/TestSXSSFBugs.java
    poi/trunk/src/testcases/org/apache/poi/hssf/usermodel/TestHSSFCell.java

Modified: poi/trunk/src/integrationtest/org/apache/poi/TestAllFiles.java
URL: http://svn.apache.org/viewvc/poi/trunk/src/integrationtest/org/apache/poi/TestAllFiles.java?rev=1799178&r1=1799177&r2=1799178&view=diff
==============================================================================
--- poi/trunk/src/integrationtest/org/apache/poi/TestAllFiles.java (original)
+++ poi/trunk/src/integrationtest/org/apache/poi/TestAllFiles.java Mon Jun 19 11:05:20 2017
@@ -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);

Modified: poi/trunk/src/ooxml/testcases/org/apache/poi/xssf/usermodel/TestSXSSFBugs.java
URL: http://svn.apache.org/viewvc/poi/trunk/src/ooxml/testcases/org/apache/poi/xssf/usermodel/TestSXSSFBugs.java?rev=1799178&r1=1799177&r2=1799178&view=diff
==============================================================================
--- poi/trunk/src/ooxml/testcases/org/apache/poi/xssf/usermodel/TestSXSSFBugs.java (original)
+++ poi/trunk/src/ooxml/testcases/org/apache/poi/xssf/usermodel/TestSXSSFBugs.java Mon Jun
19 11:05:20 2017
@@ -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
             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

Modified: poi/trunk/src/testcases/org/apache/poi/hssf/usermodel/TestHSSFCell.java
URL: http://svn.apache.org/viewvc/poi/trunk/src/testcases/org/apache/poi/hssf/usermodel/TestHSSFCell.java?rev=1799178&r1=1799177&r2=1799178&view=diff
==============================================================================
--- poi/trunk/src/testcases/org/apache/poi/hssf/usermodel/TestHSSFCell.java (original)
+++ poi/trunk/src/testcases/org/apache/poi/hssf/usermodel/TestHSSFCell.java Mon Jun 19 11:05:20
2017
@@ -179,7 +179,7 @@ public final class TestHSSFCell extends
 		wb2.close();
 	}
 
-	
+
 	@Test
 	public void testActiveCellBug56114() throws IOException {
 	    Workbook wb = new HSSFWorkbook();
@@ -197,15 +197,17 @@ public final class TestHSSFCell extends
         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
         
         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
 	 * 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 {



---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@poi.apache.org
For additional commands, e-mail: commits-help@poi.apache.org


Mime
View raw message