use of com.instagram.common.json.annotation.processor.uut.FormatterUUT in project ig-json-parser by Instagram.
the class DeserializeTest method fieldAssignmentTest.
@Test
public void fieldAssignmentTest() throws IOException, JSONException {
final int encodedValue = 25;
final int deserializedValue = -encodedValue;
StringWriter stringWriter = new StringWriter();
JSONWriter writer = new JSONWriter(stringWriter);
writer.object().key(FormatterUUT.FIELD_ASSIGNMENT_FIELD_NAME).value(encodedValue).endObject();
String inputString = stringWriter.toString();
JsonParser jp = new JsonFactory().createParser(inputString);
jp.nextToken();
FormatterUUT uut = FormatterUUT__JsonHelper.parseFromJson(jp);
assertSame(deserializedValue, uut.getFieldAssignmentFormatter());
}
use of com.instagram.common.json.annotation.processor.uut.FormatterUUT in project ig-json-parser by Instagram.
the class DeserializeTest method valueExtractTest.
@Test
public void valueExtractTest() throws IOException, JSONException {
final int encodedValue = 25;
final int deserializedValue = 40;
StringWriter stringWriter = new StringWriter();
JSONWriter writer = new JSONWriter(stringWriter);
writer.object().key(FormatterUUT.VALUE_FORMATTER_FIELD_NAME).value(encodedValue).endObject();
String inputString = stringWriter.toString();
JsonParser jp = new JsonFactory().createParser(inputString);
jp.nextToken();
FormatterUUT uut = FormatterUUT__JsonHelper.parseFromJson(jp);
assertSame(deserializedValue, uut.getValueFormatter());
}
Aggregations