eclipse warnings - raw list access

close resources

git-svn-id: https://svn.apache.org/repos/asf/poi/trunk@1773906 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Andreas Beeker 2016-12-13 00:31:23 +00:00
parent 128001186b
commit 6a8332a173
5 changed files with 276 additions and 288 deletions

View File

@ -17,25 +17,17 @@
package org.apache.poi.hssf.record; package org.apache.poi.hssf.record;
import java.io.InputStream; import java.io.IOException;
import junit.framework.AssertionFailedError;
import junit.framework.TestCase;
import org.apache.poi.hssf.HSSFTestDataSamples; import org.apache.poi.hssf.HSSFTestDataSamples;
import org.apache.poi.hssf.usermodel.HSSFWorkbook; import org.junit.Test;
/** /**
* *
*/ */
public final class TestBOFRecord extends TestCase { public final class TestBOFRecord {
public void testBOFRecord() throws Exception { @Test
InputStream is = HSSFTestDataSamples.openSampleFileStream("bug_42794.xls"); public void testBOFRecord() throws IOException {
// This used to throw an error before - #42794
// This used to throw an error before HSSFTestDataSamples.openSampleWorkbook("bug_42794.xls").close();
try {
new HSSFWorkbook(is);
} catch (ArrayIndexOutOfBoundsException e) {
throw new AssertionFailedError("Identified bug 42794");
}
} }
} }

View File

@ -30,14 +30,12 @@ import org.junit.Test;
/** /**
* Test HyperlinkRecord * Test HyperlinkRecord
*
* @author Nick Burch
* @author Yegor Kozlov
*/ */
public final class TestHyperlinkRecord { public final class TestHyperlinkRecord {
//link to http://www.lakings.com/ //link to http://www.lakings.com/
private static final byte[] data1 = { 0x02, 0x00, //First row of the hyperlink private static final byte[] data1 = {
0x02, 0x00, //First row of the hyperlink
0x02, 0x00, //Last row of the hyperlink 0x02, 0x00, //Last row of the hyperlink
0x00, 0x00, //First column of the hyperlink 0x00, 0x00, //First column of the hyperlink
0x00, 0x00, //Last column of the hyperlink 0x00, 0x00, //Last column of the hyperlink
@ -73,10 +71,12 @@ public final class TestHyperlinkRecord {
//standard 24-byte tail of a URL link. Seems to always be the same for all URL HLINKs //standard 24-byte tail of a URL link. Seems to always be the same for all URL HLINKs
0x79, 0x58, (byte)0x81, (byte)0xF4, 0x3B, 0x1D, 0x7F, 0x48, (byte)0xAF, 0x2C, 0x79, 0x58, (byte)0x81, (byte)0xF4, 0x3B, 0x1D, 0x7F, 0x48, (byte)0xAF, 0x2C,
(byte)0x82, 0x5D, (byte)0xC4, (byte)0x85, 0x27, 0x63, 0x00, 0x00, 0x00, (byte)0x82, 0x5D, (byte)0xC4, (byte)0x85, 0x27, 0x63, 0x00, 0x00, 0x00,
0x00, (byte)0xA5, (byte)0xAB, 0x00, 0x00}; 0x00, (byte)0xA5, (byte)0xAB, 0x00, 0x00
};
//link to a file in the current directory: link1.xls //link to a file in the current directory: link1.xls
private static final byte[] data2 = {0x00, 0x00, private static final byte[] data2 = {
0x00, 0x00,
0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00,
@ -110,7 +110,8 @@ public final class TestHyperlinkRecord {
}; };
// mailto:ebgans@mail.ru?subject=Hello,%20Ebgans! // mailto:ebgans@mail.ru?subject=Hello,%20Ebgans!
private static final byte[] data3 = {0x01, 0x00, private static final byte[] data3 = {
0x01, 0x00,
0x01, 0x00, 0x01, 0x00,
0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00,
@ -150,7 +151,8 @@ public final class TestHyperlinkRecord {
}; };
//link to a place in worksheet: Sheet1!A1 //link to a place in worksheet: Sheet1!A1
private static final byte[] data4 = {0x03, 0x00, private static final byte[] data4 = {
0x03, 0x00,
0x03, 0x00, 0x03, 0x00,
0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00,
@ -171,9 +173,11 @@ public final class TestHyperlinkRecord {
//link: Sheet1!A1 //link: Sheet1!A1
0x53, 0x00, 0x68, 0x00, 0x65, 0x00, 0x65, 0x00, 0x74, 0x00, 0x31, 0x00, 0x21, 0x53, 0x00, 0x68, 0x00, 0x65, 0x00, 0x65, 0x00, 0x74, 0x00, 0x31, 0x00, 0x21,
0x00, 0x41, 0x00, 0x31, 0x00, 0x00, 0x00}; 0x00, 0x41, 0x00, 0x31, 0x00, 0x00, 0x00
};
private static final byte[] dataLinkToWorkbook = HexRead.readFromString("01 00 01 00 01 00 01 00 " + private static final byte[] dataLinkToWorkbook = HexRead.readFromString(
"01 00 01 00 01 00 01 00 " +
"D0 C9 EA 79 F9 BA CE 11 8C 82 00 AA 00 4B A9 0B " + "D0 C9 EA 79 F9 BA CE 11 8C 82 00 AA 00 4B A9 0B " +
"02 00 00 00 " + "02 00 00 00 " +
"1D 00 00 00 " + // options: LABEL | PLACE | FILE_OR_URL "1D 00 00 00 " + // options: LABEL | PLACE | FILE_OR_URL
@ -200,9 +204,11 @@ public final class TestHyperlinkRecord {
// textMark: "Sheet1!B6" // textMark: "Sheet1!B6"
"0A 00 00 00 " + "0A 00 00 00 " +
"53 00 68 00 65 00 65 00 74 00 31 00 21 00 42 00 " + "53 00 68 00 65 00 65 00 74 00 31 00 21 00 42 00 " +
"36 00 00 00"); "36 00 00 00"
);
private static final byte[] dataTargetFrame = HexRead.readFromString("0E 00 0E 00 00 00 00 00 " + private static final byte[] dataTargetFrame = HexRead.readFromString(
"0E 00 0E 00 00 00 00 00 " +
"D0 C9 EA 79 F9 BA CE 11 8C 82 00 AA 00 4B A9 0B " + "D0 C9 EA 79 F9 BA CE 11 8C 82 00 AA 00 4B A9 0B " +
"02 00 00 00 " + "02 00 00 00 " +
"83 00 00 00 " + // options: TARGET_FRAME | ABS | FILE_OR_URL "83 00 00 00 " + // options: TARGET_FRAME | ABS | FILE_OR_URL
@ -222,10 +228,12 @@ public final class TestHyperlinkRecord {
"63 00 75 00 72 00 72 00 65 00 6E 00 63 00 79 00 " + "63 00 75 00 72 00 72 00 65 00 6E 00 63 00 79 00 " +
"3D 00 55 00 53 00 44 00 26 00 69 00 74 00 65 00 " + "3D 00 55 00 53 00 44 00 26 00 69 00 74 00 65 00 " +
"6D 00 3D 00 37 00 39 00 32 00 34 00 2D 00 33 00 " + "6D 00 3D 00 37 00 39 00 32 00 34 00 2D 00 33 00 " +
"37 00 00 00"); "37 00 00 00"
);
private static final byte[] dataUNC = HexRead.readFromString("01 00 01 00 01 00 01 00 " + private static final byte[] dataUNC = HexRead.readFromString(
"01 00 01 00 01 00 01 00 " +
"D0 C9 EA 79 F9 BA CE 11 8C 82 00 AA 00 4B A9 0B " + "D0 C9 EA 79 F9 BA CE 11 8C 82 00 AA 00 4B A9 0B " +
"02 00 00 00 " + "02 00 00 00 " +
"1F 01 00 00 " + // options: UNC_PATH | LABEL | TEXT_MARK | ABS | FILE_OR_URL "1F 01 00 00 " + // options: UNC_PATH | LABEL | TEXT_MARK | ABS | FILE_OR_URL
@ -241,7 +249,8 @@ public final class TestHyperlinkRecord {
"0C 00 00 00 " + // textMark: PRODNAME!C2 "0C 00 00 00 " + // textMark: PRODNAME!C2
"50 00 52 00 4F 00 44 00 4E 00 41 00 4D 00 45 00 21 00 " + "50 00 52 00 4F 00 44 00 4E 00 41 00 4D 00 45 00 21 00 " +
"43 00 32 00 00 00"); "43 00 32 00 00 00"
);
/** /**
@ -258,7 +267,8 @@ public final class TestHyperlinkRecord {
0x74, 0x00, 0x65, 0x00, 0x73, 0x00, 0x74, 0x00, 0x66, 0x00, 0x6F, 0x00, 0x74, 0x00, 0x65, 0x00, 0x73, 0x00, 0x74, 0x00, 0x66, 0x00, 0x6F, 0x00,
0x6C, 0x00, 0x64, 0x00, 0x65, 0x00, 0x72, 0x00, 0x2F, 0x00, 0x74, 0x00, 0x6C, 0x00, 0x64, 0x00, 0x65, 0x00, 0x72, 0x00, 0x2F, 0x00, 0x74, 0x00,
0x65, 0x00, 0x73, 0x00, 0x74, 0x00, 0x2E, 0x00, 0x50, 0x00, 0x44, 0x00, 0x65, 0x00, 0x73, 0x00, 0x74, 0x00, 0x2E, 0x00, 0x50, 0x00, 0x44, 0x00,
0x46, 0x00, 0x00, 0x00}; 0x46, 0x00, 0x00, 0x00
};
private void confirmGUID(GUID expectedGuid, GUID actualGuid) { private void confirmGUID(GUID expectedGuid, GUID actualGuid) {

View File

@ -17,28 +17,22 @@
package org.apache.poi.hssf.record; package org.apache.poi.hssf.record;
import static org.junit.Assert.assertArrayEquals; import static org.junit.Assert.*;
import java.io.ByteArrayInputStream; import java.io.ByteArrayInputStream;
import java.io.ByteArrayOutputStream; import java.io.ByteArrayOutputStream;
import java.io.IOException; import java.io.IOException;
import java.io.InputStream; import java.io.InputStream;
import java.util.Iterator;
import java.util.List; import java.util.List;
import junit.framework.AssertionFailedError;
import junit.framework.TestCase;
import org.apache.poi.poifs.filesystem.POIFSFileSystem; import org.apache.poi.poifs.filesystem.POIFSFileSystem;
import org.apache.poi.util.HexRead; import org.apache.poi.util.HexRead;
import org.junit.Test;
/** /**
* Tests the record factory * Tests the record factory
* @author Glen Stampoultzis (glens at apache.org)
* @author Andrew C. Oliver (acoliver at apache dot org)
* @author Csaba Nagy (ncsaba at yahoo dot com)
*/ */
public final class TestRecordFactory extends TestCase { public final class TestRecordFactory {
/** /**
@ -49,6 +43,7 @@ public final class TestRecordFactory extends TestCase {
* FAILURE: The wrong records are creates or contain the wrong values <P> * FAILURE: The wrong records are creates or contain the wrong values <P>
* *
*/ */
@Test
public void testBasicRecordConstruction() { public void testBasicRecordConstruction() {
short recType = BOFRecord.sid; short recType = BOFRecord.sid;
byte[] data = { byte[] data = {
@ -91,6 +86,7 @@ public final class TestRecordFactory extends TestCase {
* FAILURE: The wrong records are created or contain the wrong values <P> * FAILURE: The wrong records are created or contain the wrong values <P>
* *
*/ */
@Test
public void testSpecial() { public void testSpecial() {
short recType = RKRecord.sid; short recType = RKRecord.sid;
byte[] data = { byte[] data = {
@ -117,6 +113,7 @@ public final class TestRecordFactory extends TestCase {
* SUCCESS: Record factory creates the expected records.<P> * SUCCESS: Record factory creates the expected records.<P>
* FAILURE: The wrong records are created or contain the wrong values <P> * FAILURE: The wrong records are created or contain the wrong values <P>
*/ */
@Test
public void testContinuedUnknownRecord() { public void testContinuedUnknownRecord() {
byte[] data = { byte[] data = {
0, -1, 0, 0, // an unknown record with 0 length 0, -1, 0, 0, // an unknown record with 0 length
@ -152,7 +149,8 @@ public final class TestRecordFactory extends TestCase {
* There can actually be OBJ records mixed between the continues. * There can actually be OBJ records mixed between the continues.
* Record factory must preserve this structure when reading records. * Record factory must preserve this structure when reading records.
*/ */
public void testMixedContinue() throws Exception { @Test
public void testMixedContinue() throws IOException {
/** /**
* Adapted from a real test sample file 39512.xls (Offset 0x4854). * Adapted from a real test sample file 39512.xls (Offset 0x4854).
* See Bug 39512 for details. * See Bug 39512 for details.
@ -184,7 +182,7 @@ public final class TestRecordFactory extends TestCase {
"00 00 00 00 00 00 00"; "00 00 00 00 00 00 00";
byte[] data = HexRead.readFromString(dump); byte[] data = HexRead.readFromString(dump);
List records = RecordFactory.createRecords(new ByteArrayInputStream(data)); List<Record> records = RecordFactory.createRecords(new ByteArrayInputStream(data));
assertEquals(5, records.size()); assertEquals(5, records.size());
assertTrue(records.get(0) instanceof ObjRecord); assertTrue(records.get(0) instanceof ObjRecord);
assertTrue(records.get(1) instanceof DrawingRecord); assertTrue(records.get(1) instanceof DrawingRecord);
@ -194,8 +192,7 @@ public final class TestRecordFactory extends TestCase {
//serialize and verify that the serialized data is the same as the original //serialize and verify that the serialized data is the same as the original
ByteArrayOutputStream out = new ByteArrayOutputStream(); ByteArrayOutputStream out = new ByteArrayOutputStream();
for(Iterator it = records.iterator(); it.hasNext(); ){ for(Record rec : records){
Record rec = (Record)it.next();
out.write(rec.serialize()); out.write(rec.serialize());
} }
@ -204,7 +201,8 @@ public final class TestRecordFactory extends TestCase {
assertArrayEquals(data, ser); assertArrayEquals(data, ser);
} }
public void testNonZeroPadding_bug46987() { @Test
public void testNonZeroPadding_bug46987() throws IOException {
Record[] recs = { Record[] recs = {
new BOFRecord(), new BOFRecord(),
new WriteAccessRecord(), // need *something* between BOF and EOF new WriteAccessRecord(), // need *something* between BOF and EOF
@ -231,23 +229,12 @@ public final class TestRecordFactory extends TestCase {
POIFSFileSystem fs = new POIFSFileSystem(); POIFSFileSystem fs = new POIFSFileSystem();
InputStream is;
try {
fs.createDocument(new ByteArrayInputStream(baos.toByteArray()), "dummy"); fs.createDocument(new ByteArrayInputStream(baos.toByteArray()), "dummy");
is = fs.getRoot().createDocumentInputStream("dummy"); InputStream is = fs.getRoot().createDocumentInputStream("dummy");
} catch (IOException e) {
throw new RuntimeException(e);
}
List<Record> outRecs; List<Record> outRecs = RecordFactory.createRecords(is);
try { // Buffer underrun - requested 512 bytes but 192 was available
outRecs = RecordFactory.createRecords(is);
} catch (RuntimeException e) {
if (e.getMessage().equals("Buffer underrun - requested 512 bytes but 192 was available")) {
throw new AssertionFailedError("Identified bug 46987");
}
throw e;
}
assertEquals(5, outRecs.size()); assertEquals(5, outRecs.size());
fs.close();
} }
} }

View File

@ -17,9 +17,10 @@
package org.apache.poi.hssf.usermodel; package org.apache.poi.hssf.usermodel;
import java.util.Iterator; import org.apache.poi.ss.usermodel.Cell;
import org.apache.poi.ss.usermodel.CellType; import org.apache.poi.ss.usermodel.CellType;
import org.apache.poi.ss.usermodel.Row;
import org.apache.poi.ss.usermodel.Sheet;
import junit.framework.TestCase; import junit.framework.TestCase;
@ -68,15 +69,10 @@ public final class TestFormulaEvaluatorDocs extends TestCase {
// Do a full evaluate, as per our docs // Do a full evaluate, as per our docs
// uses evaluateFormulaCell() // uses evaluateFormulaCell()
for(int sheetNum = 0; sheetNum < wb.getNumberOfSheets(); sheetNum++) { for(Sheet sheet : wb) {
HSSFSheet sheet = wb.getSheetAt(sheetNum);
HSSFFormulaEvaluator evaluator = new HSSFFormulaEvaluator(wb); HSSFFormulaEvaluator evaluator = new HSSFFormulaEvaluator(wb);
for(Row r : sheet) {
for(Iterator rit = sheet.rowIterator(); rit.hasNext();) { for(Cell c : r) {
HSSFRow r = (HSSFRow)rit.next();
for(Iterator cit = r.cellIterator(); cit.hasNext();) {
HSSFCell c = (HSSFCell)cit.next();
if(c.getCellTypeEnum() == CellType.FORMULA) { if(c.getCellTypeEnum() == CellType.FORMULA) {
evaluator.evaluateFormulaCellEnum(c); evaluator.evaluateFormulaCellEnum(c);
@ -103,15 +99,11 @@ public final class TestFormulaEvaluatorDocs extends TestCase {
// Now do the alternate call, which zaps the formulas // Now do the alternate call, which zaps the formulas
// uses evaluateInCell() // uses evaluateInCell()
for(int sheetNum = 0; sheetNum < wb.getNumberOfSheets(); sheetNum++) { for(Sheet sheet : wb) {
HSSFSheet sheet = wb.getSheetAt(sheetNum);
HSSFFormulaEvaluator evaluator = new HSSFFormulaEvaluator(wb); HSSFFormulaEvaluator evaluator = new HSSFFormulaEvaluator(wb);
for(Iterator rit = sheet.rowIterator(); rit.hasNext();) { for(Row r : sheet) {
HSSFRow r = (HSSFRow)rit.next(); for(Cell c : r) {
for(Iterator cit = r.cellIterator(); cit.hasNext();) {
HSSFCell c = (HSSFCell)cit.next();
if(c.getCellTypeEnum() == CellType.FORMULA) { if(c.getCellTypeEnum() == CellType.FORMULA) {
evaluator.evaluateInCell(c); evaluator.evaluateInCell(c);
} }

View File

@ -17,24 +17,22 @@
package org.apache.poi.poifs.filesystem; package org.apache.poi.poifs.filesystem;
import java.io.IOException; import static org.junit.Assert.assertArrayEquals;
import static org.junit.Assert.assertEquals;
import java.io.ByteArrayInputStream; import java.io.ByteArrayInputStream;
import java.io.ByteArrayOutputStream; import java.io.ByteArrayOutputStream;
import java.util.Arrays; import java.io.IOException;
import junit.framework.TestCase;
import org.apache.poi.util.IOUtils; import org.apache.poi.util.IOUtils;
import org.apache.poi.poifs.filesystem.POIFSFileSystem;
import org.apache.poi.poifs.filesystem.POIFSWriterEvent;
import org.apache.poi.poifs.filesystem.POIFSWriterListener;
import org.apache.poi.poifs.filesystem.DirectoryEntry;
import org.apache.poi.util.POILogFactory; import org.apache.poi.util.POILogFactory;
import org.apache.poi.util.POILogger; import org.apache.poi.util.POILogger;
import org.junit.Test;
public final class TestEmptyDocument extends TestCase { public final class TestEmptyDocument {
private static POILogger _logger = POILogFactory.getLogger(TestEmptyDocument.class); private static final POILogger LOG = POILogFactory.getLogger(TestEmptyDocument.class);
@Test
public void testSingleEmptyDocument() throws IOException { public void testSingleEmptyDocument() throws IOException {
POIFSFileSystem fs = new POIFSFileSystem(); POIFSFileSystem fs = new POIFSFileSystem();
DirectoryEntry dir = fs.getRoot(); DirectoryEntry dir = fs.getRoot();
@ -42,24 +40,28 @@ public final class TestEmptyDocument extends TestCase {
ByteArrayOutputStream out = new ByteArrayOutputStream(); ByteArrayOutputStream out = new ByteArrayOutputStream();
fs.writeFilesystem(out); fs.writeFilesystem(out);
new POIFSFileSystem(new ByteArrayInputStream(out.toByteArray())); new POIFSFileSystem(new ByteArrayInputStream(out.toByteArray())).close();
fs.close();
} }
@Test
public void testSingleEmptyDocumentEvent() throws IOException { public void testSingleEmptyDocumentEvent() throws IOException {
POIFSFileSystem fs = new POIFSFileSystem(); POIFSFileSystem fs = new POIFSFileSystem();
DirectoryEntry dir = fs.getRoot(); DirectoryEntry dir = fs.getRoot();
dir.createDocument("Foo", 0, new POIFSWriterListener() { dir.createDocument("Foo", 0, new POIFSWriterListener() {
@Override @Override
public void processPOIFSWriterEvent(POIFSWriterEvent event) { public void processPOIFSWriterEvent(POIFSWriterEvent event) {
_logger.log(POILogger.WARN, "written"); LOG.log(POILogger.WARN, "written");
} }
}); });
ByteArrayOutputStream out = new ByteArrayOutputStream(); ByteArrayOutputStream out = new ByteArrayOutputStream();
fs.writeFilesystem(out); fs.writeFilesystem(out);
new POIFSFileSystem(new ByteArrayInputStream(out.toByteArray())); new POIFSFileSystem(new ByteArrayInputStream(out.toByteArray())).close();
fs.close();
} }
@Test
public void testEmptyDocumentWithFriend() throws IOException { public void testEmptyDocumentWithFriend() throws IOException {
POIFSFileSystem fs = new POIFSFileSystem(); POIFSFileSystem fs = new POIFSFileSystem();
DirectoryEntry dir = fs.getRoot(); DirectoryEntry dir = fs.getRoot();
@ -68,9 +70,11 @@ public final class TestEmptyDocument extends TestCase {
ByteArrayOutputStream out = new ByteArrayOutputStream(); ByteArrayOutputStream out = new ByteArrayOutputStream();
fs.writeFilesystem(out); fs.writeFilesystem(out);
new POIFSFileSystem(new ByteArrayInputStream(out.toByteArray())); new POIFSFileSystem(new ByteArrayInputStream(out.toByteArray())).close();
fs.close();
} }
@Test
public void testEmptyDocumentEventWithFriend() throws IOException { public void testEmptyDocumentEventWithFriend() throws IOException {
POIFSFileSystem fs = new POIFSFileSystem(); POIFSFileSystem fs = new POIFSFileSystem();
DirectoryEntry dir = fs.getRoot(); DirectoryEntry dir = fs.getRoot();
@ -92,9 +96,11 @@ public final class TestEmptyDocument extends TestCase {
ByteArrayOutputStream out = new ByteArrayOutputStream(); ByteArrayOutputStream out = new ByteArrayOutputStream();
fs.writeFilesystem(out); fs.writeFilesystem(out);
new POIFSFileSystem(new ByteArrayInputStream(out.toByteArray())); new POIFSFileSystem(new ByteArrayInputStream(out.toByteArray())).close();
fs.close();
} }
@Test
public void testEmptyDocumentBug11744() throws Exception { public void testEmptyDocumentBug11744() throws Exception {
byte[] testData = { 0, 1, 2, 3, 4, 5, 6, 7, 8, 9 }; byte[] testData = { 0, 1, 2, 3, 4, 5, 6, 7, 8, 9 };
@ -104,6 +110,7 @@ public final class TestEmptyDocument extends TestCase {
ByteArrayOutputStream out = new ByteArrayOutputStream(); ByteArrayOutputStream out = new ByteArrayOutputStream();
fs.writeFilesystem(out); fs.writeFilesystem(out);
out.toByteArray(); out.toByteArray();
fs.close();
// This line caused the error. // This line caused the error.
fs = new POIFSFileSystem(new ByteArrayInputStream(out.toByteArray())); fs = new POIFSFileSystem(new ByteArrayInputStream(out.toByteArray()));
@ -117,7 +124,7 @@ public final class TestEmptyDocument extends TestCase {
entry = (DocumentEntry) fs.getRoot().getEntry("NotEmpty"); entry = (DocumentEntry) fs.getRoot().getEntry("NotEmpty");
actualReadbackData = IOUtils.toByteArray(new DocumentInputStream(entry)); actualReadbackData = IOUtils.toByteArray(new DocumentInputStream(entry));
assertEquals("Expected size was wrong", testData.length, entry.getSize()); assertEquals("Expected size was wrong", testData.length, entry.getSize());
assertTrue("Expected different data read from stream", Arrays.equals(testData, assertArrayEquals("Expected same data read from stream", testData, actualReadbackData);
actualReadbackData)); fs.close();
} }
} }