convert from junit3 to junit4

git-svn-id: https://svn.apache.org/repos/asf/poi/trunk@1783360 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Javen O'Neal 2017-02-17 09:37:00 +00:00
parent ee6677ee56
commit 85a30f16cf

View File

@ -18,21 +18,20 @@
package org.apache.poi.hssf.record;
import static org.junit.Assert.assertArrayEquals;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertTrue;
import static org.junit.Assert.fail;
import java.util.List;
import junit.framework.AssertionFailedError;
import junit.framework.TestCase;
import org.apache.poi.util.HexRead;
import org.junit.Test;
/**
* Tests the serialization and deserialization of the ObjRecord class works correctly.
* Test data taken directly from a real Excel file.
*
* @author Yegor Kozlov
*/
public final class TestObjRecord extends TestCase {
public final class TestObjRecord {
/**
* OBJ record data containing two sub-records.
* The data taken directly from a real Excel file.
@ -58,6 +57,7 @@ public final class TestObjRecord extends TestCase {
+ "15 00 12 00 00 00 01 00 11 60 00 00 00 00 38 6F CC 03 00 00 00 00 06 00 02 00 00 00 00 00 00 00"
);
@Test
public void testLoad() {
ObjRecord record = new ObjRecord(TestcaseRecordInputStream.create(ObjRecord.sid, recdata));
@ -70,6 +70,7 @@ public final class TestObjRecord extends TestCase {
}
@Test
public void testStore() {
ObjRecord record = new ObjRecord(TestcaseRecordInputStream.create(ObjRecord.sid, recdata));
@ -80,6 +81,7 @@ public final class TestObjRecord extends TestCase {
assertArrayEquals(recdata, subData);
}
@Test
public void testConstruct() {
ObjRecord record = new ObjRecord();
CommonObjectDataSubRecord ftCmo = new CommonObjectDataSubRecord();
@ -106,11 +108,12 @@ public final class TestObjRecord extends TestCase {
assertTrue( subrecords.get(1) instanceof EndSubRecord );
}
@Test
public void testReadWriteWithPadding_bug45133() {
ObjRecord record = new ObjRecord(TestcaseRecordInputStream.create(recdataNeedingPadding));
if (record.getRecordSize() == 34) {
throw new AssertionFailedError("Identified bug 45133");
fail("Identified bug 45133");
}
assertEquals(36, record.getRecordSize());
@ -126,6 +129,7 @@ public final class TestObjRecord extends TestCase {
* Check that ObjRecord tolerates and preserves padding to a 4-byte boundary
* (normally padding is to a 2-byte boundary).
*/
@Test
public void test4BytePadding() {
// actual data from file saved by Excel 2007
byte[] data = HexRead.readFromString(""