Skip to content
This repository was archived by the owner on Aug 30, 2023. It is now read-only.
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
32 changes: 16 additions & 16 deletions sentry-core/src/test/java/io/sentry/core/DiagnosticLoggerTest.kt
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ class DiagnosticLoggerTest {

@Test
fun `when debug is true and level is set to null, a call to log does not throw`() {
fixture.options!!.setDiagnosticLevel(null)
fixture.options.setDiagnosticLevel(null)
fixture.getSut().log(SentryLevel.DEBUG, expectedMessage)
}

Expand All @@ -61,7 +61,7 @@ class DiagnosticLoggerTest {

@Test
fun `when debug is true and option level is info, a call to log and level debug is not logged`() {
fixture.options!!.setDiagnosticLevel(SentryLevel.INFO)
fixture.options.setDiagnosticLevel(SentryLevel.INFO)
val sut = fixture.getSut()
val expectedLevel = SentryLevel.DEBUG
sut.log(expectedLevel, expectedMessage)
Expand All @@ -70,7 +70,7 @@ class DiagnosticLoggerTest {

@Test
fun `when debug is true and option level is error, a call to log and level fatal is logged`() {
fixture.options!!.setDiagnosticLevel(SentryLevel.ERROR)
fixture.options.setDiagnosticLevel(SentryLevel.ERROR)
val sut = fixture.getSut()
val expectedLevel = SentryLevel.FATAL
sut.log(expectedLevel, expectedMessage)
Expand All @@ -79,7 +79,7 @@ class DiagnosticLoggerTest {

@Test
fun `when debug is false and option level is fatal, a call to log and level error is not logged`() {
fixture.options!!.isDebug = false
fixture.options.isDebug = false
val sut = fixture.getSut()
val expectedLevel = SentryLevel.FATAL
sut.log(expectedLevel, expectedMessage)
Expand All @@ -88,7 +88,7 @@ class DiagnosticLoggerTest {

@Test
fun `when debug is true option level is info, a call to log and level debug is not logged`() {
fixture.options!!.setDiagnosticLevel(SentryLevel.FATAL)
fixture.options.setDiagnosticLevel(SentryLevel.FATAL)
val sut = fixture.getSut()
val expectedLevel = SentryLevel.DEBUG
sut.log(expectedLevel, expectedMessage)
Expand All @@ -97,7 +97,7 @@ class DiagnosticLoggerTest {

@Test
fun `when debug is true option level is debug, a call to log with throwable and level info is logged`() {
fixture.options!!.setDiagnosticLevel(SentryLevel.DEBUG)
fixture.options.setDiagnosticLevel(SentryLevel.DEBUG)
val sut = fixture.getSut()
val expectedLevel = SentryLevel.INFO
sut.log(expectedLevel, expectedMessage, expectedThrowable)
Expand All @@ -106,8 +106,8 @@ class DiagnosticLoggerTest {

@Test
fun `when debug is false option level is debug, a call to log with throwable and level info is not logged`() {
fixture.options!!.isDebug = false
fixture.options!!.setDiagnosticLevel(SentryLevel.DEBUG)
fixture.options.isDebug = false
fixture.options.setDiagnosticLevel(SentryLevel.DEBUG)
val sut = fixture.getSut()
val expectedLevel = SentryLevel.INFO
sut.log(expectedLevel, expectedMessage, expectedThrowable)
Expand All @@ -116,7 +116,7 @@ class DiagnosticLoggerTest {

@Test
fun `when debug is true option level is error, a call to log with throwable and level fatal is logged`() {
fixture.options!!.setDiagnosticLevel(SentryLevel.ERROR)
fixture.options.setDiagnosticLevel(SentryLevel.ERROR)
val sut = fixture.getSut()
val expectedLevel = SentryLevel.FATAL
sut.log(expectedLevel, expectedMessage, expectedThrowable)
Expand All @@ -125,26 +125,26 @@ class DiagnosticLoggerTest {

@Test
fun `when debug is true option level is error, a call to log with throwable and level error is logged`() {
fixture.options!!.setDiagnosticLevel(SentryLevel.ERROR)
fixture.options.setDiagnosticLevel(SentryLevel.ERROR)
val sut = fixture.getSut()
val expectedLevel = fixture.options!!.diagnosticLevel
val expectedLevel = fixture.options.diagnosticLevel
sut.log(expectedLevel, expectedMessage, expectedThrowable)
verify(fixture.logger)!!.log(expectedLevel, expectedMessage, expectedThrowable)
}

@Test
fun `when debug is true option level is error, a call to log and level error is logged`() {
fixture.options!!.setDiagnosticLevel(SentryLevel.ERROR)
fixture.options.setDiagnosticLevel(SentryLevel.ERROR)
val sut = fixture.getSut()
val expectedLevel = fixture.options!!.diagnosticLevel
val expectedLevel = fixture.options.diagnosticLevel
sut.log(expectedLevel, expectedMessage)
verify(fixture.logger)!!.log(expectedLevel, expectedMessage)
}

@Test
fun `when debug is false option level is fatal, a call to log with throwable and level error is not logged`() {
fixture.options!!.isDebug = false
fixture.options!!.setDiagnosticLevel(SentryLevel.FATAL)
fixture.options.isDebug = false
fixture.options.setDiagnosticLevel(SentryLevel.FATAL)
val sut = fixture.getSut()
val expectedLevel = SentryLevel.ERROR
sut.log(expectedLevel, expectedMessage, expectedThrowable)
Expand All @@ -153,7 +153,7 @@ class DiagnosticLoggerTest {

@Test
fun `when debug is true option level is info, a call to log with throwable and level debug is not logged`() {
fixture.options!!.setDiagnosticLevel(SentryLevel.INFO)
fixture.options.setDiagnosticLevel(SentryLevel.INFO)
val sut = fixture.getSut()
val expectedLevel = SentryLevel.DEBUG
sut.log(expectedLevel, expectedMessage, expectedThrowable)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,19 +37,19 @@ class SendCachedEventFireAndForgetIntegrationTest {

@Test
fun `path is invalid if it is null`() {
val sut = fixture.getSut()
fixture.getSut()
assertFalse(fixture.callback.hasValidPath(null, fixture.logger))
}

@Test
fun `path is invalid if it is empty`() {
val sut = fixture.getSut()
fixture.getSut()
assertFalse(fixture.callback.hasValidPath("", fixture.logger))
}

@Test
fun `path is valid if not null or empty`() {
val sut = fixture.getSut()
fixture.getSut()
assertFalse(fixture.callback.hasValidPath("cache", fixture.logger))
}

Expand Down
13 changes: 0 additions & 13 deletions sentry-core/src/test/java/io/sentry/core/SentryClientTest.kt
Original file line number Diff line number Diff line change
Expand Up @@ -403,19 +403,6 @@ class SentryClientTest {
assertEquals(transportGate, sentryOptions.transportGate)
}

@Test
fun `when transport gate is null, it should init an always on transport gate`() {
val sentryOptions: SentryOptions = SentryOptions().apply {
dsn = dsnString
}

val connection = mock<AsyncConnection>()
SentryClient(sentryOptions, connection)

assertNotNull(sentryOptions.transportGate)
assertTrue(sentryOptions.transportGate!!.isConnected)
}

@Test
fun `when scope has event processors, they should be applied`() {
val event = SentryEvent()
Expand Down