@Test
  public void getExistingBlogEntry() throws Exception {
    BlogEntry entry = new BlogEntry();
    entry.setId(1L);
    entry.setTitle("Test Title");

    Blog blog = new Blog();
    blog.setId(1L);

    entry.setBlog(blog);

    when(service.findBlogEntry(1L)).thenReturn(entry);

    mockMvc
        .perform(get("/rest/blog-entries/1"))
        .andExpect(jsonPath("$.title", is(entry.getTitle())))
        .andExpect(
            jsonPath(
                "$.links[*].href", hasItems(endsWith("/blogs/1"), endsWith("/blog-entries/1"))))
        .andExpect(jsonPath("$.links[*].rel", hasItems(is("self"), is("blog"))))
        .andExpect(status().isOk());
  }
  @Test
  public void getNonExistingBlogEntry() throws Exception {
    when(service.findBlogEntry(1L)).thenReturn(null);

    mockMvc.perform(get("/rest/blog-entries/1")).andExpect(status().isNotFound());
  }