@@ -4,9 +4,9 @@ import io.sentry.NoOpContinuousProfiler
44import io.sentry.NoOpProfileConverter
55import io.sentry.SentryOptions
66import io.sentry.asyncprofiler.profiling.JavaContinuousProfiler
7+ import io.sentry.asyncprofiler.provider.AsyncProfilerProfileConverterProvider
78import io.sentry.util.InitUtil
89import kotlin.test.Test
9- import io.sentry.asyncprofiler.provider.AsyncProfilerProfileConverterProvider
1010import org.mockito.kotlin.mock
1111
1212class AsyncProfilerInitUtilTest {
@@ -27,49 +27,50 @@ class AsyncProfilerInitUtilTest {
2727
2828 @Test
2929 fun `initialize Profiler returns no-op profiler if profiler already initialized` () {
30- val options = SentryOptions ().also {
31- it.setProfileSessionSampleRate(1.0 )
32- it.tracesSampleRate = 1.0
33- it.setContinuousProfiler(
34- JavaContinuousProfiler (
35- mock<ILogger >(), " " , 10 ,
36- mock<ISentryExecutorService >()
30+ val options =
31+ SentryOptions ().also {
32+ it.setProfileSessionSampleRate(1.0 )
33+ it.tracesSampleRate = 1.0
34+ it.setContinuousProfiler(
35+ JavaContinuousProfiler (mock<ILogger >(), " " , 10 , mock<ISentryExecutorService >())
3736 )
38- )
39- }
37+ }
4038
4139 val profiler = InitUtil .initializeProfiler(options)
4240 assert (profiler is NoOpContinuousProfiler )
4341 }
4442
4543 @Test
4644 fun `initialize converter returns no-op converter if converter already initialized` () {
47- val options = SentryOptions ().also {
48- it.setProfileSessionSampleRate(1.0 )
49- it.tracesSampleRate = 1.0
50- it.profilerConverter = AsyncProfilerProfileConverterProvider .AsyncProfilerProfileConverter ()
51- }
45+ val options =
46+ SentryOptions ().also {
47+ it.setProfileSessionSampleRate(1.0 )
48+ it.tracesSampleRate = 1.0
49+ it.profilerConverter = AsyncProfilerProfileConverterProvider .AsyncProfilerProfileConverter ()
50+ }
5251
5352 val converter = InitUtil .initializeProfileConverter(options)
5453 assert (converter is NoOpProfileConverter )
5554 }
5655
5756 @Test
5857 fun `initialize Profiler returns JavaContinuousProfiler if profiling enabled but profiler not yet initialized` () {
59- val options = SentryOptions ().also {
60- it.setProfileSessionSampleRate(1.0 )
61- it.tracesSampleRate = 1.0
62- }
58+ val options =
59+ SentryOptions ().also {
60+ it.setProfileSessionSampleRate(1.0 )
61+ it.tracesSampleRate = 1.0
62+ }
6363 val profiler = InitUtil .initializeProfiler(options)
6464 assert (profiler is JavaContinuousProfiler )
6565 }
6666
6767 @Test
6868 fun `initialize Profiler returns AsyncProfilerProfileConverterProvider if profiling enabled but profiler not yet initialized` () {
69- val options = SentryOptions ().also {
70- it.setProfileSessionSampleRate(1.0 )
71- it.tracesSampleRate = 1.0
72- }
69+ val options =
70+ SentryOptions ().also {
71+ it.setProfileSessionSampleRate(1.0 )
72+ it.tracesSampleRate = 1.0
73+ }
7374 val converter = InitUtil .initializeProfileConverter(options)
7475 assert (converter is AsyncProfilerProfileConverterProvider .AsyncProfilerProfileConverter )
7576 }
0 commit comments