Skip to content

Commit

Permalink
code review changes
Browse files Browse the repository at this point in the history
  • Loading branch information
adinauer committed Sep 3, 2024
1 parent f9b17d8 commit d63db29
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 4 deletions.
2 changes: 1 addition & 1 deletion sentry/src/main/java/io/sentry/SentryOptions.java
Original file line number Diff line number Diff line change
Expand Up @@ -490,6 +490,7 @@ public class SentryOptions {
private @NotNull ScopeType defaultScopeType = ScopeType.ISOLATION;

private @NotNull InitPriority initPriority = InitPriority.MEDIUM;

private boolean forceInit = false;

/**
Expand Down Expand Up @@ -2592,7 +2593,6 @@ public SentryOptions() {
*/
private SentryOptions(final boolean empty) {
if (!empty) {
setInitPriority(InitPriority.LOWEST);
setSpanFactory(new DefaultSpanFactory());
// SentryExecutorService should be initialized before any
// SendCachedEventFireAndForgetIntegration
Expand Down
5 changes: 5 additions & 0 deletions sentry/src/test/java/io/sentry/SentryOptionsTest.kt
Original file line number Diff line number Diff line change
Expand Up @@ -728,4 +728,9 @@ class SentryOptionsTest {
assertEquals(30, options.cron?.defaultFailureIssueThreshold)
assertEquals(40, options.cron?.defaultRecoveryThreshold)
}

@Test
fun `when options is initialized, InitPriority is set to MEDIUM by default`() {
assertEquals(SentryOptions().initPriority, InitPriority.MEDIUM)
}
}
14 changes: 11 additions & 3 deletions sentry/src/test/java/io/sentry/util/InitUtilTest.kt
Original file line number Diff line number Diff line change
Expand Up @@ -2,15 +2,23 @@ package io.sentry.util

import io.sentry.InitPriority
import io.sentry.SentryOptions
import kotlin.test.BeforeTest
import kotlin.test.Test
import kotlin.test.assertFalse
import kotlin.test.assertTrue

class InitUtilTest {

var previousOptions: SentryOptions? = null
var newOptions: SentryOptions? = null
var clientEnabled: Boolean = true
private var previousOptions: SentryOptions? = null
private var newOptions: SentryOptions? = null
private var clientEnabled: Boolean = true

@BeforeTest
fun setup() {
previousOptions = null
newOptions = null
clientEnabled = true
}

@Test
fun `first init on empty options goes through`() {
Expand Down

0 comments on commit d63db29

Please sign in to comment.