use of com.onesignal.MockOneSignalDBHelper in project OneSignal-Android-SDK by OneSignal.
the class OutcomeEventIntegrationTests method beforeEachTest.
@Before
public void beforeEachTest() throws Exception {
blankActivityController = Robolectric.buildActivity(BlankActivity.class).create();
blankActivity = blankActivityController.get();
time = new MockOSTimeImpl();
dbHelper = new MockOneSignalDBHelper(ApplicationProvider.getApplicationContext());
preferences = new OneSignalPackagePrivateHelper.OSSharedPreferencesWrapper();
trackerFactory = new OSTrackerFactory(preferences, logger, time);
sessionManager = new MockSessionManager(sessionListener, trackerFactory, logger);
cleanUp();
}
use of com.onesignal.MockOneSignalDBHelper in project OneSignal-Android-SDK by OneSignal.
the class OutcomeEventV2UnitTests method beforeEachTest.
// Before each test
@Before
public void beforeEachTest() throws Exception {
outcomeEvents = null;
dbHelper = new MockOneSignalDBHelper(ApplicationProvider.getApplicationContext());
// Mock on a custom HashMap in order to not use custom context
preferences = new MockOSSharedPreferences();
// Save v2 flag
String v2Name = preferences.getOutcomesV2KeyName();
preferences.saveBool(preferences.getPreferencesName(), v2Name, true);
MockOSTimeImpl time = new MockOSTimeImpl();
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);
}
use of com.onesignal.MockOneSignalDBHelper in project OneSignal-Android-SDK by OneSignal.
the class LocationIntegrationTests 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);
}
use of com.onesignal.MockOneSignalDBHelper in project OneSignal-Android-SDK by OneSignal.
the class GenerateNotificationRunner method beforeEachTest.
// Before each test
@Before
public void beforeEachTest() throws Exception {
blankActivityController = Robolectric.buildActivity(BlankActivity.class).create();
blankActivity = blankActivityController.get();
blankActivity.getApplicationInfo().name = "UnitTestApp";
dbHelper = new MockOneSignalDBHelper(ApplicationProvider.getApplicationContext());
time = new MockOSTimeImpl();
callbackCounter = 0;
lastForegroundNotificationReceivedEvent = null;
lastServiceNotificationReceivedEvent = null;
TestHelpers.beforeTestInitAndCleanup();
setClearGroupSummaryClick(true);
NotificationManager notificationManager = OneSignalNotificationManagerPackageHelper.getNotificationManager(blankActivity);
notificationManager.cancelAll();
OSNotificationRestoreWorkManager.restored = false;
OneSignal_setTime(time);
// Set remote_params GET response
setRemoteParamsGetHtmlResponse();
OneSignal.setLogLevel(OneSignal.LOG_LEVEL.VERBOSE, OneSignal.LOG_LEVEL.NONE);
}
use of com.onesignal.MockOneSignalDBHelper 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);
}
Aggregations