]> source.dussan.org Git - poi.git/commitdiff
simplify unit test code with IOUtils.write to a NullOutputStream
authorJaven O'Neal <onealj@apache.org>
Tue, 20 Jun 2017 09:12:42 +0000 (09:12 +0000)
committerJaven O'Neal <onealj@apache.org>
Tue, 20 Jun 2017 09:12:42 +0000 (09:12 +0000)
git-svn-id: https://svn.apache.org/repos/asf/poi/trunk@1799323 13f79535-47bb-0310-9956-ffa450edef68

src/ooxml/testcases/org/apache/poi/xssf/usermodel/TestXSSFBugs.java

index 38f1151f65f54feafc1917b984442b734f50bc5b..e2bbebb614dad408a26d34458e2d933e08da7fb2 100644 (file)
@@ -75,7 +75,9 @@ import org.apache.poi.ss.util.AreaReference;
 import org.apache.poi.ss.util.CellRangeAddress;
 import org.apache.poi.ss.util.CellReference;
 import org.apache.poi.ss.util.CellUtil;
+import org.apache.poi.util.IOUtils;
 import org.apache.poi.util.LocaleUtil;
+import org.apache.poi.util.NullOutputStream;
 import org.apache.poi.util.TempFile;
 import org.apache.poi.xssf.XLSBUnsupportedException;
 import org.apache.poi.xssf.XSSFITestDataProvider;
@@ -3162,13 +3164,7 @@ public final class TestXSSFBugs extends BaseTestBugzillaIssues {
 
         // we currently only populate the dimension during writing out
         // to avoid having to iterate all rows/cells in each add/remove of a row or cell
-        //OutputStream str = new FileOutputStream("/tmp/53611.xlsx");
-        OutputStream str = new ByteArrayOutputStream();
-        try {
-            wb.write(str);
-        } finally {
-            str.close();
-        }
+        IOUtils.write(wb, new NullOutputStream());
 
         assertEquals("B2:I5", ((XSSFSheet) sheet).getCTWorksheet().getDimension().getRef());