File tree Expand file tree Collapse file tree 1 file changed +29
-0
lines changed
sentry-okhttp/src/test/java/io/sentry/okhttp Expand file tree Collapse file tree 1 file changed +29
-0
lines changed Original file line number Diff line number Diff line change @@ -15,6 +15,7 @@ import io.sentry.TransactionContext
1515import io.sentry.TypeCheckHint
1616import io.sentry.exception.SentryHttpClientException
1717import io.sentry.test.getProperty
18+ import io.sentry.util.network.NetworkRequestData
1819import kotlin.test.Test
1920import kotlin.test.assertEquals
2021import kotlin.test.assertFalse
@@ -425,6 +426,34 @@ class SentryOkHttpEventTest {
425426 verify(fixture.scopes, never()).captureEvent(any(), any<Hint >())
426427 }
427428
429+ @Test
430+ fun `when finish is called, the breadcrumb sent includes network details data on its hint` () {
431+ val sut = fixture.getSut()
432+ val networkRequestData = NetworkRequestData (" GET" )
433+
434+ sut.setNetworkDetails(networkRequestData)
435+ sut.finish()
436+
437+ verify(fixture.scopes)
438+ .addBreadcrumb(
439+ any<Breadcrumb >(),
440+ check { assertEquals(networkRequestData, it[TypeCheckHint .SENTRY_REPLAY_NETWORK_DETAILS ]) }
441+ )
442+ }
443+
444+ @Test
445+ fun `when setNetworkDetails is not called, no network details data is captured` () {
446+ val sut = fixture.getSut()
447+
448+ sut.finish()
449+
450+ verify(fixture.scopes)
451+ .addBreadcrumb(
452+ any<Breadcrumb >(),
453+ check { assertNull(it[TypeCheckHint .SENTRY_REPLAY_NETWORK_DETAILS ]) }
454+ )
455+ }
456+
428457 /* * Retrieve all the spans started in the event using reflection. */
429458 private fun SentryOkHttpEvent.getEventDates () =
430459 getProperty<MutableMap <String , SentryDate >>(" eventDates" )
You can’t perform that action at this time.
0 commit comments