Skip to content

Commit

Permalink
Add test for finish with end date
Browse files Browse the repository at this point in the history
  • Loading branch information
adinauer committed Nov 28, 2022
1 parent 687d2fe commit 52d86a3
Showing 1 changed file with 11 additions and 0 deletions.
11 changes: 11 additions & 0 deletions sentry/src/test/java/io/sentry/SentryTracerTest.kt
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,8 @@ import org.mockito.kotlin.never
import org.mockito.kotlin.spy
import org.mockito.kotlin.times
import org.mockito.kotlin.verify
import java.time.LocalDateTime
import java.time.ZoneOffset
import java.util.Date
import kotlin.test.Test
import kotlin.test.assertEquals
Expand Down Expand Up @@ -119,6 +121,15 @@ class SentryTracerTest {
assertEquals(SpanStatus.ABORTED, tracer.status)
}

@Test
fun `when transaction is finished with status and timestamp, timestamp and status are set`() {
val tracer = fixture.getSut()
val date = Date.from(LocalDateTime.of(2022, 12, 24, 23, 59, 58, 0).toInstant(ZoneOffset.UTC))
tracer.finish(SpanStatus.ABORTED, date)
assertEquals(tracer.timestamp, DateUtils.dateToSeconds(date))
assertEquals(SpanStatus.ABORTED, tracer.status)
}

@Test
fun `when transaction is finished, transaction is captured`() {
val tracer = fixture.getSut()
Expand Down

0 comments on commit 52d86a3

Please sign in to comment.