Search in sources :

Example 1 with AlternateFieldUUT

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

the class DeserializeTest method testAlternateFieldNameHelper.

private void testAlternateFieldNameHelper(String fieldName, String value) throws Exception {
    StringWriter stringWriter = new StringWriter();
    ExtensibleJSONWriter writer = new ExtensibleJSONWriter(stringWriter);
    writer.object().key(fieldName).value(value).endObject();
    String inputString = stringWriter.toString();
    JsonParser jp = new JsonFactory().createParser(inputString);
    jp.nextToken();
    AlternateFieldUUT uut = AlternateFieldUUT__JsonHelper.parseFromJson(jp);
    assertEquals(value, uut.getNameField());
}
Also used : StringWriter(java.io.StringWriter) ExtensibleJSONWriter(com.instagram.common.json.annotation.processor.support.ExtensibleJSONWriter) JsonFactory(com.fasterxml.jackson.core.JsonFactory) AlternateFieldUUT(com.instagram.common.json.annotation.processor.uut.AlternateFieldUUT) JsonParser(com.fasterxml.jackson.core.JsonParser)

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 AlternateFieldUUT (com.instagram.common.json.annotation.processor.uut.AlternateFieldUUT)1 StringWriter (java.io.StringWriter)1