Skip to content

Commit c171d68

Browse files
adinauerclaude
andcommitted
test(spring): Isolate capture exception advice scopes
Initialize Sentry before installing the mocked scopes used by the capture exception parameter advice test. Close Sentry after the test so the mocked scopes do not leak into later tests. Co-Authored-By: Claude <noreply@anthropic.com>
1 parent 0174f15 commit c171d68

1 file changed

Lines changed: 9 additions & 0 deletions

File tree

sentry-spring/src/test/kotlin/io/sentry/spring/exception/SentryCaptureExceptionParameterAdviceTest.kt

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,8 @@ import io.sentry.Hint
44
import io.sentry.IScopes
55
import io.sentry.Sentry
66
import io.sentry.exception.ExceptionMechanismException
7+
import io.sentry.test.initForTest
8+
import kotlin.test.AfterTest
79
import kotlin.test.BeforeTest
810
import kotlin.test.Test
911
import kotlin.test.assertEquals
@@ -32,6 +34,13 @@ class SentryCaptureExceptionParameterAdviceTest {
3234
@BeforeTest
3335
fun setup() {
3436
reset(scopes)
37+
initForTest { it.dsn = "https://key@sentry.io/proj" }
38+
Sentry.setCurrentScopes(scopes)
39+
}
40+
41+
@AfterTest
42+
fun teardown() {
43+
Sentry.close()
3544
}
3645

3746
@Test

0 commit comments

Comments
 (0)