@Test
  public void findAllCommentaries() throws Exception {
    List<Commentary> list = new ArrayList<Commentary>();

    Commentary commentaryA = new Commentary();
    commentaryA.setId(1L);
    commentaryA.setContent("content A");
    list.add(commentaryA);

    Commentary commentaryB = new Commentary();
    commentaryB.setId(2L);
    commentaryB.setContent("content B");
    list.add(commentaryB);

    CommentaryList allCommentaries = new CommentaryList(list);

    when(commentaryService.findAllCommentaries()).thenReturn(allCommentaries);

    mockMvc
        .perform(get("/rest/commentaries"))
        .andExpect(
            jsonPath(
                "$.commentaries[*].content",
                hasItems(endsWith("content A"), endsWith("content B"))))
        .andExpect(status().isOk());
  }
  @Test
  public void getCommentary() throws Exception {
    Commentary commentary = new Commentary();
    commentary.setContent("Test content");
    commentary.setId(1L);

    Account account = new Account();
    account.setId(1L);
    commentary.setOwner(account);

    when(commentaryService.findCommentary(1L)).thenReturn(commentary);

    mockMvc
        .perform(get("/rest/commentaries/1"))
        .andExpect(jsonPath("$.links[*].href", hasItem(endsWith("/commentaries/1"))))
        .andExpect(
            jsonPath("$.links[*].href", hasItem(endsWith("/commentaries/1/comment-entries"))))
        .andExpect(jsonPath("$.links[*].href", hasItem(endsWith("/accounts/1"))))
        .andExpect(jsonPath("$.links[*].rel", hasItems(is("self"), is("owner"), is("entries"))))
        .andExpect(jsonPath("$.content", is("Test content")))
        .andExpect(status().isOk());
  }