@@ -150,6 +150,42 @@ class RoktKitTests {
150150
151151 }
152152
153+ @Test
154+ fun test_addIdentityAttributes_When_userIdentities_And_attributes_contains_same_key (){
155+ val mockFilterUser = Mockito .mock(FilteredMParticleUser ::class .java)
156+ val userIdentities = HashMap <IdentityType , String >()
157+ userIdentities.put(IdentityType .Email ," TestEmail@gamil.com" )
158+ Mockito .`when `(mockFilterUser.userIdentities).thenReturn(userIdentities)
159+ val attributes: Map <String , String > = mapOf (
160+ " key1" to " value1" ,
161+ " key2" to " value2" ,
162+ " key3" to " value3" ,
163+ " email" to " abc@gmail.com"
164+ )
165+ val method: Method = RoktKit ::class .java.getDeclaredMethod(
166+ " addIdentityAttributes" ,
167+ Map ::class .java,
168+ FilteredMParticleUser ::class .java
169+ )
170+ method.isAccessible = true
171+ val result = method.invoke(roktKit, attributes, mockFilterUser) as Map <String , String >
172+ assertEquals(4 , result.size)
173+
174+ assertTrue(result.containsKey(" key1" ))
175+ assertTrue(result.containsKey(" key2" ))
176+ assertTrue(result.containsKey(" key3" ))
177+ assertTrue(result.containsKey(" email" ))
178+ assertEquals(
179+ mapOf (
180+ " key1" to " value1" ,
181+ " key2" to " value2" ,
182+ " key3" to " value3" ,
183+ " email" to " TestEmail@gamil.com"
184+ ),
185+ result
186+ )
187+ }
188+
153189 @Test
154190 fun testAddIdentityAttributes_bothNull () {
155191 val method: Method = RoktKit ::class .java.getDeclaredMethod(
0 commit comments