diff options
author | Dominik Stadler <centic@apache.org> | 2015-05-06 08:42:28 +0000 |
---|---|---|
committer | Dominik Stadler <centic@apache.org> | 2015-05-06 08:42:28 +0000 |
commit | 1ae8444bc49628244c0ba9a38499d6242e4488ba (patch) | |
tree | cc87691f8e6a4099e870172c5feeaf517bbe1bbc | |
parent | 36156dc87baa26abf78e5f1cef067602b20615f4 (diff) | |
download | poi-1ae8444bc49628244c0ba9a38499d6242e4488ba.tar.gz poi-1ae8444bc49628244c0ba9a38499d6242e4488ba.zip |
Try to fix flaky test by waiting for a switch of the second to ensure that we have the same timestamps in the two workbooks that we compare byte-wise in this test.
git-svn-id: https://svn.apache.org/repos/asf/poi/trunk@1677950 13f79535-47bb-0310-9956-ffa450edef68
-rw-r--r-- | src/ooxml/testcases/org/apache/poi/xssf/usermodel/TestXSSFBugs.java | 18 |
1 files changed, 17 insertions, 1 deletions
diff --git a/src/ooxml/testcases/org/apache/poi/xssf/usermodel/TestXSSFBugs.java b/src/ooxml/testcases/org/apache/poi/xssf/usermodel/TestXSSFBugs.java index 365ed2270c..5658f4c12a 100644 --- a/src/ooxml/testcases/org/apache/poi/xssf/usermodel/TestXSSFBugs.java +++ b/src/ooxml/testcases/org/apache/poi/xssf/usermodel/TestXSSFBugs.java @@ -1561,6 +1561,15 @@ public final class TestXSSFBugs extends BaseTestBugzillaIssues { cell.setCellValue("Hi"); sheet.setRepeatingRows(new CellRangeAddress(0, 0, 0, 0)); + // small hack to try to make this test stable, previously it failed whenever the two written ZIP files had different file-creation + // dates stored. + // We try to do a loop until the current second changes in order to avoid problems with some date information that is written to the ZIP and thus + // causes differences + long start = System.currentTimeMillis()/1000; + while(System.currentTimeMillis()/1000 == start) { + Thread.sleep(10); + } + ByteArrayOutputStream bos = new ByteArrayOutputStream(8096); wb.write(bos); byte firstSave[] = bos.toByteArray(); @@ -1568,6 +1577,13 @@ public final class TestXSSFBugs extends BaseTestBugzillaIssues { wb.write(bos); byte secondSave[] = bos.toByteArray(); + /*OutputStream stream = new FileOutputStream("C:\\temp\\poi.xlsx"); + try { + wb.write(stream); + } finally { + stream.close(); + }*/ + assertArrayEquals("Had: \n" + Arrays.toString(firstSave) + " and \n" + Arrays.toString(secondSave), firstSave, secondSave); @@ -2439,7 +2455,7 @@ public final class TestXSSFBugs extends BaseTestBugzillaIssues { wb.close(); } - + /** * .xlsx supports 64000 cell styles, the style indexes after * 32,767 must not be -32,768, then -32,767, -32,766 |