use of com.onesignal.influence.data.OSChannelTracker in project OneSignal-Android-SDK by OneSignal.
the class SessionManagerUnitTests method testDirectNotificationInitInfluence.
@Test
public void testDirectNotificationInitInfluence() throws JSONException {
trackerFactory.saveInfluenceParams(new OneSignalPackagePrivateHelper.RemoteOutcomeParams());
sessionManager.initSessionFromCache();
OSChannelTracker notificationTracker = trackerFactory.getNotificationChannelTracker();
assertEquals(0, notificationTracker.getLastReceivedIds().length());
sessionManager.onNotificationReceived(NOTIFICATION_ID);
sessionManager.onDirectInfluenceFromNotificationOpen(NOTIFICATION_ID);
notificationTracker = trackerFactory.getNotificationChannelTracker();
OSInfluence influence = notificationTracker.getCurrentSessionInfluence();
assertEquals(OSInfluenceType.DIRECT, notificationTracker.getInfluenceType());
assertEquals(NOTIFICATION_ID, notificationTracker.getLastReceivedIds().get(0));
assertEquals(OSInfluenceChannel.NOTIFICATION, influence.getInfluenceChannel());
assertEquals(OSInfluenceType.DIRECT, influence.getInfluenceType());
assertEquals(1, influence.getIds().length());
assertEquals(NOTIFICATION_ID, influence.getIds().get(0));
}
Aggregations