-
Notifications
You must be signed in to change notification settings - Fork 11
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feature(JavaSerializationTest): Add JavaSerializationTest
- Loading branch information
1 parent
2a6ed3b
commit 763afd8
Showing
3 changed files
with
46 additions
and
4 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
31 changes: 31 additions & 0 deletions
31
...ation-test/src/test/java/com/brucepang/prpc/test/javaserialize/JavaSerializationTest.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
package com.brucepang.prpc.test.javaserialize; | ||
|
||
import com.brucepang.prpc.common.serialize.JavaSerialization; | ||
import com.brucepang.prpc.util.Assert; | ||
import org.junit.Test; | ||
|
||
import java.io.IOException; | ||
|
||
/** | ||
* Java serialization test | ||
*/ | ||
public class JavaSerializationTest { | ||
|
||
|
||
@Test | ||
public void testSerialization() throws IOException, ClassNotFoundException { | ||
JavaSerialization javaSerialization = new JavaSerialization(); | ||
|
||
// Test object to serialize | ||
String testString = "Hello, World!"; | ||
|
||
// Serialize the object | ||
byte[] serializedData = javaSerialization.serialize(testString); | ||
|
||
// Deserialize the object | ||
String deserializedString = javaSerialization.deserialize(serializedData, String.class); | ||
|
||
// Check if the original object and the deserialized object are equal | ||
Assert.assertEquals(testString, deserializedString); | ||
} | ||
} |