@@ -8,6 +8,7 @@ import io.sentry.JsonSerializable
88import java.io.StringReader
99import java.io.StringWriter
1010import kotlin.test.assertEquals
11+ import kotlin.test.assertTrue
1112import org.junit.Test
1213import org.mockito.kotlin.mock
1314
@@ -60,6 +61,30 @@ class SentryStackTraceSerializationTest {
6061 assertEquals(expectedJson, actualJson)
6162 }
6263
64+ @Test
65+ fun `instructionAddressAdjustment serializes and deserializes correctly` () {
66+ val testCases =
67+ listOf (
68+ SentryStackTrace .InstructionAddressAdjustment .AUTO to " auto" ,
69+ SentryStackTrace .InstructionAddressAdjustment .ALL to " all" ,
70+ SentryStackTrace .InstructionAddressAdjustment .ALL_BUT_FIRST to " all_but_first" ,
71+ SentryStackTrace .InstructionAddressAdjustment .NONE to " none" ,
72+ )
73+
74+ for ((enumValue, expectedJson) in testCases) {
75+ val stackTrace = SentryStackTrace ().apply { instructionAddressAdjustment = enumValue }
76+ val json = serialize(stackTrace)
77+
78+ assertTrue(
79+ json.contains(" \" instruction_addr_adjustment\" :\" $expectedJson \" " ),
80+ " Expected $enumValue to serialize as \" $expectedJson \" " ,
81+ )
82+
83+ val deserialized = deserialize(json)
84+ assertEquals(enumValue, deserialized.instructionAddressAdjustment)
85+ }
86+ }
87+
6388 // Helper
6489
6590 private fun sanitizedFile (path : String ): String =
0 commit comments