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());
}
Aggregations