use of com.microsoft.appcenter.distribute.ingestion.models.json.DistributionStartSessionLogFactory in project mobile-center-sdk-android by Microsoft.
the class DistributeSerializerTest method serialize.
@Test
public void serialize() throws JSONException {
LogContainer expectedContainer = new LogContainer();
List<Log> logs = new ArrayList<>();
{
DistributionStartSessionLog log = new DistributionStartSessionLog();
log.setTimestamp(new Date());
logs.add(log);
}
expectedContainer.setLogs(logs);
UUID sid = UUIDUtils.randomUUID();
for (Log log : logs) {
log.setSid(sid);
}
/* Serialize and deserialize logs container. */
LogSerializer serializer = new DefaultLogSerializer();
serializer.addLogFactory(DistributionStartSessionLog.TYPE, new DistributionStartSessionLogFactory());
String payload = serializer.serializeContainer(expectedContainer);
LogContainer actualContainer = serializer.deserializeContainer(payload);
/* Verify that logs container successfully deserialized. */
Assert.assertEquals(expectedContainer, actualContainer);
}
Aggregations