Skip to content

Commit cf79af2

Browse files
committed
Update Kotlin Test Usage
Issue gh-13539
1 parent a08036a commit cf79af2

File tree

6 files changed

+39
-20
lines changed

6 files changed

+39
-20
lines changed

config/src/test/kotlin/org/springframework/security/config/annotation/web/AuthorizeHttpRequestsDslTests.kt

Lines changed: 12 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -124,11 +124,13 @@ class AuthorizeHttpRequestsDslTests {
124124
@RestController
125125
internal class PathController {
126126
@RequestMapping("/path")
127-
fun path() {
127+
fun path(): String {
128+
return "ok"
128129
}
129130

130131
@RequestMapping("/onlyPostPermitted")
131-
fun onlyPostPermitted() {
132+
fun onlyPostPermitted():String {
133+
return "ok"
132134
}
133135
}
134136
}
@@ -274,7 +276,8 @@ class AuthorizeHttpRequestsDslTests {
274276
@RestController
275277
internal class PathController {
276278
@GetMapping("/")
277-
fun index() {
279+
fun index(): String {
280+
return "ok"
278281
}
279282
}
280283

@@ -340,7 +343,8 @@ class AuthorizeHttpRequestsDslTests {
340343
@RestController
341344
internal class PathController {
342345
@GetMapping("/")
343-
fun index() {
346+
fun index(): String {
347+
return "ok"
344348
}
345349
}
346350

@@ -405,7 +409,8 @@ class AuthorizeHttpRequestsDslTests {
405409
@RestController
406410
internal class PathController {
407411
@GetMapping("/")
408-
fun index() {
412+
fun index(): String {
413+
return "ok"
409414
}
410415
}
411416

@@ -471,7 +476,8 @@ class AuthorizeHttpRequestsDslTests {
471476
@RestController
472477
internal class PathController {
473478
@GetMapping("/")
474-
fun index() {
479+
fun index(): String {
480+
return "ok"
475481
}
476482
}
477483

config/src/test/kotlin/org/springframework/security/config/annotation/web/AuthorizeRequestsDslTests.kt

Lines changed: 16 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -114,11 +114,13 @@ class AuthorizeRequestsDslTests {
114114
@RestController
115115
internal class PathController {
116116
@RequestMapping("/path")
117-
fun path() {
117+
fun path(): String {
118+
return "ok"
118119
}
119120

120121
@RequestMapping("/onlyPostPermitted")
121-
fun onlyPostPermitted() {
122+
fun onlyPostPermitted(): String {
123+
return "ok"
122124
}
123125
}
124126
}
@@ -171,7 +173,8 @@ class AuthorizeRequestsDslTests {
171173
@RestController
172174
internal class PathController {
173175
@RequestMapping("/path")
174-
fun path() {
176+
fun path(): String {
177+
return "ok"
175178
}
176179
}
177180
}
@@ -327,7 +330,8 @@ class AuthorizeRequestsDslTests {
327330
@RestController
328331
internal class PathController {
329332
@GetMapping("/")
330-
fun index() {
333+
fun index():String {
334+
return "ok"
331335
}
332336
}
333337

@@ -398,7 +402,8 @@ class AuthorizeRequestsDslTests {
398402
@RestController
399403
internal class PathController {
400404
@GetMapping("/")
401-
fun index() {
405+
fun index():String {
406+
return "ok"
402407
}
403408
}
404409

@@ -461,7 +466,8 @@ class AuthorizeRequestsDslTests {
461466
@RestController
462467
internal class PathController {
463468
@RequestMapping("/path")
464-
fun path() {
469+
fun path():String {
470+
return "ok"
465471
}
466472
}
467473
}
@@ -484,7 +490,8 @@ class AuthorizeRequestsDslTests {
484490
@RestController
485491
internal class PathController {
486492
@RequestMapping("/path")
487-
fun path() {
493+
fun path(): String {
494+
return "ok"
488495
}
489496
}
490497
}
@@ -522,7 +529,8 @@ class AuthorizeRequestsDslTests {
522529
@RestController
523530
internal class PathController {
524531
@RequestMapping("/path")
525-
fun path() {
532+
fun path(): String {
533+
return "ok"
526534
}
527535
}
528536
}

config/src/test/kotlin/org/springframework/security/config/annotation/web/CsrfDslTests.kt

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -290,11 +290,13 @@ class CsrfDslTests {
290290
@RestController
291291
internal class BasicController {
292292
@PostMapping("/test1")
293-
fun test1() {
293+
fun test1():String {
294+
return "ok"
294295
}
295296

296297
@PostMapping("/test2")
297-
fun test2() {
298+
fun test2():String {
299+
return "ok"
298300
}
299301
}
300302

config/src/test/kotlin/org/springframework/security/config/annotation/web/HttpBasicDslTests.kt

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -217,7 +217,8 @@ class HttpBasicDslTests {
217217
@RestController
218218
class MainController {
219219
@GetMapping("/")
220-
fun main() {
220+
fun main():String {
221+
return "ok"
221222
}
222223
}
223224
}

config/src/test/kotlin/org/springframework/security/config/annotation/web/OAuth2LoginDslTests.kt

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -128,7 +128,9 @@ class OAuth2LoginDslTests {
128128
@RestController
129129
class LoginController {
130130
@GetMapping("/custom-login")
131-
fun loginPage() { }
131+
fun loginPage():String {
132+
return "ok"
133+
}
132134
}
133135
}
134136

core/src/main/java/org/springframework/security/access/prepost/PrePostAdviceReactiveMethodInterceptor.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -201,8 +201,8 @@ private static Object asFlow(Publisher<?> publisher) {
201201
return ReactiveFlowKt.asFlow(publisher);
202202
}
203203

204-
private static Object awaitSingleOrNull(Publisher<?> publisher, Object continuation) {
205-
return MonoKt.awaitSingleOrNull(publisher, (Continuation<?>) continuation);
204+
private static Object awaitSingleOrNull(Mono<?> publisher, Object continuation) {
205+
return MonoKt.awaitSingleOrNull(publisher, (Continuation<Object>) continuation);
206206
}
207207

208208
}

0 commit comments

Comments
 (0)