示例#1
0
  @Test(expected = DataIntegrityViolationException.class)
  public void deleteCategoryWhenPublicationExistsTest() throws Exception {
    System.out.println("CategoryService.deleteCategoryWhenPublicationExistsTest");

    categoryService.deleteCategoryById(c1.getId());
    // should throw exception

  }
示例#2
0
  @Test
  public void deleteCategoryTest() throws Exception {
    System.out.println("CategoryService.deleteCategoryTest");

    Category c = new Category(null, "Patent4", 1.0);
    int id = categoryService.createCategory(c);
    int result = categoryService.deleteCategoryById(id);

    assertTrue("There should be exactly 1 category deleted, but was: " + result, result == 1);
  }