Search in sources :

Example 1 with ImportsUUT

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

the class DeserializeTest method importsTest.

@Test
public void importsTest() throws IOException, JSONException {
    final String encodedValue = "test";
    final String deserializedValue = ":test";
    StringWriter stringWriter = new StringWriter();
    JSONWriter writer = new JSONWriter(stringWriter);
    writer.object().key("string_field").value(encodedValue).endObject();
    String inputString = stringWriter.toString();
    JsonParser jp = new JsonFactory().createParser(inputString);
    jp.nextToken();
    ImportsUUT uut = ImportsUUT__JsonHelper.parseFromJson(jp);
    assertEquals(deserializedValue, uut.mStringField);
}
Also used : JSONWriter(org.json.JSONWriter) ExtensibleJSONWriter(com.instagram.common.json.annotation.processor.support.ExtensibleJSONWriter) StringWriter(java.io.StringWriter) JsonFactory(com.fasterxml.jackson.core.JsonFactory) ImportsUUT(com.instagram.common.json.annotation.processor.uut.ImportsUUT) TypeFormatterImportsUUT(com.instagram.common.json.annotation.processor.parent.TypeFormatterImportsUUT) 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 TypeFormatterImportsUUT (com.instagram.common.json.annotation.processor.parent.TypeFormatterImportsUUT)1 ExtensibleJSONWriter (com.instagram.common.json.annotation.processor.support.ExtensibleJSONWriter)1 ImportsUUT (com.instagram.common.json.annotation.processor.uut.ImportsUUT)1 StringWriter (java.io.StringWriter)1 JSONWriter (org.json.JSONWriter)1 Test (org.junit.Test)1