Skip to content

Commit

Permalink
test(mockk): migrate mockito tests
Browse files Browse the repository at this point in the history
SDK-149

Co-authored-by: Andras Sarro <[email protected]>
  • Loading branch information
davidSchuppa and LordAndras committed Jan 14, 2025
1 parent 8512391 commit 244a8d1
Showing 1 changed file with 8 additions and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,8 @@ import com.emarsys.di.setupEmarsysComponent
import com.emarsys.mobileengage.event.EventServiceInternal
import com.emarsys.testUtil.AnnotationSpec
import com.emarsys.testUtil.IntegrationTestUtils
import org.mockito.kotlin.mock
import org.mockito.kotlin.verify
import io.mockk.mockk
import io.mockk.verify

class EventServiceTest : AnnotationSpec() {
companion object {
Expand All @@ -26,8 +26,8 @@ class EventServiceTest : AnnotationSpec() {

@Before
fun setUp() {
mockCompletionListener = mock()
mockEventServiceInternal = mock()
mockCompletionListener = mockk(relaxed = true)
mockEventServiceInternal = mockk(relaxed = true)
eventServiceApi = EventService()

setupEmarsysComponent(FakeDependencyContainer(eventServiceInternal = mockEventServiceInternal))
Expand All @@ -41,24 +41,24 @@ class EventServiceTest : AnnotationSpec() {
@Test
fun testEventServiceApi_trackCustomEvent_delegatesToDefaultInstance() {
eventServiceApi.trackCustomEvent(EVENT_NAME, EVENT_ATTRIBUTES, mockCompletionListener)
verify(mockEventServiceInternal).trackCustomEvent(EVENT_NAME, EVENT_ATTRIBUTES, mockCompletionListener)
verify { mockEventServiceInternal.trackCustomEvent(EVENT_NAME, EVENT_ATTRIBUTES, mockCompletionListener) }
}

@Test
fun testEventServiceApi_trackCustomEventAsync_delegatesToDefaultInstance() {
eventServiceApi.trackCustomEventAsync(EVENT_NAME, EVENT_ATTRIBUTES, mockCompletionListener)
verify(mockEventServiceInternal).trackCustomEventAsync(EVENT_NAME, EVENT_ATTRIBUTES, mockCompletionListener)
verify { mockEventServiceInternal.trackCustomEventAsync(EVENT_NAME, EVENT_ATTRIBUTES, mockCompletionListener) }
}

@Test
fun testEventServiceApi_trackInternalCustomEvent_delegatesToDefaultInstance() {
eventServiceApi.trackInternalCustomEvent(EVENT_NAME, EVENT_ATTRIBUTES, mockCompletionListener)
verify(mockEventServiceInternal).trackInternalCustomEvent(EVENT_NAME, EVENT_ATTRIBUTES, mockCompletionListener)
verify { mockEventServiceInternal.trackInternalCustomEvent(EVENT_NAME, EVENT_ATTRIBUTES, mockCompletionListener) }
}

@Test
fun testEventServiceApi_trackInternalCustomEventAsync_delegatesToDefaultInstance() {
eventServiceApi.trackInternalCustomEventAsync(EVENT_NAME, EVENT_ATTRIBUTES, mockCompletionListener)
verify(mockEventServiceInternal).trackInternalCustomEventAsync(EVENT_NAME, EVENT_ATTRIBUTES, mockCompletionListener)
verify { mockEventServiceInternal.trackInternalCustomEventAsync(EVENT_NAME, EVENT_ATTRIBUTES, mockCompletionListener) }
}
}

0 comments on commit 244a8d1

Please sign in to comment.