From ddf9fff95c0652fdfd716f379aacde8ae99b9cff Mon Sep 17 00:00:00 2001 From: Alexander Dinauer Date: Thu, 19 Sep 2024 14:06:56 +0200 Subject: [PATCH] restore SentryGestureListenerTracingTest --- .../SentryGestureListenerTracingTest.kt | 22 +++++++++---------- 1 file changed, 11 insertions(+), 11 deletions(-) diff --git a/sentry-android-core/src/test/java/io/sentry/android/core/internal/gestures/SentryGestureListenerTracingTest.kt b/sentry-android-core/src/test/java/io/sentry/android/core/internal/gestures/SentryGestureListenerTracingTest.kt index 8f3e824a2be..07dde15e8f1 100644 --- a/sentry-android-core/src/test/java/io/sentry/android/core/internal/gestures/SentryGestureListenerTracingTest.kt +++ b/sentry-android-core/src/test/java/io/sentry/android/core/internal/gestures/SentryGestureListenerTracingTest.kt @@ -23,6 +23,7 @@ import io.sentry.TransactionOptions import io.sentry.android.core.SentryAndroidOptions import io.sentry.protocol.SentryId import io.sentry.protocol.TransactionNameSource +import org.mockito.ArgumentCaptor import org.mockito.kotlin.any import org.mockito.kotlin.check import org.mockito.kotlin.clearInvocations @@ -49,6 +50,7 @@ class SentryGestureListenerTracingTest { val scopes = mock() val event = mock() val scope = mock() + val transactionOptionsArgumentCaptor: ArgumentCaptor = ArgumentCaptor.forClass(TransactionOptions::class.java) lateinit var target: View lateinit var transaction: SentryTracer @@ -85,8 +87,7 @@ class SentryGestureListenerTracingTest { whenever(target.context).thenReturn(context) whenever(activity.window).thenReturn(window) - - whenever(scopes.startTransaction(any(), any())) + whenever(scopes.startTransaction(any(), transactionOptionsArgumentCaptor.capture())) .thenReturn(this.transaction) doAnswer { (it.arguments[0] as ScopeCallback).run(scope) }.whenever(scopes).configureScope(any()) @@ -349,15 +350,14 @@ class SentryGestureListenerTracingTest { ) } - // TODO [POTEL] rewrite -// @Test -// fun `captures transaction and sets trace origin`() { -// val sut = fixture.getSut() -// -// sut.onSingleTapUp(fixture.event) -// -// assertEquals("auto.ui.gesture_listener.old_view_system", fixture.transaction.spanContext.origin) -// } + @Test + fun `captures transaction and sets trace origin`() { + val sut = fixture.getSut() + + sut.onSingleTapUp(fixture.event) + + assertEquals("auto.ui.gesture_listener.old_view_system", fixture.transactionOptionsArgumentCaptor.value.origin) + } @Test fun `preserves existing transaction status`() {