Search in sources :

Example 11 with MockOSTimeImpl

use of com.onesignal.MockOSTimeImpl in project OneSignal-Android-SDK by OneSignal.

the class OutcomeEventUnitTests method beforeEachTest.

// Before each test
@Before
public void beforeEachTest() throws Exception {
    outcomeEvents = null;
    MockOSTimeImpl time = new MockOSTimeImpl();
    dbHelper = new MockOneSignalDBHelper(ApplicationProvider.getApplicationContext());
    // Mock on a custom HashMap in order to not use custom context
    preferences = new MockOSSharedPreferences();
    trackerFactory = new OSTrackerFactory(preferences, logWrapper, time);
    sessionManager = new MockSessionManager(sessionListener, trackerFactory, logWrapper);
    service = new MockOneSignalAPIClient();
    OSOutcomeEventsFactory factory = new OSOutcomeEventsFactory(logWrapper, service, dbHelper, preferences);
    controller = new MockOutcomeEventsController(sessionManager, factory);
    TestHelpers.beforeTestInitAndCleanup();
    repository = factory.getRepository();
    trackerFactory.saveInfluenceParams(new OneSignalPackagePrivateHelper.RemoteOutcomeParams());
    OneSignal.setAppId(APP_ID);
}
Also used : OSTrackerFactory(com.onesignal.influence.data.OSTrackerFactory) MockOneSignalDBHelper(com.onesignal.MockOneSignalDBHelper) MockOSTimeImpl(com.onesignal.MockOSTimeImpl) MockSessionManager(com.onesignal.MockSessionManager) MockOSSharedPreferences(com.onesignal.MockOSSharedPreferences) MockOneSignalAPIClient(com.onesignal.MockOneSignalAPIClient) OSOutcomeEventsFactory(com.onesignal.outcomes.data.OSOutcomeEventsFactory) MockOutcomeEventsController(com.onesignal.MockOutcomeEventsController) OneSignalPackagePrivateHelper(com.onesignal.OneSignalPackagePrivateHelper) Before(org.junit.Before)

Example 12 with MockOSTimeImpl

use of com.onesignal.MockOSTimeImpl in project OneSignal-Android-SDK by OneSignal.

the class InAppMessageIntegrationTests method beforeEachTest.

@Before
public void beforeEachTest() throws Exception {
    ShadowDynamicTimer.shouldScheduleTimers = true;
    time = new MockOSTimeImpl();
    preferences = new MockOSSharedPreferences();
    trackerFactory = new OSTrackerFactory(preferences, new MockOSLog(), time);
    sessionManager = new MockSessionManager(OneSignal_getSessionListener(), trackerFactory, new MockOSLog());
    blankActivityController = Robolectric.buildActivity(BlankActivity.class).create();
    blankActivity = blankActivityController.get();
    dbHelper = new MockOneSignalDBHelper(ApplicationProvider.getApplicationContext());
    TestHelpers.beforeTestInitAndCleanup();
    // Set remote_params GET response
    setRemoteParamsGetHtmlResponse();
}
Also used : MockOSLog(com.onesignal.MockOSLog) OSTrackerFactory(com.onesignal.influence.data.OSTrackerFactory) MockOneSignalDBHelper(com.onesignal.MockOneSignalDBHelper) MockOSTimeImpl(com.onesignal.MockOSTimeImpl) MockSessionManager(com.onesignal.MockSessionManager) MockOSSharedPreferences(com.onesignal.MockOSSharedPreferences) Before(org.junit.Before)

Example 13 with MockOSTimeImpl

use of com.onesignal.MockOSTimeImpl in project OneSignal-Android-SDK by OneSignal.

the class SynchronizerIntegrationTests method beforeEachTest.

@Before
public void beforeEachTest() throws Exception {
    blankActivityController = Robolectric.buildActivity(BlankActivity.class).create();
    blankActivity = blankActivityController.get();
    time = new MockOSTimeImpl();
    trackerFactory = new OSTrackerFactory(new MockOSSharedPreferences(), new MockOSLog(), time);
    sessionManager = new MockSessionManager(OneSignal_getSessionListener(), trackerFactory, new MockOSLog());
    dbHelper = new MockOneSignalDBHelper(ApplicationProvider.getApplicationContext());
    TestHelpers.setupTestWorkManager(blankActivity);
    cleanUp();
    OneSignal_setTime(time);
}
Also used : MockOSLog(com.onesignal.MockOSLog) OSTrackerFactory(com.onesignal.influence.data.OSTrackerFactory) MockOneSignalDBHelper(com.onesignal.MockOneSignalDBHelper) MockOSTimeImpl(com.onesignal.MockOSTimeImpl) MockSessionManager(com.onesignal.MockSessionManager) MockOSSharedPreferences(com.onesignal.MockOSSharedPreferences) Before(org.junit.Before)

Aggregations

MockOSTimeImpl (com.onesignal.MockOSTimeImpl)13 Before (org.junit.Before)12 OSTrackerFactory (com.onesignal.influence.data.OSTrackerFactory)9 MockOSSharedPreferences (com.onesignal.MockOSSharedPreferences)8 MockOneSignalDBHelper (com.onesignal.MockOneSignalDBHelper)8 MockSessionManager (com.onesignal.MockSessionManager)8 MockOSLog (com.onesignal.MockOSLog)6 OneSignalPackagePrivateHelper (com.onesignal.OneSignalPackagePrivateHelper)3 MockOneSignalAPIClient (com.onesignal.MockOneSignalAPIClient)2 MockOutcomeEventsController (com.onesignal.MockOutcomeEventsController)2 OSOutcomeEventsFactory (com.onesignal.outcomes.data.OSOutcomeEventsFactory)2 NotificationManager (android.app.NotificationManager)1 OSTestInAppMessageInternal (com.onesignal.OneSignalPackagePrivateHelper.OSTestInAppMessageInternal)1 ShadowRoboNotificationManager (com.onesignal.ShadowRoboNotificationManager)1 Test (org.junit.Test)1