Assert on the contents of the byte-array to see if the problem happens during writing the data or reading it back in

git-svn-id: https://svn.apache.org/repos/asf/poi/trunk@1803614 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Dominik Stadler 2017-08-01 06:26:44 +00:00
parent 37866e55b2
commit a208ead70b
1 changed files with 5 additions and 0 deletions

View File

@ -32,6 +32,7 @@ import org.apache.poi.hpsf.SummaryInformation;
import org.apache.poi.hpsf.WritingNotSupportedException;
import org.apache.poi.hssf.HSSFTestDataSamples;
import org.apache.poi.poifs.filesystem.POIFSFileSystem;
import org.apache.poi.util.HexDump;
import org.junit.Test;
/**
@ -104,6 +105,10 @@ public class TestPOIFSProperties {
}
private void checkFromByteArray(byte[] bytes) throws IOException, NoPropertySetStreamException, MarkUnsupportedException {
// on some environments in CI we see strange failures, let's verify that the size is exactly right
// this can be removed again after the problem is identified
assertEquals("Had: " + HexDump.toHex(bytes), 5120, bytes.length);
POIFSFileSystem fs2 = new POIFSFileSystem(new ByteArrayInputStream(bytes));
SummaryInformation summary2 = (SummaryInformation) PropertySetFactory.create(fs2.createDocumentInputStream(SummaryInformation.DEFAULT_STREAM_NAME));
assertNotNull(summary2);