Skip to content

Commit 6257cfc

Browse files
committed
fix test
1 parent c181555 commit 6257cfc

1 file changed

Lines changed: 12 additions & 1 deletion

File tree

sentry-android-replay/src/test/java/io/sentry/android/replay/ReplaySmokeTest.kt

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@ import io.sentry.rrweb.RRWebMetaEvent
2323
import io.sentry.rrweb.RRWebVideoEvent
2424
import io.sentry.transport.CurrentDateProvider
2525
import io.sentry.transport.ICurrentDateProvider
26+
import io.sentry.transport.RateLimiter
2627
import java.time.Duration
2728
import java.util.concurrent.Executors
2829
import java.util.concurrent.TimeUnit
@@ -41,6 +42,7 @@ import org.mockito.kotlin.any
4142
import org.mockito.kotlin.anyOrNull
4243
import org.mockito.kotlin.check
4344
import org.mockito.kotlin.doAnswer
45+
import org.mockito.kotlin.doReturn
4446
import org.mockito.kotlin.mock
4547
import org.mockito.kotlin.verify
4648
import org.mockito.kotlin.whenever
@@ -61,11 +63,17 @@ class ReplaySmokeTest {
6163
internal class Fixture {
6264
val options = SentryOptions()
6365
val scope = Scope(options)
66+
val rateLimiter =
67+
mock<RateLimiter> {
68+
on { isActiveForCategory(any()) }.thenReturn(false)
69+
}
6470
val scopes =
6571
mock<IScopes> {
6672
doAnswer { (it.arguments[0] as ScopeCallback).run(scope) }
6773
.whenever(it)
6874
.configureScope(any())
75+
76+
on { rateLimiter }.doReturn(rateLimiter)
6977
}
7078

7179
private class ImmediateHandler :
@@ -91,7 +99,10 @@ class ReplaySmokeTest {
9199
mainLooperHandler =
92100
mock {
93101
whenever(mock.handler).thenReturn(ImmediateHandler())
94-
whenever(mock.post(any())).then { (it.arguments[0] as Runnable).run() }
102+
whenever(mock.post(any())).then {
103+
(it.arguments[0] as Runnable).run()
104+
true
105+
}
95106
whenever(mock.postDelayed(any(), anyLong())).then {
96107
// have to use another thread here otherwise it will block the test thread
97108
recordingThread.schedule(

0 commit comments

Comments
 (0)