コード例 #1
0
 @Test
 public void itUpdatesCategory() {
   Category category = categoryDAO.find((long) 1);
   category.setName("Salads");
   categoryDAO.update(category);
   assertEquals("Salads", categoryDAO.find((long) 1).getName());
 }
コード例 #2
0
 @Test
 public void itAddsNewCategories() {
   Category category = new Category();
   category.setName("Salads");
   categoryDAO.create(category);
   assertEquals("Salads", categoryDAO.find((long) 3).getName());
 }
コード例 #3
0
 @Test
 public void itFindsCategoryByName() {
   Category category = categoryDAO.findByName("Dinner");
   assertNotNull(category);
   assertEquals("Dinner", category.getName());
 }
コード例 #4
0
 @Test
 public void itDeletesCategory() {
   Category category = categoryDAO.find((long) 1);
   categoryDAO.delete(category);
   assertNull(categoryDAO.find((long) 1));
 }