diff --git a/samples/client/petstore/java/okhttp-gson/src/test/java/org/openapitools/client/JSONTest.java b/samples/client/petstore/java/okhttp-gson/src/test/java/org/openapitools/client/JSONTest.java index 765e7b71c77a9..ece7f392b31bb 100644 --- a/samples/client/petstore/java/okhttp-gson/src/test/java/org/openapitools/client/JSONTest.java +++ b/samples/client/petstore/java/okhttp-gson/src/test/java/org/openapitools/client/JSONTest.java @@ -671,4 +671,13 @@ public void testOneOfAnyOfArray() throws Exception { assertTrue(exception.getMessage().contains("java.io.IOException: The JSON string is invalid for")); } } + + @Test + public void testRequiredNullableBody() throws Exception { + 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}"; + final RequiredNullableBody body = new RequiredNullableBody(); + + assertEquals("{\"array_items_nullable\":[],\"object_items_nullable\":{}}", json.serialize(body)); + assertEquals(json.deserialize(json1, RequiredNullableBody.class), body); + } }