diff options
Diffstat (limited to 'adservices/tests/unittest/service-core/src/com/android/adservices/service/measurement/reporting/EventReportSenderTest.java')
-rw-r--r-- | adservices/tests/unittest/service-core/src/com/android/adservices/service/measurement/reporting/EventReportSenderTest.java | 18 |
1 files changed, 15 insertions, 3 deletions
diff --git a/adservices/tests/unittest/service-core/src/com/android/adservices/service/measurement/reporting/EventReportSenderTest.java b/adservices/tests/unittest/service-core/src/com/android/adservices/service/measurement/reporting/EventReportSenderTest.java index 6d96c9a95c..0fd9d1828d 100644 --- a/adservices/tests/unittest/service-core/src/com/android/adservices/service/measurement/reporting/EventReportSenderTest.java +++ b/adservices/tests/unittest/service-core/src/com/android/adservices/service/measurement/reporting/EventReportSenderTest.java @@ -16,10 +16,14 @@ package com.android.adservices.service.measurement.reporting; +import static com.google.common.truth.Truth.assertThat; + import static org.junit.Assert.assertEquals; import android.net.Uri; +import com.android.adservices.service.measurement.util.UnsignedLong; + import org.json.JSONException; import org.json.JSONObject; import org.junit.Test; @@ -33,8 +37,8 @@ import java.net.HttpURLConnection; public class EventReportSenderTest { private static final String ATTRIBUTION_DESTINATION = "https://toasters.example"; - private static final String SOURCE_EVENT_ID = "12345"; - private static final String TRIGGER_DATA = "2"; + private static final UnsignedLong SOURCE_EVENT_ID = new UnsignedLong(12345L); + private static final UnsignedLong TRIGGER_DATA = new UnsignedLong(2L); private static final String REPORT_ID = "678"; private static final String SOURCE_TYPE = "event"; private static final double RANDOMIZED_TRIGGER_RATE = 0.0024; @@ -68,7 +72,7 @@ public class EventReportSenderTest { Uri reportingOrigin = Uri.parse("https://ad-tech.example"); JSONObject eventReportJson = createEventReportPayloadExample1().toJson(); - EventReportSender eventReportSender = new EventReportSender(); + EventReportSender eventReportSender = new EventReportSender(false); EventReportSender spyEventReportSender = Mockito.spy(eventReportSender); Mockito.doReturn(httpUrlConnection).when(spyEventReportSender) @@ -80,4 +84,12 @@ public class EventReportSenderTest { assertEquals(outputStream.toString(), eventReportJson.toString()); assertEquals(responseCode, 200); } + + @Test + public void testDebugReportUriPath() { + assertThat(new EventReportSender(false).getReportUriPath()) + .isEqualTo(EventReportSender.EVENT_ATTRIBUTION_REPORT_URI_PATH); + assertThat(new EventReportSender(true).getReportUriPath()) + .isEqualTo(EventReportSender.DEBUG_EVENT_ATTRIBUTION_REPORT_URI_PATH); + } } |