Browse Source

Kotlin MockMvc result matchers use parentheses

Closes gh-9155
pull/8765/head
Eleftheria Stein 5 years ago
parent
commit
aac6d2f56b
  1. 2
      config/src/test/kotlin/org/springframework/security/config/web/servlet/AnonymousDslTests.kt
  2. 40
      config/src/test/kotlin/org/springframework/security/config/web/servlet/AuthorizeRequestsDslTests.kt
  3. 18
      config/src/test/kotlin/org/springframework/security/config/web/servlet/CsrfDslTests.kt
  4. 16
      config/src/test/kotlin/org/springframework/security/config/web/servlet/ExceptionHandlingDslTests.kt
  5. 8
      config/src/test/kotlin/org/springframework/security/config/web/servlet/FormLoginDslTests.kt
  6. 4
      config/src/test/kotlin/org/springframework/security/config/web/servlet/HttpBasicDslTests.kt
  7. 16
      config/src/test/kotlin/org/springframework/security/config/web/servlet/HttpSecurityDslTests.kt
  8. 20
      config/src/test/kotlin/org/springframework/security/config/web/servlet/LogoutDslTests.kt
  9. 4
      config/src/test/kotlin/org/springframework/security/config/web/servlet/OAuth2LoginDslTests.kt
  10. 2
      config/src/test/kotlin/org/springframework/security/config/web/servlet/Saml2DslTests.kt
  11. 2
      config/src/test/kotlin/org/springframework/security/config/web/servlet/oauth2/resourceserver/OpaqueTokenDslTests.kt

2
config/src/test/kotlin/org/springframework/security/config/web/servlet/AnonymousDslTests.kt

@ -119,7 +119,7 @@ class AnonymousDslTests { @@ -119,7 +119,7 @@ class AnonymousDslTests {
this.mockMvc.get("/principal")
.andExpect {
status { isOk }
status { isOk() }
}
}

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

@ -65,7 +65,7 @@ class AuthorizeRequestsDslTests { @@ -65,7 +65,7 @@ class AuthorizeRequestsDslTests {
this.mockMvc.get("/private")
.andExpect {
status { isForbidden }
status { isForbidden() }
}
}
@ -75,7 +75,7 @@ class AuthorizeRequestsDslTests { @@ -75,7 +75,7 @@ class AuthorizeRequestsDslTests {
this.mockMvc.get("/path")
.andExpect {
status { isOk }
status { isOk() }
}
}
@ -85,12 +85,12 @@ class AuthorizeRequestsDslTests { @@ -85,12 +85,12 @@ class AuthorizeRequestsDslTests {
this.mockMvc.post("/onlyPostPermitted") { with(csrf()) }
.andExpect {
status { isOk }
status { isOk() }
}
this.mockMvc.get("/onlyPostPermitted")
.andExpect {
status { isForbidden }
status { isForbidden() }
}
}
@ -125,7 +125,7 @@ class AuthorizeRequestsDslTests { @@ -125,7 +125,7 @@ class AuthorizeRequestsDslTests {
this.mockMvc.get("/private")
.andExpect {
status { isForbidden }
status { isForbidden() }
}
}
@ -135,17 +135,17 @@ class AuthorizeRequestsDslTests { @@ -135,17 +135,17 @@ class AuthorizeRequestsDslTests {
this.mockMvc.get("/path")
.andExpect {
status { isOk }
status { isOk() }
}
this.mockMvc.get("/path.html")
.andExpect {
status { isOk }
status { isOk() }
}
this.mockMvc.get("/path/")
.andExpect {
status { isOk }
status { isOk() }
}
}
@ -182,12 +182,12 @@ class AuthorizeRequestsDslTests { @@ -182,12 +182,12 @@ class AuthorizeRequestsDslTests {
this.mockMvc.get("/user/user")
.andExpect {
status { isOk }
status { isOk() }
}
this.mockMvc.get("/user/deny")
.andExpect {
status { isForbidden }
status { isForbidden() }
}
}
@ -217,7 +217,7 @@ class AuthorizeRequestsDslTests { @@ -217,7 +217,7 @@ class AuthorizeRequestsDslTests {
this.mockMvc.get("/") {
with(httpBasic("admin", "password"))
}.andExpect {
status { isOk }
status { isOk() }
}
}
@ -228,7 +228,7 @@ class AuthorizeRequestsDslTests { @@ -228,7 +228,7 @@ class AuthorizeRequestsDslTests {
this.mockMvc.get("/") {
with(httpBasic("user", "password"))
}.andExpect {
status { isForbidden }
status { isForbidden() }
}
}
@ -274,13 +274,13 @@ class AuthorizeRequestsDslTests { @@ -274,13 +274,13 @@ class AuthorizeRequestsDslTests {
this.mockMvc.get("/") {
with(httpBasic("user", "password"))
}.andExpect {
status { isOk }
status { isOk() }
}
this.mockMvc.get("/") {
with(httpBasic("admin", "password"))
}.andExpect {
status { isOk }
status { isOk() }
}
}
@ -291,7 +291,7 @@ class AuthorizeRequestsDslTests { @@ -291,7 +291,7 @@ class AuthorizeRequestsDslTests {
this.mockMvc.get("/") {
with(httpBasic("other", "password"))
}.andExpect {
status { isForbidden }
status { isForbidden() }
}
}
@ -342,13 +342,13 @@ class AuthorizeRequestsDslTests { @@ -342,13 +342,13 @@ class AuthorizeRequestsDslTests {
this.mockMvc.get("/") {
with(httpBasic("user", "password"))
}.andExpect {
status { isOk }
status { isOk() }
}
this.mockMvc.get("/") {
with(httpBasic("admin", "password"))
}.andExpect {
status { isOk }
status { isOk() }
}
}
@ -359,7 +359,7 @@ class AuthorizeRequestsDslTests { @@ -359,7 +359,7 @@ class AuthorizeRequestsDslTests {
this.mockMvc.get("/") {
with(httpBasic("other", "password"))
}.andExpect {
status { isForbidden }
status { isForbidden() }
}
}
@ -469,12 +469,12 @@ class AuthorizeRequestsDslTests { @@ -469,12 +469,12 @@ class AuthorizeRequestsDslTests {
this.mockMvc.get("/path")
.andExpect {
status { isOk }
status { isOk() }
}
this.mockMvc.put("/path") { with(csrf()) }
.andExpect {
status { isForbidden }
status { isForbidden() }
}
}

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

@ -62,7 +62,7 @@ class CsrfDslTests { @@ -62,7 +62,7 @@ class CsrfDslTests {
this.mockMvc.post("/test1")
.andExpect {
status { isForbidden }
status { isForbidden() }
}
}
@ -73,7 +73,7 @@ class CsrfDslTests { @@ -73,7 +73,7 @@ class CsrfDslTests {
this.mockMvc.post("/test1") {
with(csrf())
}.andExpect {
status { isOk }
status { isOk() }
}
}
@ -93,7 +93,7 @@ class CsrfDslTests { @@ -93,7 +93,7 @@ class CsrfDslTests {
this.mockMvc.post("/test1")
.andExpect {
status { isOk }
status { isOk() }
}
}
@ -141,12 +141,12 @@ class CsrfDslTests { @@ -141,12 +141,12 @@ class CsrfDslTests {
this.mockMvc.post("/test1")
.andExpect {
status { isForbidden }
status { isForbidden() }
}
this.mockMvc.post("/test2")
.andExpect {
status { isOk }
status { isOk() }
}
}
@ -204,12 +204,12 @@ class CsrfDslTests { @@ -204,12 +204,12 @@ class CsrfDslTests {
this.mockMvc.post("/test1")
.andExpect {
status { isForbidden }
status { isForbidden() }
}
this.mockMvc.post("/test2")
.andExpect {
status { isOk }
status { isOk() }
}
}
@ -231,12 +231,12 @@ class CsrfDslTests { @@ -231,12 +231,12 @@ class CsrfDslTests {
this.mockMvc.post("/test1")
.andExpect {
status { isForbidden }
status { isForbidden() }
}
this.mockMvc.post("/test2")
.andExpect {
status { isOk }
status { isOk() }
}
}

16
config/src/test/kotlin/org/springframework/security/config/web/servlet/ExceptionHandlingDslTests.kt

@ -52,7 +52,7 @@ class ExceptionHandlingDslTests { @@ -52,7 +52,7 @@ class ExceptionHandlingDslTests {
this.mockMvc.get("/")
.andExpect {
status { isForbidden }
status { isForbidden() }
}
}
@ -97,7 +97,7 @@ class ExceptionHandlingDslTests { @@ -97,7 +97,7 @@ class ExceptionHandlingDslTests {
this.mockMvc.get("/admin") {
with(user(withUsername("user").password("password").roles("USER").build()))
}.andExpect {
status { isForbidden }
status { isForbidden() }
forwardedUrl("/access-denied")
}
}
@ -125,7 +125,7 @@ class ExceptionHandlingDslTests { @@ -125,7 +125,7 @@ class ExceptionHandlingDslTests {
this.mockMvc.get("/admin") {
with(user(withUsername("user").password("password").roles("USER").build()))
}.andExpect {
status { isForbidden }
status { isForbidden() }
forwardedUrl("/access-denied")
}
}
@ -155,14 +155,14 @@ class ExceptionHandlingDslTests { @@ -155,14 +155,14 @@ class ExceptionHandlingDslTests {
this.mockMvc.get("/admin1") {
with(user(withUsername("user").password("password").roles("USER").build()))
}.andExpect {
status { isForbidden }
status { isForbidden() }
forwardedUrl("/access-denied1")
}
this.mockMvc.get("/admin2") {
with(user(withUsername("user").password("password").roles("USER").build()))
}.andExpect {
status { isForbidden }
status { isForbidden() }
forwardedUrl("/access-denied2")
}
}
@ -195,7 +195,7 @@ class ExceptionHandlingDslTests { @@ -195,7 +195,7 @@ class ExceptionHandlingDslTests {
this.mockMvc.get("/")
.andExpect {
status { isFound }
status { isFound() }
redirectedUrl("http://localhost/custom-login")
}
}
@ -221,13 +221,13 @@ class ExceptionHandlingDslTests { @@ -221,13 +221,13 @@ class ExceptionHandlingDslTests {
this.mockMvc.get("/secured1")
.andExpect {
status { isFound }
status { isFound() }
redirectedUrl("http://localhost/custom-login1")
}
this.mockMvc.get("/secured2")
.andExpect {
status { isFound }
status { isFound() }
redirectedUrl("http://localhost/custom-login2")
}
}

8
config/src/test/kotlin/org/springframework/security/config/web/servlet/FormLoginDslTests.kt

@ -55,7 +55,7 @@ class FormLoginDslTests { @@ -55,7 +55,7 @@ class FormLoginDslTests {
this.mockMvc.get("/login")
.andExpect {
status { isOk }
status { isOk() }
}
}
@ -96,7 +96,7 @@ class FormLoginDslTests { @@ -96,7 +96,7 @@ class FormLoginDslTests {
this.mockMvc.get("/")
.andExpect {
status { isFound }
status { isFound() }
redirectedUrl("http://localhost/login")
}
}
@ -119,7 +119,7 @@ class FormLoginDslTests { @@ -119,7 +119,7 @@ class FormLoginDslTests {
this.mockMvc.get("/")
.andExpect {
status { isFound }
status { isFound() }
redirectedUrl("http://localhost/log-in")
}
}
@ -254,7 +254,7 @@ class FormLoginDslTests { @@ -254,7 +254,7 @@ class FormLoginDslTests {
this.mockMvc.get("/custom/login")
.andExpect {
status { isOk }
status { isOk() }
}
}

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

@ -61,7 +61,7 @@ class HttpBasicDslTests { @@ -61,7 +61,7 @@ class HttpBasicDslTests {
this.mockMvc.get("/")
.andExpect {
status { isUnauthorized }
status { isUnauthorized() }
}
}
@ -82,7 +82,7 @@ class HttpBasicDslTests { @@ -82,7 +82,7 @@ class HttpBasicDslTests {
this.mockMvc.get("/") {
with(httpBasic("user", "password"))
}.andExpect {
status { isOk }
status { isOk() }
}
}

16
config/src/test/kotlin/org/springframework/security/config/web/servlet/HttpSecurityDslTests.kt

@ -63,7 +63,7 @@ class HttpSecurityDslTests { @@ -63,7 +63,7 @@ class HttpSecurityDslTests {
this.mockMvc.post("/")
.andExpect {
status { isForbidden }
status { isForbidden() }
}
}
@ -124,7 +124,7 @@ class HttpSecurityDslTests { @@ -124,7 +124,7 @@ class HttpSecurityDslTests {
this.mockMvc.get("/")
.andExpect {
status { isNotFound }
status { isNotFound() }
}
}
@ -134,7 +134,7 @@ class HttpSecurityDslTests { @@ -134,7 +134,7 @@ class HttpSecurityDslTests {
this.mockMvc.get("/path")
.andExpect {
status { isForbidden }
status { isForbidden() }
}
}
@ -156,7 +156,7 @@ class HttpSecurityDslTests { @@ -156,7 +156,7 @@ class HttpSecurityDslTests {
this.mockMvc.get("/")
.andExpect {
status { isNotFound }
status { isNotFound() }
}
}
@ -166,7 +166,7 @@ class HttpSecurityDslTests { @@ -166,7 +166,7 @@ class HttpSecurityDslTests {
this.mockMvc.get("/path")
.andExpect {
status { isForbidden }
status { isForbidden() }
}
}
@ -189,17 +189,17 @@ class HttpSecurityDslTests { @@ -189,17 +189,17 @@ class HttpSecurityDslTests {
this.mockMvc.get("/path1")
.andExpect {
status { isForbidden }
status { isForbidden() }
}
this.mockMvc.get("/path2")
.andExpect {
status { isForbidden }
status { isForbidden() }
}
this.mockMvc.get("/path3")
.andExpect {
status { isNotFound }
status { isNotFound() }
}
}

20
config/src/test/kotlin/org/springframework/security/config/web/servlet/LogoutDslTests.kt

@ -58,7 +58,7 @@ class LogoutDslTests { @@ -58,7 +58,7 @@ class LogoutDslTests {
this.mockMvc.post("/custom/logout") {
with(csrf())
}.andExpect {
status { isFound }
status { isFound() }
redirectedUrl("/login?logout")
}
}
@ -81,7 +81,7 @@ class LogoutDslTests { @@ -81,7 +81,7 @@ class LogoutDslTests {
this.mockMvc.post("/custom/logout") {
with(csrf())
}.andExpect {
status { isFound }
status { isFound() }
redirectedUrl("/login?logout")
}
}
@ -104,7 +104,7 @@ class LogoutDslTests { @@ -104,7 +104,7 @@ class LogoutDslTests {
this.mockMvc.post("/logout") {
with(csrf())
}.andExpect {
status { isFound }
status { isFound() }
redirectedUrl("/login")
}
}
@ -127,7 +127,7 @@ class LogoutDslTests { @@ -127,7 +127,7 @@ class LogoutDslTests {
this.mockMvc.post("/logout") {
with(csrf())
}.andExpect {
status { isFound }
status { isFound() }
redirectedUrl("/")
}
}
@ -150,7 +150,7 @@ class LogoutDslTests { @@ -150,7 +150,7 @@ class LogoutDslTests {
this.mockMvc.post("/custom/logout") {
with(csrf())
}.andExpect {
status { isFound }
status { isFound() }
redirectedUrl("/login?logout")
}
}
@ -182,7 +182,7 @@ class LogoutDslTests { @@ -182,7 +182,7 @@ class LogoutDslTests {
with(csrf())
session = currentSession
}.andExpect {
status { isFound }
status { isFound() }
redirectedUrl("/login?logout")
}
@ -209,7 +209,7 @@ class LogoutDslTests { @@ -209,7 +209,7 @@ class LogoutDslTests {
with(csrf())
session = currentSession
}.andExpect {
status { isFound }
status { isFound() }
redirectedUrl("/login?logout")
}
@ -234,7 +234,7 @@ class LogoutDslTests { @@ -234,7 +234,7 @@ class LogoutDslTests {
this.mockMvc.post("/logout") {
with(csrf())
}.andExpect {
status { isFound }
status { isFound() }
redirectedUrl("/login?logout")
cookie { maxAge("remove", 0) }
}
@ -258,14 +258,14 @@ class LogoutDslTests { @@ -258,14 +258,14 @@ class LogoutDslTests {
this.mockMvc.post("/logout/default") {
with(csrf())
}.andExpect {
status { isFound }
status { isFound() }
redirectedUrl("/login?logout")
}
this.mockMvc.post("/logout/custom") {
with(csrf())
}.andExpect {
status { isFound }
status { isFound() }
redirectedUrl("/")
}
}

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

@ -72,7 +72,7 @@ class OAuth2LoginDslTests { @@ -72,7 +72,7 @@ class OAuth2LoginDslTests {
this.mockMvc.get("/login")
.andExpect {
status { isOk }
status { isOk() }
}
}
@ -91,7 +91,7 @@ class OAuth2LoginDslTests { @@ -91,7 +91,7 @@ class OAuth2LoginDslTests {
this.mockMvc.get("/custom-login")
.andExpect {
status { isOk }
status { isOk() }
}
}

2
config/src/test/kotlin/org/springframework/security/config/web/servlet/Saml2DslTests.kt

@ -72,7 +72,7 @@ class Saml2DslTests { @@ -72,7 +72,7 @@ class Saml2DslTests {
this.mockMvc.get("/login")
.andExpect {
status { isOk }
status { isOk() }
}
}

2
config/src/test/kotlin/org/springframework/security/config/web/servlet/oauth2/resourceserver/OpaqueTokenDslTests.kt

@ -72,7 +72,7 @@ class OpaqueTokenDslTests { @@ -72,7 +72,7 @@ class OpaqueTokenDslTests {
this.mockMvc.get("/authenticated") {
header("Authorization", "Bearer token")
}.andExpect {
status { isOk }
status { isOk() }
content { string("test-subject") }
}
}

Loading…
Cancel
Save