示例#1
0
  @Test
  public void testGetCategory() throws Exception {
    categoryDao.save(category);

    Category cat = categoryDao.findOne(category.getId());
    assertNotNull(cat);
    assertEquals(category, cat);
  }
示例#2
0
  @Test
  public void testRemoveCategory() throws Exception {
    categoryDao.save(category);

    Category cat = categoryDao.findOne(category.getId());
    assertNotNull(cat.getId());
    assertEquals(category, cat);

    categoryDao.delete(category.getId());
    assertTrue(getIterableSize(categoryDao.findAll()) == 0);
  }
示例#3
0
  @Test
  public void testUpdateCategory() throws Exception {
    categoryDao.save(category);
    category.setName(CATEGOY_NAME + "MDF");
    category.setDescription(CATEGORY_DESCRIPTION + "MDF");
    categoryDao.save(category); // pourquoi on fait deux fois save?
    // Est-ce que c'est parce que la premiere va faire un create, et la 2nd un update?

    Category categorymdf = categoryDao.findOne(category.getId());
    assertEquals(category, categorymdf);
  }