Skip to content

Commit 0de51eb

Browse files
committed
[Java] add JSONTest fro RequiredNullableBody class
1 parent ee239bf commit 0de51eb

1 file changed

Lines changed: 9 additions & 0 deletions

File tree

  • samples/client/petstore/java/okhttp-gson/src/test/java/org/openapitools/client

samples/client/petstore/java/okhttp-gson/src/test/java/org/openapitools/client/JSONTest.java

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -671,4 +671,13 @@ public void testOneOfAnyOfArray() throws Exception {
671671
assertTrue(exception.getMessage().contains("java.io.IOException: The JSON string is invalid for"));
672672
}
673673
}
674+
675+
@Test
676+
public void testRequiredNullableBody() throws Exception {
677+
final String json1 = "{\"integer_prop\":null,\"number_prop\":null,\"boolean_prop\":null,\"string_prop\":null,\"date_prop\":null,\"datetime_prop\":null,\"array_nullable_prop\":null,\"array_and_items_nullable_prop\":null,\"array_items_nullable\":[],\"object_nullable_prop\":null,\"object_and_items_nullable_prop\":null,\"object_items_nullable\":{},\"custom_ref_enum\":null,\"custom_enum\":null}";
678+
final RequiredNullableBody body = new RequiredNullableBody();
679+
680+
assertEquals("{\"array_items_nullable\":[],\"object_items_nullable\":{}}", json.serialize(body));
681+
assertEquals(json.deserialize(json1, RequiredNullableBody.class), body);
682+
}
674683
}

0 commit comments

Comments
 (0)