diff --git a/code/core/src/main/java/com/adobe/marketing/mobile/util/EventUtils.kt b/code/core/src/main/java/com/adobe/marketing/mobile/util/EventUtils.kt index 66ef2d4e..27219407 100644 --- a/code/core/src/main/java/com/adobe/marketing/mobile/util/EventUtils.kt +++ b/code/core/src/main/java/com/adobe/marketing/mobile/util/EventUtils.kt @@ -22,7 +22,7 @@ private const val KEY_DEBUG_EVENT_TYPE = "eventType" private const val KEY_DEBUG_EVENT_SOURCE = "eventSource" /** - * Returns the debug event type (identified by data.debug.eventType) from the event data if present, otherwise null. + * Returns the debug event type (identified by debug.eventType) from the event data if present, otherwise null. * @return the debug event type if present, otherwise null */ fun Event.getDebugEventType(): String? { @@ -34,7 +34,7 @@ fun Event.getDebugEventType(): String? { } /** - * Returns the debug event source (identified by data.debug.eventSource) from the event data if present, otherwise null. + * Returns the debug event source (identified by debug.eventSource) from the event data if present, otherwise null. * @return the debug event source if present, otherwise null */ fun Event.getDebugEventSource(): String? { diff --git a/code/core/src/test/java/com/adobe/marketing/mobile/util/EventUtilsTest.kt b/code/core/src/test/java/com/adobe/marketing/mobile/util/EventUtilsTest.kt index ee814f0a..45a68995 100644 --- a/code/core/src/test/java/com/adobe/marketing/mobile/util/EventUtilsTest.kt +++ b/code/core/src/test/java/com/adobe/marketing/mobile/util/EventUtilsTest.kt @@ -47,6 +47,14 @@ class EventUtilsTest { assertNull(event.getDebugEventType()) } + @Test + fun `Test getDebugEventType returns null when debug is not a map`() { + val event = Event.Builder(TEST_EVENT_NAME, TEST_EVENT_TYPE, TEST_EVENT_SOURCE) + .setEventData(mapOf("debug" to "value")).build() + + assertNull(event.getDebugEventType()) + } + @Test fun `Test getDebugEventType returns null on invalid debug key`() { val event = Event.Builder(TEST_EVENT_NAME, TEST_EVENT_TYPE, TEST_EVENT_SOURCE) @@ -120,6 +128,14 @@ class EventUtilsTest { assertNull(event.getDebugEventSource()) } + @Test + fun `Test getDebugEventSource returns null when debug is not a map`() { + val event = Event.Builder(TEST_EVENT_NAME, TEST_EVENT_TYPE, TEST_EVENT_SOURCE) + .setEventData(mapOf("debug" to "value")).build() + + assertNull(event.getDebugEventSource()) + } + @Test fun `Test getDebugEventSource returns null on no debug data`() { val event = Event.Builder(TEST_EVENT_NAME, TEST_EVENT_TYPE, TEST_EVENT_SOURCE)