T - the type under testpublic class GsonTester<T> extends AbstractJsonMarshalTester<T>
initFields(Object, Gson), for example: 
 public class ExampleObjectJsonTests {
     private GsonTester<ExampleObject> json;
     @Before
     public void setup() {
         Gson gson = new GsonBuilder().create();
         GsonTester.initFields(this, gson);
     }
     @Test
     public void testWriteJson() throws IOException {
         ExampleObject object = //...
         assertThat(json.write(object)).isEqualToJson("expected.json");
     }
 }
 
 See AbstractJsonMarshalTester for more details.AbstractJsonMarshalTester.FieldInitializer<M>| Modifier | Constructor and Description | 
|---|---|
|   | GsonTester(Class<?> resourceLoadClass,
          ResolvableType type,
          com.google.gson.Gson gson)Create a new  GsonTesterinstance. | 
| protected  | GsonTester(com.google.gson.Gson gson)Create a new uninitialized  GsonTesterinstance. | 
| Modifier and Type | Method and Description | 
|---|---|
| static void | initFields(Object testInstance,
          com.google.gson.Gson gson)Utility method to initialize  GsonTesterfields. | 
| static void | initFields(Object testInstance,
          ObjectFactory<com.google.gson.Gson> gson)Utility method to initialize  GsonTesterfields. | 
| protected T | readObject(Reader reader,
          ResolvableType type)Read from the specified reader to create an object of the specified type. | 
| protected String | writeObject(T value,
           ResolvableType type)Write the specified object to a JSON string. | 
getResourceLoadClass, getType, initialize, parse, parse, parseObject, parseObject, read, read, read, read, read, readObject, readObject, readObject, readObject, readObject, readObject, writeprotected GsonTester(com.google.gson.Gson gson)
GsonTester instance.gson - the Gson instancepublic GsonTester(Class<?> resourceLoadClass, ResolvableType type, com.google.gson.Gson gson)
GsonTester instance.resourceLoadClass - the source class used to load resourcestype - the type under testgson - the Gson instanceinitFields(Object, Gson)protected String writeObject(T value, ResolvableType type) throws IOException
AbstractJsonMarshalTesterwriteObject in class AbstractJsonMarshalTester<T>value - the source value (never null)type - the resulting type (never null)IOException - on write errorprotected T readObject(Reader reader, ResolvableType type) throws IOException
AbstractJsonMarshalTesterreadObject in class AbstractJsonMarshalTester<T>reader - the source reader (never null)type - the resulting type (never null)IOException - on read errorpublic static void initFields(Object testInstance, com.google.gson.Gson gson)
GsonTester fields. See class-level documentation for example usage.testInstance - the test instancegson - the Gson instancepublic static void initFields(Object testInstance, ObjectFactory<com.google.gson.Gson> gson)
GsonTester fields. See class-level documentation for example usage.testInstance - the test instancegson - an object factory to create the Gson instanceCopyright © 2018 Pivotal Software, Inc.. All rights reserved.