Search in sources :

Example 1 with CustomParseContainerUUT

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

the class DeserializeTest method testCustomParse.

@Test
public void testCustomParse() throws Exception {
    String value = "hey there";
    StringWriter stringWriter = new StringWriter();
    ExtensibleJSONWriter writer = new ExtensibleJSONWriter(stringWriter);
    writer.object().key(CustomParseContainerUUT.INNER_FIELD_NAME).object().key(CustomParseContainerUUT.CustomParseUUT.STRING_FIELD_NAME).value(value).endObject().endObject();
    String inputString = stringWriter.toString();
    JsonParser jp = new JsonFactory().createParser(inputString);
    jp.nextToken();
    CustomParseContainerUUT uut = CustomParseContainerUUT__JsonHelper.parseFromJson(jp);
    assertEquals(value, uut.getCustomParseUUT().getStringField());
}
Also used : CustomParseContainerUUT(com.instagram.common.json.annotation.processor.uut.CustomParseContainerUUT) StringWriter(java.io.StringWriter) ExtensibleJSONWriter(com.instagram.common.json.annotation.processor.support.ExtensibleJSONWriter) 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 CustomParseContainerUUT (com.instagram.common.json.annotation.processor.uut.CustomParseContainerUUT)1 StringWriter (java.io.StringWriter)1 Test (org.junit.Test)1