Search in sources :

Example 1 with Broadcaster

use of org.infobip.mobile.messaging.platform.Broadcaster 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);
    MobileApiResourceProvider mobileApiResourceProvider = mock(MobileApiResourceProvider.class);
    mobileApiMessages = mock(MobileApiMessages.class);
    mobileApiData = mock(MobileApiData.class);
    given(mobileApiResourceProvider.getMobileApiMessages(any(Context.class))).willReturn(mobileApiMessages);
    given(mobileApiResourceProvider.getMobileApiData(any(Context.class))).willReturn(mobileApiData);
    notificationHandler = mock(NotificationHandler.class);
    broadcaster = mock(Broadcaster.class);
    mobileMessagingCore = MobileMessagingTestable.create(context, broadcaster, mobileApiResourceProvider);
    mobileMessaging = mobileMessagingCore;
    databaseHelper = MobileMessagingCore.getDatabaseHelper(context);
    databaseProvider = MobileMessagingCore.getDatabaseProvider(context);
}
Also used : Context(android.content.Context) MobileApiResourceProvider(org.infobip.mobile.messaging.mobile.MobileApiResourceProvider) NotificationHandler(org.infobip.mobile.messaging.notification.NotificationHandler) MobileApiMessages(org.infobip.mobile.messaging.api.messages.MobileApiMessages) Broadcaster(org.infobip.mobile.messaging.platform.Broadcaster) MobileApiData(org.infobip.mobile.messaging.api.data.MobileApiData) Before(org.junit.Before) SuppressLint(android.annotation.SuppressLint)

Aggregations

SuppressLint (android.annotation.SuppressLint)1 Context (android.content.Context)1 MobileApiData (org.infobip.mobile.messaging.api.data.MobileApiData)1 MobileApiMessages (org.infobip.mobile.messaging.api.messages.MobileApiMessages)1 MobileApiResourceProvider (org.infobip.mobile.messaging.mobile.MobileApiResourceProvider)1 NotificationHandler (org.infobip.mobile.messaging.notification.NotificationHandler)1 Broadcaster (org.infobip.mobile.messaging.platform.Broadcaster)1 Before (org.junit.Before)1