@Test public void testCreateComment() throws Exception { Comment comm = commentService.createComment(task, user, comment); assertEquals(user, comm.getUser()); assertEquals(task, comm.getTask()); assertEquals(comment, comm.getComment()); assertTrue(comm.getId() > 0); comm.delete(); }
@Test public void testGetAllComments() throws Exception { List<Comment> comms = commentService.getAllComments(); for (Comment comm : comms) { assertNotNull(comm); assertNotNull(comm.getUser()); assertNotNull(comm.getTask()); assertNotNull(comm.getComment()); assertNotEquals("", comm.getComment()); assertTrue( comm.getCreated() <= LocalDateTime.now().atZone(ZoneId.systemDefault()).toEpochSecond() * 1000); assertTrue(comm.getId() > 0); } }
@Test public void testFindCommentsByTask() throws Exception { List<Comment> comms = commentService.findCommentsByTask(task); assertTrue(comms.size() >= 0); commentService.createComment(task, user, comment); comms = commentService.findCommentsByTask(task); for (Comment comm : comms) { assertNotNull(comm); assertNotNull(comm.getUser()); assertNotNull(comm.getTask()); assertNotNull(comm.getComment()); assertNotEquals("", comm.getComment()); assertTrue( comm.getCreated() <= LocalDateTime.now().atZone(ZoneId.systemDefault()).toEpochSecond() * 1000); assertTrue(comm.getId() > 0); } }