@@ -24,6 +24,7 @@ import org.powermock.core.classloader.annotations.PrepareForTest
2424import org.powermock.modules.junit4.PowerMockRunner
2525import java.lang.ref.WeakReference
2626import kotlin.test.assertEquals
27+ import kotlin.test.assertNull
2728import kotlin.test.assertTrue
2829
2930@RunWith(PowerMockRunner ::class )
@@ -169,4 +170,35 @@ class RoktTest {
169170 assertTrue(elements.isEmpty())
170171 }
171172 }
173+
174+ @Test
175+ fun testSetSessionId_whenEnabled_delegatesToKitManager () {
176+ `when `(configManager.isEnabled).thenReturn(true )
177+ rokt.setSessionId(" test-session-id" )
178+ verify(kitManager).setSessionId(" test-session-id" )
179+ }
180+
181+ @Test
182+ fun testSetSessionId_whenDisabled_doesNotCallKitManager () {
183+ `when `(configManager.isEnabled).thenReturn(false )
184+ rokt.setSessionId(" test-session-id" )
185+ verify(kitManager, never()).setSessionId(any())
186+ }
187+
188+ @Test
189+ fun testGetSessionId_whenEnabled_delegatesToKitManager () {
190+ `when `(configManager.isEnabled).thenReturn(true )
191+ `when `(kitManager.getSessionId()).thenReturn(" expected-session-id" )
192+ val result = rokt.getSessionId()
193+ verify(kitManager).getSessionId()
194+ assertEquals(" expected-session-id" , result)
195+ }
196+
197+ @Test
198+ fun testGetSessionId_whenDisabled_returnsNull () {
199+ `when `(configManager.isEnabled).thenReturn(false )
200+ val result = rokt.getSessionId()
201+ verify(kitManager, never()).getSessionId()
202+ assertNull(result)
203+ }
172204}
0 commit comments