public String addComment(String containerId, Number taskId, String payload, String marshallingType) { containerId = context.getContainerId(containerId, new ByTaskIdContainerLocator(taskId.longValue())); logger.debug("About to unmarshal task comment from payload: '{}'", payload); TaskComment comment = marshallerHelper.unmarshal(containerId, payload, marshallingType, TaskComment.class); logger.debug("About to set comment on a task with id '{}' with data {}", taskId, comment); Long commentId = userTaskService.addComment(containerId, taskId.longValue(), comment.getText(), comment.getAddedBy(), comment.getAddedAt()); String response = marshallerHelper.marshal(containerId, marshallingType, commentId); return response; }
protected CommentSummary build(TaskComment comment) { CommentSummary summary = new CommentSummary( comment.getId(), comment.getText(), comment.getAddedBy(), comment.getAddedAt() ); return summary; }
assertThat(taskComment.getText()).isEqualTo("May the force be with you!"); assertThat(taskComment.getAddedBy()).isEqualTo(USER_YODA); assertThat(taskComment.getAddedAt()).isEqualTo(commentDate); assertThat(taskComment.getText()).isEqualTo("May the force be with you!"); assertThat(taskComment.getAddedBy()).isEqualTo(USER_YODA); assertThat(taskComment.getAddedAt()).isEqualTo(commentDate);
assertEquals(USER_YODA, firstTaskComment.getAddedBy()); assertEquals(firstCommentId, firstTaskComment.getId()); assertEquals(firstComment, firstTaskComment.getText()); assertEquals(USER_JOHN, secondTaskComment.getAddedBy()); assertEquals(secondCommentId, secondTaskComment.getId()); assertEquals(secondComment, secondTaskComment.getText());