use of com.microsoft.appcenter.push.ingestion.models.json.PushInstallationLogFactory in project mobile-center-sdk-android by Microsoft.
the class PushSerializerTest method serialize.
@Test
public void serialize() throws JSONException {
LogContainer expectedContainer = new LogContainer();
List<Log> logs = new ArrayList<>();
{
PushInstallationLog log = new PushInstallationLog();
log.setTimestamp(new Date());
log.setPushToken("TEST");
logs.add(log);
}
expectedContainer.setLogs(logs);
UUID sid = UUIDUtils.randomUUID();
for (Log log : logs) {
log.setSid(sid);
}
LogSerializer serializer = new DefaultLogSerializer();
serializer.addLogFactory(PushInstallationLog.TYPE, new PushInstallationLogFactory());
String payload = serializer.serializeContainer(expectedContainer);
LogContainer actualContainer = serializer.deserializeContainer(payload);
Assert.assertEquals(expectedContainer, actualContainer);
}
Aggregations