Skip to content

Commit b41f2c1

Browse files
committed
build: tests: remove some kotlin warnnings
1 parent 0054368 commit b41f2c1

7 files changed

Lines changed: 28 additions & 34 deletions

File tree

tests/src/test/kotlin/i2465/Issue2465.kt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -35,13 +35,13 @@ class Issue2465 {
3535
client.get("/2465") { rsp ->
3636
Assertions.assertEquals("/2465", rsp.header("After"))
3737
Assertions.assertEquals("false", rsp.header("Response-Started"))
38-
Assertions.assertEquals("/2465", rsp.body!!.string())
38+
Assertions.assertEquals("/2465", rsp.body.string())
3939
}
4040

4141
client.get("/fun/2465") { rsp ->
4242
Assertions.assertEquals("/fun/2465", rsp.header("After"))
4343
Assertions.assertEquals("false", rsp.header("Response-Started"))
44-
Assertions.assertEquals("/fun/2465", rsp.body!!.string())
44+
Assertions.assertEquals("/fun/2465", rsp.body.string())
4545
}
4646
}
4747
}

tests/src/test/kotlin/i2710/Issue2710.kt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ class Issue2710 {
3131
}
3232
}
3333
.ready { client ->
34-
client.get("/2710") { rsp -> Assertions.assertEquals("OK", rsp.body!!.string()) }
34+
client.get("/2710") { rsp -> Assertions.assertEquals("OK", rsp.body.string()) }
3535
}
3636
latch.await()
3737
}

tests/src/test/kotlin/i3228/Issue3228.kt

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -59,13 +59,13 @@ class Issue3228 {
5959
}
6060
.ready { client ->
6161
client.get("/i3228/without-worker") { rsp ->
62-
Assertions.assertEquals("nonBlocking: true, coroutine: true", rsp.body!!.string())
62+
Assertions.assertEquals("nonBlocking: true, coroutine: true", rsp.body.string())
6363
}
6464
client.get("/i3228/without-worker-no-coroutine") { rsp ->
65-
Assertions.assertEquals("nonBlocking: true, coroutine: true", rsp.body!!.string())
65+
Assertions.assertEquals("nonBlocking: true, coroutine: true", rsp.body.string())
6666
}
6767
client.get("/i3228/with-worker") { rsp ->
68-
Assertions.assertEquals("nonBlocking: true, coroutine: true", rsp.body!!.string())
68+
Assertions.assertEquals("nonBlocking: true, coroutine: true", rsp.body.string())
6969
}
7070
}
7171
}

tests/src/test/kotlin/i3405/Issue3405.kt

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ class Issue3405 {
2525
}
2626
.ready { client ->
2727
client.get("/i3405/normal-error") { rsp ->
28-
assertEquals("normal/global", rsp.body!!.string())
28+
assertEquals("normal/global", rsp.body.string())
2929
}
3030
}
3131

@@ -50,7 +50,7 @@ class Issue3405 {
5050
}
5151
.ready { client ->
5252
client.get("/i3405/coroutine-error") { rsp ->
53-
assertEquals("coroutine/suspended", rsp.body!!.string())
53+
assertEquals("coroutine/suspended", rsp.body.string())
5454
}
5555
}
5656

@@ -73,8 +73,8 @@ class Issue3405 {
7373
}
7474
.ready { client ->
7575
client.get("/i3405/coroutine-error") { rsp ->
76-
assertEquals("coroutine/suspended", rsp.body!!.string())
76+
assertEquals("coroutine/suspended", rsp.body.string())
7777
}
78-
client.get("/i3405/chain") { rsp -> assertEquals("conflict", rsp.body!!.string()) }
78+
client.get("/i3405/chain") { rsp -> assertEquals("conflict", rsp.body.string()) }
7979
}
8080
}

tests/src/test/kotlin/i3476/Issue3476.kt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,5 +21,5 @@ class Issue3476 {
2121
mvc(C3476_())
2222
}
2323
}
24-
.ready { client -> client.get("/3476") { rsp -> assertEquals("[]", rsp.body!!.string()) } }
24+
.ready { client -> client.get("/3476") { rsp -> assertEquals("[]", rsp.body.string()) } }
2525
}

tests/src/test/kotlin/i3477/Issue3477.kt

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -22,8 +22,6 @@ class Issue3477 {
2222
}
2323
}
2424
.ready { client ->
25-
client.get("/3477") { rsp ->
26-
assertEquals("{\"Transactional\":false}", rsp.body!!.string())
27-
}
25+
client.get("/3477") { rsp -> assertEquals("{\"Transactional\":false}", rsp.body.string()) }
2826
}
2927
}

tests/src/test/kotlin/io/jooby/FeaturedKotlinTest.kt

Lines changed: 16 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ class FeaturedKotlinTest {
2727
runner
2828
.define { app -> app.get("/") { "Hello World!" } }
2929
.ready { client ->
30-
client.get("/") { rsp -> assertEquals("Hello World!", rsp.body!!.string()) }
30+
client.get("/") { rsp -> assertEquals("Hello World!", rsp.body.string()) }
3131
}
3232
}
3333

@@ -36,17 +36,15 @@ class FeaturedKotlinTest {
3636
runner
3737
.use { -> Kooby { get("/") { ctx.send("Hello World!") } } }
3838
.ready { client ->
39-
client.get("/") { rsp -> assertEquals("Hello World!", rsp.body!!.string()) }
39+
client.get("/") { rsp -> assertEquals("Hello World!", rsp.body.string()) }
4040
}
4141
}
4242

4343
@ServerTest
4444
fun coroutineNoSuspend(runner: ServerTestRunner) {
4545
runner
4646
.use { -> Kooby { coroutine { get("/") { ctx.getRequestPath() + "coroutine" } } } }
47-
.ready { client ->
48-
client.get("/") { rsp -> assertEquals("/coroutine", rsp.body!!.string()) }
49-
}
47+
.ready { client -> client.get("/") { rsp -> assertEquals("/coroutine", rsp.body.string()) } }
5048
}
5149

5250
@ServerTest
@@ -62,9 +60,7 @@ class FeaturedKotlinTest {
6260
}
6361
}
6462
}
65-
.ready { client ->
66-
client.get("/") { rsp -> assertEquals("/coroutine", rsp.body!!.string()) }
67-
}
63+
.ready { client -> client.get("/") { rsp -> assertEquals("/coroutine", rsp.body.string()) } }
6864
}
6965

7066
@ServerTest
@@ -83,7 +79,7 @@ class FeaturedKotlinTest {
8379
}
8480
}
8581
.ready { client ->
86-
client.get("/") { rsp -> assertEquals("1,2,3,4,5,6,7,8,9,10,", rsp.body!!.string()) }
82+
client.get("/") { rsp -> assertEquals("1,2,3,4,5,6,7,8,9,10,", rsp.body.string()) }
8783
}
8884
}
8985

@@ -92,16 +88,16 @@ class FeaturedKotlinTest {
9288
runner
9389
.define { app -> app.mvc(KotlinMvc_()) }
9490
.ready { client ->
95-
client.get("/kotlin") { rsp -> assertEquals("Got it!", rsp.body!!.string()) }
91+
client.get("/kotlin") { rsp -> assertEquals("Got it!", rsp.body.string()) }
9692

97-
client.get("/kotlin/78") { rsp -> assertEquals("78", rsp.body!!.string()) }
93+
client.get("/kotlin/78") { rsp -> assertEquals("78", rsp.body.string()) }
9894

9995
client.get("/kotlin/point?x=8&y=1") { rsp ->
100-
assertEquals("QueryPoint(x=8, y=1) : 8", rsp.body!!.string())
96+
assertEquals("QueryPoint(x=8, y=1) : 8", rsp.body.string())
10197
}
10298

10399
client.get("/kotlin/point") { rsp ->
104-
val body = rsp.body!!.string()
100+
val body = rsp.body.string()
105101
assertTrue(
106102
body.contains(
107103
"Cannot convert value: 'null', to: 'io.jooby.internal.mvc.QueryPoint'"
@@ -110,11 +106,11 @@ class FeaturedKotlinTest {
110106
}
111107

112108
client.get("/kotlin/point?x=9") { rsp ->
113-
assertEquals("QueryPoint(x=9, y=null) : 9", rsp.body!!.string())
109+
assertEquals("QueryPoint(x=9, y=null) : 9", rsp.body.string())
114110
}
115111

116112
client.get("/kotlin/point?x=9&y=8") { rsp ->
117-
assertEquals("QueryPoint(x=9, y=8) : 9", rsp.body!!.string())
113+
assertEquals("QueryPoint(x=9, y=8) : 9", rsp.body.string())
118114
}
119115
}
120116
}
@@ -133,14 +129,14 @@ class FeaturedKotlinTest {
133129
}
134130
}
135131
.ready { client ->
136-
client.get("/") { rsp -> assertEquals("Got it!", rsp.body!!.string()) }
132+
client.get("/") { rsp -> assertEquals("Got it!", rsp.body.string()) }
137133

138-
client.get("/delay") { rsp -> assertEquals("/delay", rsp.body!!.string()) }
134+
client.get("/delay") { rsp -> assertEquals("/delay", rsp.body.string()) }
139135

140-
client.get("/456") { rsp -> assertEquals("456", rsp.body!!.string()) }
136+
client.get("/456") { rsp -> assertEquals("456", rsp.body.string()) }
141137

142138
client.get("/456x") { rsp ->
143-
assertEquals("Cannot convert value: 'id', to: 'int'", rsp.body!!.string())
139+
assertEquals("Cannot convert value: 'id', to: 'int'", rsp.body.string())
144140
}
145141
}
146142
}
@@ -174,7 +170,7 @@ class FeaturedKotlinTest {
174170
}
175171
.ready { client ->
176172
client.get("/") { rsp ->
177-
val json = JSONObject(rsp.body!!.string())
173+
val json = JSONObject(rsp.body.string())
178174
assertNotEquals("<<none>>", json.get("key"))
179175
assertNotEquals("<<none>>", json.get("thread"))
180176
assertNotEquals(json.get("thread"), json.get("currentThread"))

0 commit comments

Comments
 (0)