@@ -440,7 +440,7 @@ class BaggageTest {
440440 }
441441
442442 @Test
443- fun `copy with overrides creates mutable baggage ` () {
443+ fun `copy with overrides preserves frozen state ` () {
444444 val baggage =
445445 Baggage .fromHeader(
446446 " sentry-sample_rand=0.1,sentry-trace_id=75302ac48a024bde9a3b3734a82e36c8" ,
@@ -450,14 +450,24 @@ class BaggageTest {
450450
451451 val copy = Baggage .copyWithOverrides(baggage, SentryId (" aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa" ), 0.2 )
452452
453- assertTrue (copy.isMutable)
454- assertFalse (copy.isShouldFreeze)
453+ assertFalse (copy.isMutable)
454+ assertTrue (copy.isShouldFreeze)
455455 assertEquals(" aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa" , copy.traceId)
456456 assertEquals(0.2 , copy.sampleRand!! , 0.0001 )
457457 assertEquals(" 75302ac48a024bde9a3b3734a82e36c8" , baggage.traceId)
458458 assertEquals(0.1 , baggage.sampleRand!! , 0.0001 )
459459 }
460460
461+ @Test
462+ fun `copy with overrides creates baggage when source is null` () {
463+ val copy = Baggage .copyWithOverrides(null , SentryId (" aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa" ), 0.2 )
464+
465+ assertTrue(copy.isMutable)
466+ assertFalse(copy.isShouldFreeze)
467+ assertEquals(" aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa" , copy.traceId)
468+ assertEquals(0.2 , copy.sampleRand!! , 0.0001 )
469+ }
470+
461471 @Test
462472 fun `if header contains sentry values baggage is marked as shouldFreeze` () {
463473 val baggage =
0 commit comments