//TODO @Test if findCommentsByPostId_returns_PostId_not_found
@Test
    public void findAllSubComments_for_comment_returns_collection_status_isFound() throws Exception{
        when(commentService.findCommentsByCommentParentId(anyInt())).thenReturn(Arrays.asList(comments));
        when(userService.findUserById(anyInt())).thenReturn(Optional.of(user));
        when(commentLikeService.checkIfCommentIsLiked(any(Comment.class), any(User.class))).thenReturn(true);
        ResultActions results = mockMvc
                .perform(
                    get("/microblogging/v1/comment/2?requestedUserId=1"))
                .andDo(print());
        results
                .andExpect(status().isOk())
                .andExpect(content().contentType(MediaType.APPLICATION_JSON))
                .andExpect(jsonPath("$.*").isArray())
                .andExpect(jsonPath("$.*",hasSize(4)))
                .andReturn();
    }
@Test
public void findAllSubComments_for_comment_returns_collection_status_isFound() throws Exception{
when(commentService.findCommentsByCommentParentId(anyInt())).thenReturn(Arrays.asList(comments));
when(userService.findUserById(anyInt())).thenReturn(Optional.of(user));
when(commentLikeService.checkIfCommentIsLiked(any(Comment.class), any(User.class))).thenReturn(true);
ResultActions results = mockMvc
.perform(
get("/microblogging/v1/comment/2?requestedUserId=1"))
.andDo(print());
results
.andExpect(status().isOk())
.andExpect(content().contentType(MediaType.APPLICATION_JSON))
.andExpect(jsonPath("$.*").isArray())
.andExpect(jsonPath("$.*",hasSize(4)))
.andReturn();
}
@Test
public void findAllSubComments_for_comment_returns_collection_status_isFound() throws Exception{
when(commentService.findCommentsByCommentParentId(anyInt())).thenReturn(Arrays.asList(comments));
when(userService.findUserById(anyInt())).thenReturn(Optional.of(user));
when(commentLikeService.checkIfCommentIsLiked(any(Comment.class), any(User.class))).thenReturn(true);
ResultActions results = mockMvc
.perform(
get("/microblogging/v1/comment/2?requestedUserId=1"))
.andDo(print());
results
.andExpect(status().isOk())
.andExpect(content().contentType(MediaType.APPLICATION_JSON))
.andExpect(jsonPath("$.*").isArray())
.andExpect(jsonPath("$.*",hasSize(4)))
.andReturn();
}
@Test
public void findAllSubComments_for_comment_returns_collection_status_isFound() throws Exception{
when(commentService.findCommentsByCommentParentId(anyInt())).thenReturn(Arrays.asList(comments));
when(userService.findUserById(anyInt())).thenReturn(Optional.of(user));
when(commentLikeService.checkIfCommentIsLiked(any(Comment.class), any(User.class))).thenReturn(true);
ResultActions results = mockMvc
.perform(
get("/microblogging/v1/comment/2?requestedUserId=1"))
.andDo(print());
results
.andExpect(status().isOk())
.andExpect(content().contentType(MediaType.APPLICATION_JSON))
.andExpect(jsonPath("$.*").isArray())
.andExpect(jsonPath("$.*",hasSize(4)))
.andReturn();
}