Created
November 5, 2013 00:49
-
-
Save dannyduc/7312002 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@Test | |
public void addTodo() throws Exception { | |
final Todo formObject = new Todo(); | |
formObject.setTitle("my title"); | |
formObject.setDescription("some description"); | |
mockMvc.perform(post("/todo/add") | |
.contentType(MediaType.APPLICATION_FORM_URLENCODED) | |
.with(new RequestPostProcessor() { | |
@Override | |
public MockHttpServletRequest postProcessRequest(MockHttpServletRequest request) { | |
IntegrationTestUtil.addParameters(formObject, request); | |
return request; | |
} | |
}) | |
).andDo(print()) | |
.andExpect(status().is(302)) | |
.andExpect(view().name("redirect:/todo/update/{id}")) | |
.andExpect(redirectedUrl("/todo/update/1")) | |
; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment