Code example for MockMvc

Methods: perform

0
 
    @Test
    public void deleteThePost() throws Exception {
        MockHttpServletRequestBuilder editPostRequest = createDeletePostRequest();
 
        mockMvc.perform(editPostRequest);
        assertThat(postRepository.findOne(post.getId()), is(nullValue()));
    } 
 
    private MockHttpServletRequestBuilder createDeletePostRequest() {
        MockHttpServletRequestBuilder editPostRequest = delete("/admin/blog/" + post.getAdminSlug());
        return editPostRequest;
    } 
 
} 
Contextual code suggestions in your IDE  Get Codota for Java