Search in sources :

Example 1 with GeoMessage

use of org.infobip.mobile.messaging.geo.GeoMessage in project mobile-messaging-sdk-android by infobip.

the class AndroidGeoBroadcasterTest method test_should_send_geo_event.

@Test
public void test_should_send_geo_event() {
    // Given
    Geo geo = new Geo(0.0, 0.0, null, null, null, "SomeCampaignId", Collections.singletonList(createArea("areaId1")), new ArrayList<GeoEventSettings>(), 0, null);
    Message message = createMessage(context, "SomeMessageId", false, geo);
    // When
    broadcastSender.geoEvent(GeoEventType.entry, GeoMessage.createFrom(message, geo));
    // Then
    Mockito.verify(contextMock, Mockito.times(1)).sendBroadcast(intentArgumentCaptor.capture());
    Intent intent = intentArgumentCaptor.getValue();
    assertEquals(GeoEvent.GEOFENCE_AREA_ENTERED.getKey(), intent.getAction());
    GeoMessage geoMessage = GeoMessage.createFrom(intent.getExtras());
    assertNotSame(message, geoMessage);
    assertEquals("SomeMessageId", geoMessage.getMessageId());
}
Also used : Geo(org.infobip.mobile.messaging.geo.Geo) GeoMessage(org.infobip.mobile.messaging.geo.GeoMessage) GeoMessage(org.infobip.mobile.messaging.geo.GeoMessage) Message(org.infobip.mobile.messaging.Message) GeoEventSettings(org.infobip.mobile.messaging.geo.GeoEventSettings) Intent(android.content.Intent) Test(org.junit.Test)

Aggregations

Intent (android.content.Intent)1 Message (org.infobip.mobile.messaging.Message)1 Geo (org.infobip.mobile.messaging.geo.Geo)1 GeoEventSettings (org.infobip.mobile.messaging.geo.GeoEventSettings)1 GeoMessage (org.infobip.mobile.messaging.geo.GeoMessage)1 Test (org.junit.Test)1