Search in sources :

Example 1 with PostprocessingUUT

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

the class DeserializeTest method postprocessTest.

@Test
public void postprocessTest() throws IOException, JSONException {
    final int value = 25;
    StringWriter stringWriter = new StringWriter();
    JSONWriter writer = new JSONWriter(stringWriter);
    writer.object().key(PostprocessingUUT.FIELD_NAME).value(value).endObject();
    String inputString = stringWriter.toString();
    JsonParser jp = new JsonFactory().createParser(inputString);
    jp.nextToken();
    PostprocessingUUT uut = PostprocessingUUT__JsonHelper.parseFromJson(jp);
    assertSame(value + 1, uut.getValue());
}
Also used : JSONWriter(org.json.JSONWriter) ExtensibleJSONWriter(com.instagram.common.json.annotation.processor.support.ExtensibleJSONWriter) PostprocessingUUT(com.instagram.common.json.annotation.processor.uut.PostprocessingUUT) StringWriter(java.io.StringWriter) JsonFactory(com.fasterxml.jackson.core.JsonFactory) JsonParser(com.fasterxml.jackson.core.JsonParser) Test(org.junit.Test)

Aggregations

JsonFactory (com.fasterxml.jackson.core.JsonFactory)1 JsonParser (com.fasterxml.jackson.core.JsonParser)1 ExtensibleJSONWriter (com.instagram.common.json.annotation.processor.support.ExtensibleJSONWriter)1 PostprocessingUUT (com.instagram.common.json.annotation.processor.uut.PostprocessingUUT)1 StringWriter (java.io.StringWriter)1 JSONWriter (org.json.JSONWriter)1 Test (org.junit.Test)1