コード例 #1
0
ファイル: CategoryServiceTest.java プロジェクト: Holdo/perun
  @Test(expected = DataIntegrityViolationException.class)
  public void deleteCategoryWhenPublicationExistsTest() throws Exception {
    System.out.println("CategoryService.deleteCategoryWhenPublicationExistsTest");

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

  }
コード例 #2
0
ファイル: CategoryServiceTest.java プロジェクト: Holdo/perun
  @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);
  }