Skip to content

Commit aac6d2f

Browse files
committed
Kotlin MockMvc result matchers use parentheses
Closes gh-9155
1 parent 9b66929 commit aac6d2f

File tree

11 files changed

+66
-66
lines changed

11 files changed

+66
-66
lines changed

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -119,7 +119,7 @@ class AnonymousDslTests {
119119

120120
this.mockMvc.get("/principal")
121121
.andExpect {
122-
status { isOk }
122+
status { isOk() }
123123
}
124124
}
125125

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

Lines changed: 20 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,7 @@ class AuthorizeRequestsDslTests {
6565

6666
this.mockMvc.get("/private")
6767
.andExpect {
68-
status { isForbidden }
68+
status { isForbidden() }
6969
}
7070
}
7171

@@ -75,7 +75,7 @@ class AuthorizeRequestsDslTests {
7575

7676
this.mockMvc.get("/path")
7777
.andExpect {
78-
status { isOk }
78+
status { isOk() }
7979
}
8080
}
8181

@@ -85,12 +85,12 @@ class AuthorizeRequestsDslTests {
8585

8686
this.mockMvc.post("/onlyPostPermitted") { with(csrf()) }
8787
.andExpect {
88-
status { isOk }
88+
status { isOk() }
8989
}
9090

9191
this.mockMvc.get("/onlyPostPermitted")
9292
.andExpect {
93-
status { isForbidden }
93+
status { isForbidden() }
9494
}
9595
}
9696

@@ -125,7 +125,7 @@ class AuthorizeRequestsDslTests {
125125

126126
this.mockMvc.get("/private")
127127
.andExpect {
128-
status { isForbidden }
128+
status { isForbidden() }
129129
}
130130
}
131131

@@ -135,17 +135,17 @@ class AuthorizeRequestsDslTests {
135135

136136
this.mockMvc.get("/path")
137137
.andExpect {
138-
status { isOk }
138+
status { isOk() }
139139
}
140140

141141
this.mockMvc.get("/path.html")
142142
.andExpect {
143-
status { isOk }
143+
status { isOk() }
144144
}
145145

146146
this.mockMvc.get("/path/")
147147
.andExpect {
148-
status { isOk }
148+
status { isOk() }
149149
}
150150
}
151151

@@ -182,12 +182,12 @@ class AuthorizeRequestsDslTests {
182182

183183
this.mockMvc.get("/user/user")
184184
.andExpect {
185-
status { isOk }
185+
status { isOk() }
186186
}
187187

188188
this.mockMvc.get("/user/deny")
189189
.andExpect {
190-
status { isForbidden }
190+
status { isForbidden() }
191191
}
192192
}
193193

@@ -217,7 +217,7 @@ class AuthorizeRequestsDslTests {
217217
this.mockMvc.get("/") {
218218
with(httpBasic("admin", "password"))
219219
}.andExpect {
220-
status { isOk }
220+
status { isOk() }
221221
}
222222
}
223223

@@ -228,7 +228,7 @@ class AuthorizeRequestsDslTests {
228228
this.mockMvc.get("/") {
229229
with(httpBasic("user", "password"))
230230
}.andExpect {
231-
status { isForbidden }
231+
status { isForbidden() }
232232
}
233233
}
234234

@@ -274,13 +274,13 @@ class AuthorizeRequestsDslTests {
274274
this.mockMvc.get("/") {
275275
with(httpBasic("user", "password"))
276276
}.andExpect {
277-
status { isOk }
277+
status { isOk() }
278278
}
279279

280280
this.mockMvc.get("/") {
281281
with(httpBasic("admin", "password"))
282282
}.andExpect {
283-
status { isOk }
283+
status { isOk() }
284284
}
285285
}
286286

@@ -291,7 +291,7 @@ class AuthorizeRequestsDslTests {
291291
this.mockMvc.get("/") {
292292
with(httpBasic("other", "password"))
293293
}.andExpect {
294-
status { isForbidden }
294+
status { isForbidden() }
295295
}
296296
}
297297

@@ -342,13 +342,13 @@ class AuthorizeRequestsDslTests {
342342
this.mockMvc.get("/") {
343343
with(httpBasic("user", "password"))
344344
}.andExpect {
345-
status { isOk }
345+
status { isOk() }
346346
}
347347

348348
this.mockMvc.get("/") {
349349
with(httpBasic("admin", "password"))
350350
}.andExpect {
351-
status { isOk }
351+
status { isOk() }
352352
}
353353
}
354354

@@ -359,7 +359,7 @@ class AuthorizeRequestsDslTests {
359359
this.mockMvc.get("/") {
360360
with(httpBasic("other", "password"))
361361
}.andExpect {
362-
status { isForbidden }
362+
status { isForbidden() }
363363
}
364364
}
365365

@@ -469,12 +469,12 @@ class AuthorizeRequestsDslTests {
469469

470470
this.mockMvc.get("/path")
471471
.andExpect {
472-
status { isOk }
472+
status { isOk() }
473473
}
474474

475475
this.mockMvc.put("/path") { with(csrf()) }
476476
.andExpect {
477-
status { isForbidden }
477+
status { isForbidden() }
478478
}
479479
}
480480

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

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,7 @@ class CsrfDslTests {
6262

6363
this.mockMvc.post("/test1")
6464
.andExpect {
65-
status { isForbidden }
65+
status { isForbidden() }
6666
}
6767
}
6868

@@ -73,7 +73,7 @@ class CsrfDslTests {
7373
this.mockMvc.post("/test1") {
7474
with(csrf())
7575
}.andExpect {
76-
status { isOk }
76+
status { isOk() }
7777
}
7878

7979
}
@@ -93,7 +93,7 @@ class CsrfDslTests {
9393

9494
this.mockMvc.post("/test1")
9595
.andExpect {
96-
status { isOk }
96+
status { isOk() }
9797
}
9898
}
9999

@@ -141,12 +141,12 @@ class CsrfDslTests {
141141

142142
this.mockMvc.post("/test1")
143143
.andExpect {
144-
status { isForbidden }
144+
status { isForbidden() }
145145
}
146146

147147
this.mockMvc.post("/test2")
148148
.andExpect {
149-
status { isOk }
149+
status { isOk() }
150150
}
151151
}
152152

@@ -204,12 +204,12 @@ class CsrfDslTests {
204204

205205
this.mockMvc.post("/test1")
206206
.andExpect {
207-
status { isForbidden }
207+
status { isForbidden() }
208208
}
209209

210210
this.mockMvc.post("/test2")
211211
.andExpect {
212-
status { isOk }
212+
status { isOk() }
213213
}
214214
}
215215

@@ -231,12 +231,12 @@ class CsrfDslTests {
231231

232232
this.mockMvc.post("/test1")
233233
.andExpect {
234-
status { isForbidden }
234+
status { isForbidden() }
235235
}
236236

237237
this.mockMvc.post("/test2")
238238
.andExpect {
239-
status { isOk }
239+
status { isOk() }
240240
}
241241
}
242242

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

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@ class ExceptionHandlingDslTests {
5252

5353
this.mockMvc.get("/")
5454
.andExpect {
55-
status { isForbidden }
55+
status { isForbidden() }
5656
}
5757
}
5858

@@ -97,7 +97,7 @@ class ExceptionHandlingDslTests {
9797
this.mockMvc.get("/admin") {
9898
with(user(withUsername("user").password("password").roles("USER").build()))
9999
}.andExpect {
100-
status { isForbidden }
100+
status { isForbidden() }
101101
forwardedUrl("/access-denied")
102102
}
103103
}
@@ -125,7 +125,7 @@ class ExceptionHandlingDslTests {
125125
this.mockMvc.get("/admin") {
126126
with(user(withUsername("user").password("password").roles("USER").build()))
127127
}.andExpect {
128-
status { isForbidden }
128+
status { isForbidden() }
129129
forwardedUrl("/access-denied")
130130
}
131131
}
@@ -155,14 +155,14 @@ class ExceptionHandlingDslTests {
155155
this.mockMvc.get("/admin1") {
156156
with(user(withUsername("user").password("password").roles("USER").build()))
157157
}.andExpect {
158-
status { isForbidden }
158+
status { isForbidden() }
159159
forwardedUrl("/access-denied1")
160160
}
161161

162162
this.mockMvc.get("/admin2") {
163163
with(user(withUsername("user").password("password").roles("USER").build()))
164164
}.andExpect {
165-
status { isForbidden }
165+
status { isForbidden() }
166166
forwardedUrl("/access-denied2")
167167
}
168168
}
@@ -195,7 +195,7 @@ class ExceptionHandlingDslTests {
195195

196196
this.mockMvc.get("/")
197197
.andExpect {
198-
status { isFound }
198+
status { isFound() }
199199
redirectedUrl("http://localhost/custom-login")
200200
}
201201
}
@@ -221,13 +221,13 @@ class ExceptionHandlingDslTests {
221221

222222
this.mockMvc.get("/secured1")
223223
.andExpect {
224-
status { isFound }
224+
status { isFound() }
225225
redirectedUrl("http://localhost/custom-login1")
226226
}
227227

228228
this.mockMvc.get("/secured2")
229229
.andExpect {
230-
status { isFound }
230+
status { isFound() }
231231
redirectedUrl("http://localhost/custom-login2")
232232
}
233233
}

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

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@ class FormLoginDslTests {
5555

5656
this.mockMvc.get("/login")
5757
.andExpect {
58-
status { isOk }
58+
status { isOk() }
5959
}
6060
}
6161

@@ -96,7 +96,7 @@ class FormLoginDslTests {
9696

9797
this.mockMvc.get("/")
9898
.andExpect {
99-
status { isFound }
99+
status { isFound() }
100100
redirectedUrl("http://localhost/login")
101101
}
102102
}
@@ -119,7 +119,7 @@ class FormLoginDslTests {
119119

120120
this.mockMvc.get("/")
121121
.andExpect {
122-
status { isFound }
122+
status { isFound() }
123123
redirectedUrl("http://localhost/log-in")
124124
}
125125
}
@@ -254,7 +254,7 @@ class FormLoginDslTests {
254254

255255
this.mockMvc.get("/custom/login")
256256
.andExpect {
257-
status { isOk }
257+
status { isOk() }
258258
}
259259
}
260260

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

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,7 @@ class HttpBasicDslTests {
6161

6262
this.mockMvc.get("/")
6363
.andExpect {
64-
status { isUnauthorized }
64+
status { isUnauthorized() }
6565
}
6666
}
6767

@@ -82,7 +82,7 @@ class HttpBasicDslTests {
8282
this.mockMvc.get("/") {
8383
with(httpBasic("user", "password"))
8484
}.andExpect {
85-
status { isOk }
85+
status { isOk() }
8686
}
8787
}
8888

0 commit comments

Comments
 (0)