浏览代码

Update Kotlin Test Usage

Issue gh-13539
Josh Cummings 2 年之前
父节点
当前提交
cf79af2386

+ 12 - 6
config/src/test/kotlin/org/springframework/security/config/annotation/web/AuthorizeHttpRequestsDslTests.kt

@@ -124,11 +124,13 @@ class AuthorizeHttpRequestsDslTests {
         @RestController
         @RestController
         internal class PathController {
         internal class PathController {
             @RequestMapping("/path")
             @RequestMapping("/path")
-            fun path() {
+            fun path(): String {
+                return "ok"
             }
             }
 
 
             @RequestMapping("/onlyPostPermitted")
             @RequestMapping("/onlyPostPermitted")
-            fun onlyPostPermitted() {
+            fun onlyPostPermitted():String {
+                return "ok"
             }
             }
         }
         }
     }
     }
@@ -274,7 +276,8 @@ class AuthorizeHttpRequestsDslTests {
         @RestController
         @RestController
         internal class PathController {
         internal class PathController {
             @GetMapping("/")
             @GetMapping("/")
-            fun index() {
+            fun index(): String {
+                return "ok"
             }
             }
         }
         }
 
 
@@ -340,7 +343,8 @@ class AuthorizeHttpRequestsDslTests {
         @RestController
         @RestController
         internal class PathController {
         internal class PathController {
             @GetMapping("/")
             @GetMapping("/")
-            fun index() {
+            fun index(): String {
+                return "ok"
             }
             }
         }
         }
 
 
@@ -405,7 +409,8 @@ class AuthorizeHttpRequestsDslTests {
         @RestController
         @RestController
         internal class PathController {
         internal class PathController {
             @GetMapping("/")
             @GetMapping("/")
-            fun index() {
+            fun index(): String {
+                return "ok"
             }
             }
         }
         }
 
 
@@ -471,7 +476,8 @@ class AuthorizeHttpRequestsDslTests {
         @RestController
         @RestController
         internal class PathController {
         internal class PathController {
             @GetMapping("/")
             @GetMapping("/")
-            fun index() {
+            fun index(): String {
+                return  "ok"
             }
             }
         }
         }
 
 

+ 16 - 8
config/src/test/kotlin/org/springframework/security/config/annotation/web/AuthorizeRequestsDslTests.kt

@@ -114,11 +114,13 @@ class AuthorizeRequestsDslTests {
         @RestController
         @RestController
         internal class PathController {
         internal class PathController {
             @RequestMapping("/path")
             @RequestMapping("/path")
-            fun path() {
+            fun path(): String {
+                return "ok"
             }
             }
 
 
             @RequestMapping("/onlyPostPermitted")
             @RequestMapping("/onlyPostPermitted")
-            fun onlyPostPermitted() {
+            fun onlyPostPermitted(): String {
+                return "ok"
             }
             }
         }
         }
     }
     }
@@ -171,7 +173,8 @@ class AuthorizeRequestsDslTests {
         @RestController
         @RestController
         internal class PathController {
         internal class PathController {
             @RequestMapping("/path")
             @RequestMapping("/path")
-            fun path() {
+            fun path(): String {
+                return "ok"
             }
             }
         }
         }
     }
     }
@@ -327,7 +330,8 @@ class AuthorizeRequestsDslTests {
         @RestController
         @RestController
         internal class PathController {
         internal class PathController {
             @GetMapping("/")
             @GetMapping("/")
-            fun index() {
+            fun index():String {
+                return "ok"
             }
             }
         }
         }
 
 
@@ -398,7 +402,8 @@ class AuthorizeRequestsDslTests {
         @RestController
         @RestController
         internal class PathController {
         internal class PathController {
             @GetMapping("/")
             @GetMapping("/")
-            fun index() {
+            fun index():String {
+                return "ok"
             }
             }
         }
         }
 
 
@@ -461,7 +466,8 @@ class AuthorizeRequestsDslTests {
         @RestController
         @RestController
         internal class PathController {
         internal class PathController {
             @RequestMapping("/path")
             @RequestMapping("/path")
-            fun path() {
+            fun path():String {
+                return "ok"
             }
             }
         }
         }
     }
     }
@@ -484,7 +490,8 @@ class AuthorizeRequestsDslTests {
         @RestController
         @RestController
         internal class PathController {
         internal class PathController {
             @RequestMapping("/path")
             @RequestMapping("/path")
-            fun path() {
+            fun path(): String {
+                return "ok"
             }
             }
         }
         }
     }
     }
@@ -522,7 +529,8 @@ class AuthorizeRequestsDslTests {
         @RestController
         @RestController
         internal class PathController {
         internal class PathController {
             @RequestMapping("/path")
             @RequestMapping("/path")
-            fun path() {
+            fun path(): String {
+                return "ok"
             }
             }
         }
         }
     }
     }

+ 4 - 2
config/src/test/kotlin/org/springframework/security/config/annotation/web/CsrfDslTests.kt

@@ -290,11 +290,13 @@ class CsrfDslTests {
     @RestController
     @RestController
     internal class BasicController {
     internal class BasicController {
         @PostMapping("/test1")
         @PostMapping("/test1")
-        fun test1() {
+        fun test1():String {
+            return "ok"
         }
         }
 
 
         @PostMapping("/test2")
         @PostMapping("/test2")
-        fun test2() {
+        fun test2():String {
+            return "ok"
         }
         }
     }
     }
 
 

+ 2 - 1
config/src/test/kotlin/org/springframework/security/config/annotation/web/HttpBasicDslTests.kt

@@ -217,7 +217,8 @@ class HttpBasicDslTests {
     @RestController
     @RestController
     class MainController {
     class MainController {
         @GetMapping("/")
         @GetMapping("/")
-        fun main() {
+        fun main():String {
+            return "ok"
         }
         }
     }
     }
 }
 }

+ 3 - 1
config/src/test/kotlin/org/springframework/security/config/annotation/web/OAuth2LoginDslTests.kt

@@ -128,7 +128,9 @@ class OAuth2LoginDslTests {
         @RestController
         @RestController
         class LoginController {
         class LoginController {
             @GetMapping("/custom-login")
             @GetMapping("/custom-login")
-            fun loginPage() { }
+            fun loginPage():String {
+                return "ok"
+            }
         }
         }
     }
     }
 
 

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

@@ -201,8 +201,8 @@ public class PrePostAdviceReactiveMethodInterceptor implements MethodInterceptor
 			return ReactiveFlowKt.asFlow(publisher);
 			return ReactiveFlowKt.asFlow(publisher);
 		}
 		}
 
 
-		private static Object awaitSingleOrNull(Publisher<?> publisher, Object continuation) {
-			return MonoKt.awaitSingleOrNull(publisher, (Continuation<?>) continuation);
+		private static Object awaitSingleOrNull(Mono<?> publisher, Object continuation) {
+			return MonoKt.awaitSingleOrNull(publisher, (Continuation<Object>) continuation);
 		}
 		}
 
 
 	}
 	}