Skip to content

Commit 1af65ac

Browse files
committed
Fix tests
1 parent b5c4aed commit 1af65ac

File tree

2 files changed

+13
-10
lines changed

2 files changed

+13
-10
lines changed

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

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -750,9 +750,10 @@ class ReplayIntegrationTest {
750750
Random(),
751751
// run tasks synchronously in tests
752752
mock {
753-
doAnswer { (it.arguments[0] as Runnable).run() }
754-
.whenever(mock)
755-
.submit(any<Runnable>())
753+
whenever(mock.submit(any<Runnable>())).doAnswer {
754+
(it.arguments[0] as Runnable).run()
755+
null
756+
}
756757
},
757758
) { _ ->
758759
fixture.replayCache
@@ -979,7 +980,10 @@ class ReplayIntegrationTest {
979980
CurrentDateProvider.getInstance(),
980981
executor =
981982
mock {
982-
doAnswer { (it.arguments[0] as Runnable).run() }.whenever(mock).submit(any<Runnable>())
983+
whenever(mock.submit(any<Runnable>())).doAnswer {
984+
(it.arguments[0] as Runnable).run()
985+
null
986+
}
983987
},
984988
)
985989
}

sentry-android-replay/src/test/java/io/sentry/android/replay/capture/BufferCaptureStrategyTest.kt

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -106,12 +106,10 @@ class BufferCaptureStrategyTest {
106106
dateProvider,
107107
Random(),
108108
mock {
109-
doAnswer { invocation ->
110-
(invocation.arguments[0] as Runnable).run()
111-
null
112-
}
113-
.whenever(it)
114-
.submit(any<Runnable>())
109+
whenever(it.submit(any<Runnable>())).doAnswer { invocation ->
110+
(invocation.arguments[0] as Runnable).run()
111+
null
112+
}
115113
},
116114
) { _ ->
117115
replayCache
@@ -356,6 +354,7 @@ class BufferCaptureStrategyTest {
356354
strategy.onConfigurationChanged(fixture.recorderConfig)
357355

358356
val oldTimestamp = strategy.segmentTimestamp
357+
whenever(fixture.replayCache.firstFrameTimestamp()).thenReturn(oldTimestamp!!.time)
359358

360359
strategy.captureReplay(false) { newTimestamp ->
361360
assertEquals(oldTimestamp!!.time + VIDEO_DURATION, newTimestamp.time)

0 commit comments

Comments
 (0)