Skip to content
This repository was archived by the owner on Aug 30, 2023. It is now read-only.

Commit 7bbbe08

Browse files
authored
ref: fix test linting (#491)
1 parent 89b011b commit 7bbbe08

File tree

3 files changed

+19
-32
lines changed

3 files changed

+19
-32
lines changed

sentry-core/src/test/java/io/sentry/core/DiagnosticLoggerTest.kt

Lines changed: 16 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ class DiagnosticLoggerTest {
3939

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

@@ -61,7 +61,7 @@ class DiagnosticLoggerTest {
6161

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

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

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

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

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

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

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

126126
@Test
127127
fun `when debug is true option level is error, a call to log with throwable and level error is logged`() {
128-
fixture.options!!.setDiagnosticLevel(SentryLevel.ERROR)
128+
fixture.options.setDiagnosticLevel(SentryLevel.ERROR)
129129
val sut = fixture.getSut()
130-
val expectedLevel = fixture.options!!.diagnosticLevel
130+
val expectedLevel = fixture.options.diagnosticLevel
131131
sut.log(expectedLevel, expectedMessage, expectedThrowable)
132132
verify(fixture.logger)!!.log(expectedLevel, expectedMessage, expectedThrowable)
133133
}
134134

135135
@Test
136136
fun `when debug is true option level is error, a call to log and level error is logged`() {
137-
fixture.options!!.setDiagnosticLevel(SentryLevel.ERROR)
137+
fixture.options.setDiagnosticLevel(SentryLevel.ERROR)
138138
val sut = fixture.getSut()
139-
val expectedLevel = fixture.options!!.diagnosticLevel
139+
val expectedLevel = fixture.options.diagnosticLevel
140140
sut.log(expectedLevel, expectedMessage)
141141
verify(fixture.logger)!!.log(expectedLevel, expectedMessage)
142142
}
143143

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

154154
@Test
155155
fun `when debug is true option level is info, a call to log with throwable and level debug is not logged`() {
156-
fixture.options!!.setDiagnosticLevel(SentryLevel.INFO)
156+
fixture.options.setDiagnosticLevel(SentryLevel.INFO)
157157
val sut = fixture.getSut()
158158
val expectedLevel = SentryLevel.DEBUG
159159
sut.log(expectedLevel, expectedMessage, expectedThrowable)

sentry-core/src/test/java/io/sentry/core/SendCachedEventFireAndForgetIntegrationTest.kt

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -37,19 +37,19 @@ class SendCachedEventFireAndForgetIntegrationTest {
3737

3838
@Test
3939
fun `path is invalid if it is null`() {
40-
val sut = fixture.getSut()
40+
fixture.getSut()
4141
assertFalse(fixture.callback.hasValidPath(null, fixture.logger))
4242
}
4343

4444
@Test
4545
fun `path is invalid if it is empty`() {
46-
val sut = fixture.getSut()
46+
fixture.getSut()
4747
assertFalse(fixture.callback.hasValidPath("", fixture.logger))
4848
}
4949

5050
@Test
5151
fun `path is valid if not null or empty`() {
52-
val sut = fixture.getSut()
52+
fixture.getSut()
5353
assertFalse(fixture.callback.hasValidPath("cache", fixture.logger))
5454
}
5555

sentry-core/src/test/java/io/sentry/core/SentryClientTest.kt

Lines changed: 0 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -403,19 +403,6 @@ class SentryClientTest {
403403
assertEquals(transportGate, sentryOptions.transportGate)
404404
}
405405

406-
@Test
407-
fun `when transport gate is null, it should init an always on transport gate`() {
408-
val sentryOptions: SentryOptions = SentryOptions().apply {
409-
dsn = dsnString
410-
}
411-
412-
val connection = mock<AsyncConnection>()
413-
SentryClient(sentryOptions, connection)
414-
415-
assertNotNull(sentryOptions.transportGate)
416-
assertTrue(sentryOptions.transportGate!!.isConnected)
417-
}
418-
419406
@Test
420407
fun `when scope has event processors, they should be applied`() {
421408
val event = SentryEvent()

0 commit comments

Comments
 (0)