Beispiel #1
0
  @Test
  @Transactional
  public void getBlog() throws Exception {
    // Initialize the database
    blogRepository.saveAndFlush(blog);

    // Get the blog
    restBlogMockMvc
        .perform(get("/api/blogs/{id}", blog.getId()))
        .andExpect(status().isOk())
        .andExpect(content().contentType(MediaType.APPLICATION_JSON))
        .andExpect(jsonPath("$.id").value(blog.getId().intValue()))
        .andExpect(jsonPath("$.name").value(DEFAULT_NAME.toString()))
        .andExpect(jsonPath("$.handle").value(DEFAULT_HANDLE.toString()));
  }
Beispiel #2
0
  @Test
  @Transactional
  public void deleteBlog() throws Exception {
    // Initialize the database
    blogRepository.saveAndFlush(blog);

    int databaseSizeBeforeDelete = blogRepository.findAll().size();

    // Get the blog
    restBlogMockMvc
        .perform(delete("/api/blogs/{id}", blog.getId()).accept(TestUtil.APPLICATION_JSON_UTF8))
        .andExpect(status().isOk());

    // Validate the database is empty
    List<Blog> blogs = blogRepository.findAll();
    assertThat(blogs).hasSize(databaseSizeBeforeDelete - 1);
  }