Skip to content
This repository has been archived by the owner on Jul 16, 2024. It is now read-only.

Commit

Permalink
add testEncodeInteger
Browse files Browse the repository at this point in the history
  • Loading branch information
linux-china committed Jul 25, 2020
1 parent 8001c85 commit 605a2dc
Showing 1 changed file with 11 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

import com.caucho.hessian.io.HessianSerializerInput;
import com.caucho.hessian.io.HessianSerializerOutput;
import org.junit.jupiter.api.Assertions;
import org.junit.jupiter.api.Test;

import java.io.ByteArrayInputStream;
Expand All @@ -26,6 +27,16 @@ public void testEncode() throws Exception {
System.out.println(content.length);
}

@Test
public void testEncodeInteger() throws Exception {
ByteArrayOutputStream bos = new ByteArrayOutputStream();
HessianSerializerOutput output = new HessianSerializerOutput(bos);
output.writeObject(1);
output.flush();
content = bos.toByteArray();
Assertions.assertEquals(content[0], -111);
}

@Test
public void testDecode() throws Exception {
testEncode();
Expand Down

0 comments on commit 605a2dc

Please sign in to comment.