-
-
Notifications
You must be signed in to change notification settings - Fork 444
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'main' into fix/processor-transaction
- Loading branch information
Showing
21 changed files
with
214 additions
and
67 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Submodule sentry-native
updated
63 files
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
27 changes: 23 additions & 4 deletions
27
sentry-test-support/src/main/kotlin/io/sentry/test/assertions.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,20 +1,39 @@ | ||
package io.sentry.test | ||
|
||
import com.nhaarman.mockitokotlin2.check | ||
import io.sentry.GsonSerializer | ||
import io.sentry.SentryEnvelope | ||
import io.sentry.SentryEvent | ||
import io.sentry.SentryOptions | ||
import io.sentry.protocol.SentryTransaction | ||
import java.lang.AssertionError | ||
|
||
/** | ||
* Verifies is [SentryEnvelope] contains first event matching a predicate. | ||
*/ | ||
inline fun checkEvent(noinline predicate: (SentryEvent) -> Unit): SentryEnvelope { | ||
fun checkEvent(predicate: (SentryEvent) -> Unit): SentryEnvelope { | ||
val options = SentryOptions().apply { | ||
setSerializer(GsonSerializer(SentryOptions())) | ||
} | ||
return check { | ||
val event: SentryEvent? = it.items.first().getEvent(options.serializer) | ||
if (event != null) { | ||
predicate(event) | ||
} else { | ||
throw AssertionError("event is null") | ||
} | ||
} | ||
} | ||
|
||
fun checkTransaction(predicate: (SentryTransaction) -> Unit): SentryEnvelope { | ||
val options = SentryOptions().apply { | ||
setSerializer(GsonSerializer(SentryOptions())) | ||
} | ||
return check { | ||
val event = it.items.first().getEvent(options.serializer)!! | ||
predicate(event) | ||
val transaction = it.items.first().getTransaction(options.serializer) | ||
if (transaction != null) { | ||
predicate(transaction) | ||
} else { | ||
throw AssertionError("transaction is null") | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.