Added a test for deserialization of fields using lowercase-dot naming policy (#1303)

This commit is contained in:
inder123 2018-04-27 18:54:48 -07:00 committed by GitHub
parent ab35f11077
commit 1b28ff3cda
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -70,6 +70,12 @@ public class NamingPolicyTest extends TestCase {
+ target.someConstantStringInstanceField + "\"}", gson.toJson(target));
}
public void testGsonWithLowerCaseDotPolicyDeserialiation() {
Gson gson = builder.setFieldNamingPolicy(FieldNamingPolicy.LOWER_CASE_WITH_DOTS).create();
String target = "{\"some.constant.string.instance.field\":\"someValue\"}";
StringWrapper deserializedObject = gson.fromJson(target, StringWrapper.class);
assertEquals("someValue", deserializedObject.someConstantStringInstanceField);
}
public void testGsonWithLowerCaseDashPolicyDeserialiation() {
Gson gson = builder.setFieldNamingPolicy(FieldNamingPolicy.LOWER_CASE_WITH_DASHES).create();