Skip to content

Commit

Permalink
UT for Hessian2Input.readObject()
Browse files Browse the repository at this point in the history
  • Loading branch information
泓诚 committed Dec 19, 2024
1 parent 937d1e1 commit e284829
Showing 1 changed file with 12 additions and 4 deletions.
16 changes: 12 additions & 4 deletions src/test/java/com/caucho/hessian/io/Hessian2InputTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -11,12 +11,20 @@ public class Hessian2InputTest {

SerializerFactory serializerFactory = new SerializerFactory();

int[] sizeList = new int[] {
0, 2, 16, 512, 1024,
0x8000, 0x8000 + 1,
64 * 1024, 64 * 1024 * 1024
};

@Test
public void testSerialize() {
byte[] originBytes = generateLargeByteArray(64 * 1024);
byte[] encodeBytes = hessianEncodeByte(originBytes);
byte[] decodeBytes = hessianDecodeByte(encodeBytes);
Assert.assertArrayEquals(originBytes, decodeBytes);
for (int i = 0; i < sizeList.length; i++) {
byte[] originBytes = generateLargeByteArray(sizeList[i]);
byte[] encodeBytes = hessianEncodeByte(originBytes);
byte[] decodeBytes = hessianDecodeByte(encodeBytes);
Assert.assertArrayEquals(originBytes, decodeBytes);
}
}

@Test
Expand Down

0 comments on commit e284829

Please sign in to comment.