Skip to content

Commit c853932

Browse files
runningcodeclaude
andcommitted
test(core): Verify schedule instead of scheduleAtFixedRate
The performance collector now uses fixed-delay scheduling, so the timer verifications assert schedule(...) rather than scheduleAtFixedRate(...). Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
1 parent c12e284 commit c853932

1 file changed

Lines changed: 8 additions & 8 deletions

File tree

sentry/src/test/java/io/sentry/DefaultCompositePerformanceCollectorTest.kt

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -86,7 +86,7 @@ class DefaultCompositePerformanceCollectorTest {
8686
val collector = fixture.getSut(null, null)
8787
assertTrue(fixture.options.performanceCollectors.isEmpty())
8888
collector.start(fixture.transaction1)
89-
verify(fixture.mockTimer, never())!!.scheduleAtFixedRate(any(), any<Long>(), any())
89+
verify(fixture.mockTimer, never())!!.schedule(any(), any<Long>(), any())
9090
}
9191

9292
@Test
@@ -104,22 +104,22 @@ class DefaultCompositePerformanceCollectorTest {
104104
fun `when start, timer is scheduled every 100 milliseconds`() {
105105
val collector = fixture.getSut()
106106
collector.start(fixture.transaction1)
107-
verify(fixture.mockTimer)!!.scheduleAtFixedRate(any(), any<Long>(), eq(100))
107+
verify(fixture.mockTimer)!!.schedule(any(), any<Long>(), eq(100))
108108
}
109109

110110
@Test
111111
fun `when start with a string, timer is scheduled every 100 milliseconds`() {
112112
val collector = fixture.getSut()
113113
collector.start(fixture.id1)
114-
verify(fixture.mockTimer)!!.scheduleAtFixedRate(any(), any<Long>(), eq(100))
114+
verify(fixture.mockTimer)!!.schedule(any(), any<Long>(), eq(100))
115115
}
116116

117117
@Test
118118
fun `when stop, timer is stopped`() {
119119
val collector = fixture.getSut()
120120
collector.start(fixture.transaction1)
121121
collector.stop(fixture.transaction1)
122-
verify(fixture.mockTimer)!!.scheduleAtFixedRate(any(), any<Long>(), eq(100))
122+
verify(fixture.mockTimer)!!.schedule(any(), any<Long>(), eq(100))
123123
verify(fixture.mockTimer)!!.cancel()
124124
}
125125

@@ -128,15 +128,15 @@ class DefaultCompositePerformanceCollectorTest {
128128
val collector = fixture.getSut()
129129
collector.start(fixture.id1)
130130
collector.stop(fixture.id1)
131-
verify(fixture.mockTimer)!!.scheduleAtFixedRate(any(), any<Long>(), eq(100))
131+
verify(fixture.mockTimer)!!.schedule(any(), any<Long>(), eq(100))
132132
verify(fixture.mockTimer)!!.cancel()
133133
}
134134

135135
@Test
136136
fun `stopping a not collected transaction return null`() {
137137
val collector = fixture.getSut()
138138
val data = collector.stop(fixture.transaction1)
139-
verify(fixture.mockTimer, never())!!.scheduleAtFixedRate(any(), any<Long>(), eq(100))
139+
verify(fixture.mockTimer, never())!!.schedule(any(), any<Long>(), eq(100))
140140
verify(fixture.mockTimer, never())!!.cancel()
141141
assertNull(data)
142142
}
@@ -145,7 +145,7 @@ class DefaultCompositePerformanceCollectorTest {
145145
fun `stopping a not collected id return null`() {
146146
val collector = fixture.getSut()
147147
val data = collector.stop(fixture.id1)
148-
verify(fixture.mockTimer, never())!!.scheduleAtFixedRate(any(), any<Long>(), eq(100))
148+
verify(fixture.mockTimer, never())!!.schedule(any(), any<Long>(), eq(100))
149149
verify(fixture.mockTimer, never())!!.cancel()
150150
assertNull(data)
151151
}
@@ -316,7 +316,7 @@ class DefaultCompositePerformanceCollectorTest {
316316
collector.close()
317317

318318
// Timer was canceled
319-
verify(fixture.mockTimer)!!.scheduleAtFixedRate(any(), any<Long>(), eq(100))
319+
verify(fixture.mockTimer)!!.schedule(any(), any<Long>(), eq(100))
320320
verify(fixture.mockTimer)!!.cancel()
321321

322322
// Data was cleared

0 commit comments

Comments
 (0)