use of com.instagram.common.json.annotation.processor.uut.EnumUUT in project ig-json-parser by Instagram.
the class DeserializeTest method enumTest.
@Test
public void enumTest() throws IOException, JSONException {
final EnumUUT.EnumType value = EnumUUT.EnumType.VALUE2;
StringWriter stringWriter = new StringWriter();
JSONWriter writer = new JSONWriter(stringWriter);
writer.object().key(EnumUUT.ENUM_FIELD_NAME).value(value.toString()).endObject();
String inputString = stringWriter.toString();
JsonParser jp = new JsonFactory().createParser(inputString);
jp.nextToken();
EnumUUT uut = EnumUUT__JsonHelper.parseFromJson(jp);
assertSame(value, uut.enumField);
}
use of com.instagram.common.json.annotation.processor.uut.EnumUUT in project ig-json-parser by Instagram.
the class SerializeTest method enumTest.
@Test
public void enumTest() throws IOException {
final EnumUUT.EnumType value = EnumUUT.EnumType.VALUE3;
EnumUUT source = new EnumUUT();
source.enumField = value;
String serialized = EnumUUT__JsonHelper.serializeToJson(source);
EnumUUT parsed = EnumUUT__JsonHelper.parseFromJson(serialized);
assertSame(source.enumField, parsed.enumField);
}
Aggregations