use of com.onesignal.outcomes.domain.OSOutcomeEventParams in project OneSignal-Android-SDK by OneSignal.
the class OutcomeEventV2UnitTests method testOutcomeIndirectFailSavedOnDB.
@Test
public void testOutcomeIndirectFailSavedOnDB() throws Exception {
service.setSuccess(false);
sessionManager.initSessionFromCache();
sessionManager.onInAppMessageReceived(IAM_ID);
sessionManager.onNotificationReceived(NOTIFICATION_ID);
sessionManager.restartSessionIfNeeded(OneSignal.AppEntryAction.APP_OPEN);
controller.sendOutcomeEvent(OUTCOME_NAME);
threadAndTaskWait();
handler.setOutcomes(repository.getSavedOutcomeEvents());
threadAndTaskWait();
assertTrue(outcomeEvents.size() > 0);
OSOutcomeEventParams params = outcomeEvents.get(0);
assertEquals(OUTCOME_NAME, params.getOutcomeId());
assertEquals(new Float(0), (Float) params.getWeight());
assertTrue(params.getTimestamp() > 0);
assertNotNull(params.getOutcomeSource());
// Indirect body
assertEquals(1, params.getOutcomeSource().getIndirectBody().getInAppMessagesIds().length());
assertEquals(IAM_ID, params.getOutcomeSource().getIndirectBody().getInAppMessagesIds().get(0));
assertEquals(1, params.getOutcomeSource().getIndirectBody().getNotificationIds().length());
assertEquals(NOTIFICATION_ID, params.getOutcomeSource().getIndirectBody().getNotificationIds().get(0));
// Direct body
assertNull(params.getOutcomeSource().getDirectBody());
}
Aggregations