Skip to content

Commit 1ea7bf3

Browse files
fanqiewanziMarcel Jacek
authored andcommitted
[Java] add JSONTest fro RequiredNullableBody class
1 parent b3d8ebc commit 1ea7bf3

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
@@ -674,6 +674,15 @@ public void testOneOfAnyOfArray() throws Exception {
674674
}
675675
}
676676

677+
@Test
678+
public void testRequiredNullableBody() throws Exception {
679+
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}";
680+
final RequiredNullableBody body = new RequiredNullableBody();
681+
682+
assertEquals("{\"array_items_nullable\":[],\"object_items_nullable\":{}}", json.serialize(body));
683+
assertEquals(json.deserialize(json1, RequiredNullableBody.class), body);
684+
}
685+
677686
@Test
678687
public void testDeserializeInputStream() throws Exception {
679688
final String str = "\"2016-09-09\"";

0 commit comments

Comments
 (0)