@@ -0,0 +1,1893 @@
+package com.stripe.model;%0A%0Aimport com.google.gson.Gson;%0Aimport com.stripe.BaseStripeTest;%0Aimport com.stripe.net.APIResource;%0Aimport org.junit.Test;%0A%0Aimport java.io.IOException;%0Aimport java.util.HashMap;%0Aimport java.util.Map;%0A%0Aimport com.google.gson.reflect.TypeToken;%0A%0Aimport static org.junit.Assert.assertFalse;%0Aimport static org.junit.Assert.assertEquals;%0Aimport static org.junit.Assert.assertNull;%0A%0Apublic class ExpandableFieldDeserializerTest extends BaseStripeTest %7B%0A%0A%09private static Gson gson = APIResource.GSON;%0A%0A%09private class TestObject %7B%0A%09%09String id;%0A%09%09int bar;%0A%09%7D%0A%0A%09@Test%0A%09public void deserializeNull() throws IOException %7B%0A%09%09String json = gson.toJson(null);%0A%09%09//Gson also uses TypeTokens internally to get around Type Erasure for generic types, simulate that here:%0A%09%09ExpandableField out = gson.fromJson(json, new TypeToken%3CExpandableField%3CTestObject%3E%3E() %7B%7D.getType());%0A%09%09assertNull(out);%0A%09%7D%0A%0A%09@Test%0A%09public void deserializeString() throws IOException %7B%0A%09%09String json = gson.toJson(%22just_an_id%22);%0A%09%09//Gson also uses TypeTokens internally to get around Type Erasure for generic types, simulate that here:%0A%09%09ExpandableField out = gson.fromJson(json, new TypeToken%3CExpandableField%3CTestObject%3E%3E() %7B%7D.getType());%0A%09%09assertEquals(out.getId(), %22just_an_id%22);%0A%09%09assertFalse(out.isExpanded());%0A%09%7D%0A%0A%09@Test%0A%09public void deserializeObject() throws IOException %7B%0A%09%09Map%3CString, Object%3E anObject = new HashMap%3CString, Object%3E();%0A%09%09anObject.put(%22id%22, %22an_id_here%22);%0A%09%09anObject.put(%22bar%22, 12);%0A%09%09String json = gson.toJson(anObject);%0A%0A%09%09//Gson also uses TypeTokens internally to get around Type Erasure for generic types, simulate that here:%0A%09%09ExpandableField%3CTestObject%3E out = gson.fromJson(json, new TypeToken%3CExpandableField%3CTestObject%3E%3E() %7B%7D.getType());%0A%09%09assertEquals(out.getId(), %22an_id_here%22);%0A%09%09assertEquals(out.getExpanded().id, %22an_id_here%22);%0A%09%09assertEquals(out.getExpanded().bar, 12);%0A%09%7D%0A%7D%0A

Add ExpandableFieldDeserializerTest