Search in sources :

Example 6 with NotificationHandler

use of org.infobip.mobile.messaging.notification.NotificationHandler in project mobile-messaging-sdk-android by infobip.

the class MobileMessagingTestCase method setUp.

@SuppressLint("ApplySharedPref")
@Before
public void setUp() throws Exception {
    super.setUp();
    PreferenceManager.getDefaultSharedPreferences(context).edit().clear().commit();
    PreferenceHelper.saveString(context, MobileMessagingProperty.API_URI, "http://127.0.0.1:" + debugServer.getListeningPort() + "/");
    PreferenceHelper.saveString(context, MobileMessagingProperty.APPLICATION_CODE, "TestApplicationCode");
    PreferenceHelper.saveString(context, MobileMessagingProperty.INFOBIP_REGISTRATION_ID, "TestDeviceInstanceId");
    PreferenceHelper.saveString(context, MobileMessagingProperty.GCM_REGISTRATION_ID, "TestRegistrationId");
    PreferenceHelper.saveBoolean(context, MobileMessagingProperty.GCM_REGISTRATION_ID_REPORTED, true);
    MobileMessagingLogger.enforce();
    time = new TestTimeProvider();
    Time.reset(time);
    notificationHandler = mock(NotificationHandler.class);
    coreBroadcaster = mock(Broadcaster.class);
    mobileApiMessages = mock(MobileApiMessages.class);
    mobileApiRegistration = mock(MobileApiRegistration.class);
    mobileApiResourceProvider = mock(MobileApiResourceProvider.class);
    given(mobileApiResourceProvider.getMobileApiMessages(any(Context.class))).willReturn(mobileApiMessages);
    given(mobileApiResourceProvider.getMobileApiRegistration(any(Context.class))).willReturn(mobileApiRegistration);
    mobileMessagingCore = MobileMessagingTestable.create(context, coreBroadcaster, mobileApiResourceProvider);
    mobileMessaging = mobileMessagingCore;
    geofencingHelper = new GeofencingHelper(context);
    geoBroadcaster = mock(GeoBroadcaster.class);
    geofencingHelper.removeUnreportedGeoEvents();
    databaseHelper = MobileMessagingCore.getDatabaseHelper(context);
    databaseProvider = MobileMessagingCore.getDatabaseProvider(context);
    geoStore = geofencingHelper.getMessageStoreForGeo();
}
Also used : Context(android.content.Context) MobileApiResourceProvider(org.infobip.mobile.messaging.mobile.MobileApiResourceProvider) GeofencingHelper(org.infobip.mobile.messaging.geo.geofencing.GeofencingHelper) GeoBroadcaster(org.infobip.mobile.messaging.geo.platform.GeoBroadcaster) NotificationHandler(org.infobip.mobile.messaging.notification.NotificationHandler) Broadcaster(org.infobip.mobile.messaging.platform.Broadcaster) GeoBroadcaster(org.infobip.mobile.messaging.geo.platform.GeoBroadcaster) MobileApiMessages(org.infobip.mobile.messaging.api.messages.MobileApiMessages) MobileApiRegistration(org.infobip.mobile.messaging.api.registration.MobileApiRegistration) Before(org.junit.Before) SuppressLint(android.annotation.SuppressLint)

Aggregations

NotificationHandler (org.infobip.mobile.messaging.notification.NotificationHandler)6 CoreNotificationHandler (org.infobip.mobile.messaging.notification.CoreNotificationHandler)3 AndroidBroadcaster (org.infobip.mobile.messaging.platform.AndroidBroadcaster)3 SuppressLint (android.annotation.SuppressLint)2 Context (android.content.Context)2 MobileApiMessages (org.infobip.mobile.messaging.api.messages.MobileApiMessages)2 MobileApiResourceProvider (org.infobip.mobile.messaging.mobile.MobileApiResourceProvider)2 MockNotificationHandler (org.infobip.mobile.messaging.notification.MockNotificationHandler)2 Broadcaster (org.infobip.mobile.messaging.platform.Broadcaster)2 Before (org.junit.Before)2 Test (org.junit.Test)2 MobileMessagingCore (org.infobip.mobile.messaging.MobileMessagingCore)1 MobileApiData (org.infobip.mobile.messaging.api.data.MobileApiData)1 MobileApiRegistration (org.infobip.mobile.messaging.api.registration.MobileApiRegistration)1 GeofencingHelper (org.infobip.mobile.messaging.geo.geofencing.GeofencingHelper)1 GeoBroadcaster (org.infobip.mobile.messaging.geo.platform.GeoBroadcaster)1