I have an auto-generated avro schema java class
public class Event extends org.apache.avro.specific.SpecificRecordBase implements org.apache.avro.specific.SpecificRecord {
...
}
In my test file, I have a sample string:
private static final String EVENT = "{\"id\": 1, \"name\": \"test\", \"date_created\": 1476644746, \"date_updated\": \"1476644746\", \"content_type\": \"string\", \"content\": \"test\"}"
If my Event was a simple Object, I could initialize it as:
ObjectMapper mapper = new ObjectMapper();
Event event = mapper.readValues(EVENT, Event.class);
But this does not work when I have an avro schema. How do I parse this string into an Event so I can test against it?
Aucun commentaire:
Enregistrer un commentaire