]> source.dussan.org Git - poi.git/commitdiff
Fix unit test for Bug 50298 some more
authorDominik Stadler <centic@apache.org>
Wed, 21 Aug 2013 22:57:26 +0000 (22:57 +0000)
committerDominik Stadler <centic@apache.org>
Wed, 21 Aug 2013 22:57:26 +0000 (22:57 +0000)
git-svn-id: https://svn.apache.org/repos/asf/poi/trunk@1516320 13f79535-47bb-0310-9956-ffa450edef68

src/testcases/org/apache/poi/hssf/usermodel/TestHSSFWorkbook.java

index ff951bb4905c953cd3ffc70defc07f1d8c771d96..6d49827bf67fe1d62681888e2adf3f9d4af5742b 100644 (file)
@@ -922,10 +922,7 @@ public final class TestHSSFWorkbook extends BaseTestWorkbook {
                assertEquals("Did not have the expected size when writing the workbook: written: " + written + ", but expected: " + expected,
                                expected, written);
                
-               ByteArrayOutputStream out = new ByteArrayOutputStream();
-               wb.write(out);
-               
-               HSSFWorkbook read = new HSSFWorkbook(new ByteArrayInputStream(out.toByteArray()));
+               HSSFWorkbook read = HSSFTestDataSamples.writeOutAndReadBack(wb);
                assertSheetOrder(read, "Invoice", "Invoice1", "Digest", "Deferred", "Received");
        }
 
@@ -965,11 +962,8 @@ public final class TestHSSFWorkbook extends BaseTestWorkbook {
                assertEquals("Did not have the expected size when writing the workbook: written: " + written + ", but expected: " + expected,
                                expected, written);
                
-               ByteArrayOutputStream out = new ByteArrayOutputStream();
-               wb.write(out);
-               
-               HSSFWorkbook read = new HSSFWorkbook(new ByteArrayInputStream(out.toByteArray()));
-               assertSheetOrder(wb, "Invoice", "Deferred", "Received", "Digest");
+               HSSFWorkbook read = HSSFTestDataSamples.writeOutAndReadBack(wb);
+               assertSheetOrder(read, "Invoice", "Deferred", "Received", "Digest");
        }
        
        private void assertSheetOrder(HSSFWorkbook wb, String... sheets) {