From 17f8e7dc22ebf6edd530b8e18b0c7976be532a70 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tomasz=20Gaw=C4=99da?= Date: Thu, 27 Jun 2024 18:47:09 +0200 Subject: [PATCH] Nested test --- .../src/test-jdk17/java/jr/Java17RecordTest.java | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) 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); + } }