diff --git a/jr-record-test/src/test-jdk17/java/jr/Java17RecordTest.java b/jr-record-test/src/test-jdk17/java/jr/Java17RecordTest.java index 4881b489..6dd2fd68 100644 --- a/jr-record-test/src/test-jdk17/java/jr/Java17RecordTest.java +++ b/jr-record-test/src/test-jdk17/java/jr/Java17RecordTest.java @@ -19,6 +19,9 @@ public class Java17RecordTest extends TestCase public record Cow(String message, Map object) { } + public record WrapperRecord(Cow cow, String hello) { + } + // [jackson-jr#94]: Record serialization public void testJava14RecordSerialization() throws Exception { var expectedString = """ @@ -95,4 +98,17 @@ public void testWhenInsideObject() throws IOException { object = jsonParser.beanFrom(Wrapper.class, jsonNoCow); assertEquals(wrapper, object); } + + public void testNested() throws IOException { + var json = """ + { + "cow": { "message":"MOO"}, + "hello": "world" + } + """; + + var expected = new WrapperRecord(new Cow("MOO", null), "world"); + var object = jsonParser.beanFrom(WrapperRecord.class, json); + assertEquals(expected, object); + } }