Search in sources :

Example 16 with EventReportResponse

use of org.infobip.mobile.messaging.api.geo.EventReportResponse 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));
}
Also used : EventReportResponse(org.infobip.mobile.messaging.api.geo.EventReportResponse) GeoReport(org.infobip.mobile.messaging.geo.report.GeoReport) GeoReportingResult(org.infobip.mobile.messaging.geo.report.GeoReportingResult) Test(org.junit.Test)

Aggregations

EventReportResponse (org.infobip.mobile.messaging.api.geo.EventReportResponse)16 Test (org.junit.Test)13 EventReportBody (org.infobip.mobile.messaging.api.geo.EventReportBody)9 GeoReport (org.infobip.mobile.messaging.geo.report.GeoReport)7 GeoReportingResult (org.infobip.mobile.messaging.geo.report.GeoReportingResult)7 Message (org.infobip.mobile.messaging.Message)6 Context (android.content.Context)4 HashMap (java.util.HashMap)4 GeoTransition (org.infobip.mobile.messaging.geo.transition.GeoTransition)4 Map (java.util.Map)2 MobileApiGeo (org.infobip.mobile.messaging.api.geo.MobileApiGeo)2 InvocationOnMock (org.mockito.invocation.InvocationOnMock)2 NonNull (android.support.annotation.NonNull)1 ArrayList (java.util.ArrayList)1 HashSet (java.util.HashSet)1 List (java.util.List)1 EventReport (org.infobip.mobile.messaging.api.geo.EventReport)1 MessagePayload (org.infobip.mobile.messaging.api.geo.MessagePayload)1 GeoReporter (org.infobip.mobile.messaging.geo.report.GeoReporter)1