use of org.infobip.mobile.messaging.geo.report.GeoReportingResult in project mobile-messaging-sdk-android by infobip.
the class GeoReportHelperTest method test_should_filter_reports_for_inactive_campaigns.
@Test
public void test_should_filter_reports_for_inactive_campaigns() throws Exception {
// Given
Area area = createArea("areaId");
EventReportResponse reportResponse = new EventReportResponse();
reportResponse.setFinishedCampaignIds(Sets.newSet("campaignId1"));
reportResponse.setSuspendedCampaignIds(Sets.newSet("campaignId2"));
createMessage(context, "signalingMessageId1", "campaignId1", true, area);
createMessage(context, "signalingMessageId2", "campaignId2", true, area);
createMessage(context, "signalingMessageId3", "campaignId3", true, area);
GeoReportingResult geoReportingResult = new GeoReportingResult(reportResponse);
List<GeoReport> reports = Arrays.asList(createReport(context, "signalingMessageId1", "campaignId1", "sdkMessageId1", false, area), createReport(context, "signalingMessageId2", "campaignId2", "sdkMessageId2", false, area), createReport(context, "signalingMessageId3", "campaignId3", "sdkMessageId3", false, area));
// When
List<GeoReport> filtered = GeoReportHelper.filterOutNonActiveReports(context, reports, geoReportingResult);
// Then
assertJEquals(reports.get(2), filtered.get(0));
}
use of org.infobip.mobile.messaging.geo.report.GeoReportingResult in project mobile-messaging-sdk-android by infobip.
the class GeoReportHelperTest method test_should_create_messages_with_generated_ids_for_unsuccessful_report.
@Test
public void test_should_create_messages_with_generated_ids_for_unsuccessful_report() {
// Given
Area area = createArea("areaId");
GeoReport report = createReport(context, "signalingMessageId", "campaignId", "sdkMessageId", false, area);
GeoReportingResult geoReportingResult = new GeoReportingResult(new Exception());
createMessage(context, "signalingMessageId", "campaignId", true, area);
// When
Map<Message, GeoEventType> messages = GeoReportHelper.createMessagesToNotify(context, Collections.singletonList(report), geoReportingResult);
// Then
Message generated = messages.keySet().iterator().next();
assertEquals("sdkMessageId", generated.getMessageId());
assertEquals(GeoEventType.entry, messages.values().iterator().next());
}
Aggregations