add tests for array of number in java okhttp client (#16298)

This commit is contained in:
William Cheng 2023-08-10 23:37:12 +08:00 committed by GitHub
parent e8160d8d7d
commit 3ad3cf7dd9
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -775,4 +775,20 @@ public class JSONTest {
ScalarAnyOf s = json.getGson().fromJson(str, ScalarAnyOf.class);
});
}
/**
* Test array of number in a model's property
*/
@Test
public void testArrayOfNumber() throws Exception {
// no exception should be thrown
String str = "{\"ArrayNumber\": null}";
ArrayOfNumberOnly s = json.getGson().fromJson(str, ArrayOfNumberOnly.class);
str = "{}";
s = json.getGson().fromJson(str, ArrayOfNumberOnly.class);
str = "{\"ArrayNumber\": [1,2,3]}";
s = json.getGson().fromJson(str, ArrayOfNumberOnly.class);
}
}