servlet-test-mockmvc-request-builders.md 692 字节
Newer Older
茶陵後's avatar
茶陵後 已提交
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19
## SecurityMockMvcRequestBuilders

Spring MVC Test also provides a `RequestBuilder` interface that can be used to create the `MockHttpServletRequest` used in your test.
Spring Security provides a few `RequestBuilder` implementations that can be used to make testing easier.
In order to use Spring Security’s `RequestBuilder` implementations ensure the following static import is used:

Java

```
import static org.springframework.security.test.web.servlet.request.SecurityMockMvcRequestBuilders.*;
```

Kotlin

```
import org.springframework.security.test.web.servlet.request.SecurityMockMvcRequestBuilders.*
```

[Mocking Logout](logout.html)[Security ResultMatchers](result-matchers.html)