Skip to content
This repository has been archived by the owner. It is now read-only.
Permalink
Browse files
8248326: Add a minimal serialization test for local records
Reviewed-by: dfuchs
  • Loading branch information
ChrisHegarty committed Jun 26, 2020
1 parent 57b792c commit c0c4a8d7383e2315061d4afc9a76ff956ed061fa
Showing 1 changed file with 14 additions and 0 deletions.
@@ -132,6 +132,20 @@ public void testSerializable(Object objToSerialize) throws Exception {
assertEquals(objDeserialized, objToSerialize);
}

/** Tests serializing and deserializing of local records. */
@Test
public void testLocalRecord() throws Exception {
out.println("\n---");
record Point(int x, int y) implements Serializable { }
record Rectangle(Point bottomLeft, Point topRight) implements Serializable { }
var objToSerialize = new Rectangle(new Point(0, 1), new Point (5, 6));
out.println("serializing : " + objToSerialize);
var objDeserialized = serializeDeserialize(objToSerialize);
out.println("deserialized: " + objDeserialized);
assertEquals(objToSerialize, objDeserialized);
assertEquals(objDeserialized, objToSerialize);
}

/** Tests back references of Serializable record objects in the stream. */
@Test
public void testSerializableBackRefs() throws Exception {

0 comments on commit c0c4a8d

Please sign in to comment.