Search in sources :

Example 1 with GetterUUT

use of com.instagram.common.json.annotation.processor.uut.GetterUUT in project ig-json-parser by Instagram.

the class SerializeTest method serializeWithGetterTest.

@Test
public void serializeWithGetterTest() throws IOException {
    GetterUUT source = new GetterUUT();
    source.intField = 5;
    StringWriter stringWriter = new StringWriter();
    JsonGenerator jsonGenerator = new JsonFactory().createGenerator(stringWriter);
    GetterUUT__JsonHelper.serializeToJson(jsonGenerator, source, true);
    jsonGenerator.close();
    String inputString = stringWriter.toString();
    GetterUUT parsed = GetterUUT__JsonHelper.parseFromJson(inputString);
    assertEquals(10, parsed.intField);
}
Also used : GetterUUT(com.instagram.common.json.annotation.processor.uut.GetterUUT) StringWriter(java.io.StringWriter) JsonFactory(com.fasterxml.jackson.core.JsonFactory) JsonGenerator(com.fasterxml.jackson.core.JsonGenerator) Test(org.junit.Test)

Aggregations

JsonFactory (com.fasterxml.jackson.core.JsonFactory)1 JsonGenerator (com.fasterxml.jackson.core.JsonGenerator)1 GetterUUT (com.instagram.common.json.annotation.processor.uut.GetterUUT)1 StringWriter (java.io.StringWriter)1 Test (org.junit.Test)1