@Test
public void update() throws TodoNotFoundException {
TodoDTO formObject = TodoTestUtil.createFormObject(TodoTestUtil.ID, TodoTestUtil.DESCRIPTION_UPDATED, TodoTestUtil.TITLE_UPDATED);
Todo model = TodoTestUtil.createModel(TodoTestUtil.ID, TodoTestUtil.DESCRIPTION_UPDATED, TodoTestUtil.TITLE_UPDATED);
when(serviceMock.update(formObject)).thenReturn(model);
MockHttpServletRequest mockRequest = new MockHttpServletRequest("POST", "/todo/add");
BindingResult result = bindAndValidate(mockRequest, formObject);
RedirectAttributesModelMap attributes = new RedirectAttributesModelMap();
initMessageSourceForFeedbackMessage(TodoController.FEEDBACK_MESSAGE_KEY_TODO_UPDATED);
String view = controller.update(formObject, result, attributes);
verify(serviceMock, times(1)).update(formObject);
verifyNoMoreInteractions(serviceMock);
String expectedView = TodoTestUtil.createRedirectViewPath(TodoController.REQUEST_MAPPING_TODO_VIEW);
assertEquals(expectedView, view);
assertEquals(Long.valueOf((String) attributes.get(TodoController.PARAMETER_TODO_ID)), model.getId());
assertFeedbackMessage(attributes, TodoController.FEEDBACK_MESSAGE_KEY_TODO_UPDATED);
}