@@ -299,6 +299,37 @@ class RoktKitTests {
299299 assertTrue(result.containsKey(" emailsha256" ))
300300 }
301301
302+ @Test
303+ fun test_addIdentityAttributes_When_userIdentities_UNASSIGNED_map_To_Identity () {
304+ val mockFilterUser = mock(FilteredMParticleUser ::class .java)
305+ val userIdentities = HashMap <IdentityType , String >()
306+ userIdentities.put(IdentityType .Email , " TestEmail@gamil.com" )
307+ userIdentities.put(IdentityType .Other , " hashedEmail@123.com" )
308+ Mockito .`when `(mockFilterUser.userIdentities).thenReturn(userIdentities)
309+ val attributes: Map <String , String > = mapOf (
310+ " key1" to " value1" ,
311+ " key2" to " value2" ,
312+ " key3" to " value3" ,
313+ )
314+ val hashedField = RoktKit ::class .java.getDeclaredField(" hashedEmailUserIdentityType" )
315+ hashedField.isAccessible = true
316+ hashedField.set(roktKit, " UNASSIGNED" )
317+ val method: Method = RoktKit ::class .java.getDeclaredMethod(
318+ " addIdentityAttributes" ,
319+ Map ::class .java,
320+ FilteredMParticleUser ::class .java,
321+ )
322+ method.isAccessible = true
323+ val result = method.invoke(roktKit, attributes, mockFilterUser) as Map <String , String >
324+ assertEquals(5 , result.size)
325+
326+ assertTrue(result.containsKey(" key1" ))
327+ assertTrue(result.containsKey(" key2" ))
328+ assertTrue(result.containsKey(" key3" ))
329+ assertTrue(result.containsKey(" Email" ))
330+ assertTrue(result.containsKey(" Other" ))
331+ }
332+
302333 @Test
303334 fun testSetSdkWrapper_correctlySetsRoktFramework () {
304335 mockkObject(Rokt )
0 commit comments