@Test
 public void updateNonExistingBlogEntry() throws Exception {
   when(service.updateBlogEntry(eq(1L), any(BlogEntry.class))).thenReturn(null);
   mockMvc
       .perform(
           put("/rest/blog-entries/1")
               .content("{\"title\":\"Test Title\"}")
               .contentType(MediaType.APPLICATION_JSON))
       .andExpect(status().isNotFound());
 }
 @Test
 public void updateExistingBlogEntry() throws Exception {
   BlogEntry updatedEntry = new BlogEntry();
   updatedEntry.setId(1L);
   updatedEntry.setTitle("Test Title");
   when(service.updateBlogEntry(eq(1L), any(BlogEntry.class))).thenReturn(updatedEntry);
   mockMvc
       .perform(
           put("/rest/blog-entries/1")
               .content("{\"title\":\"Test Title\"}")
               .contentType(MediaType.APPLICATION_JSON))
       .andExpect(jsonPath("$.title", is(updatedEntry.getTitle())))
       .andExpect(jsonPath("$.links[*].href", hasItem(endsWith("/blog-entries/1"))))
       .andExpect(status().isOk());
 }