-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathPost.java
More file actions
30 lines (25 loc) · 1013 Bytes
/
Post.java
File metadata and controls
30 lines (25 loc) · 1013 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
package it.aboutbits.springboot.testing.web.request;
import lombok.NonNull;
import org.springframework.test.web.servlet.MockMvc;
import org.springframework.test.web.servlet.request.MockHttpServletRequestBuilder;
import org.springframework.test.web.servlet.request.MockMvcRequestBuilders;
import tools.jackson.databind.json.JsonMapper;
import static org.springframework.http.MediaType.APPLICATION_JSON;
public class Post extends Request<MockHttpServletRequestBuilder> {
Post(
@NonNull MockMvc mockMvc,
@NonNull JsonMapper objectMapper,
@NonNull String url,
@NonNull Object... pathVariables
) {
super(mockMvc, objectMapper, url, APPLICATION_JSON, pathVariables);
}
@Override
protected @NonNull MockHttpServletRequestBuilder getRequestBuilder(@NonNull UrlWithVariables url) {
return MockMvcRequestBuilders.post(url.url(), url.pathVariables());
}
@Override
protected boolean useCsrf() {
return true;
}
}