Skip to content

Commit

Permalink
Nested test
Browse files Browse the repository at this point in the history
  • Loading branch information
TomaszGaweda committed Jun 27, 2024
1 parent 65071f5 commit 17f8e7d
Showing 1 changed file with 16 additions and 0 deletions.
16 changes: 16 additions & 0 deletions jr-record-test/src/test-jdk17/java/jr/Java17RecordTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,9 @@ public class Java17RecordTest extends TestCase
public record Cow(String message, Map<String, String> object) {
}

public record WrapperRecord(Cow cow, String hello) {
}

// [jackson-jr#94]: Record serialization
public void testJava14RecordSerialization() throws Exception {
var expectedString = """
Expand Down Expand Up @@ -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);
}
}

0 comments on commit 17f8e7d

Please sign in to comment.