Пример #1
0
  public void testDeleteTag() throws AlreadyExistsException {
    // Create new claim
    Claim claim =
        new Claim("name", new Date(), new Date(), "description", new User("Test", "User"), 0);

    // Populate tags list with new unique tags
    for (int i = 1; i <= 10; i++) {
      String s = String.valueOf(i);
      claim.addTag(s);
    }

    // Make sure tags list is populated
    assertTrue("Tags list empty after populating", claim.getTagList().size() > 0);

    while (claim.getTagList().size() > 0) {
      // Get tag at index 0
      String tag = claim.getTagList().get(0);

      // Remove tag
      claim.removeTag(0);

      // Make sure tag was removed
      assertFalse("Claim still has removed tag", claim.getTagList().contains(tag));
    }

    // Make sure tags list properly emptied
    assertEquals("Tags list not fully emptied", 0, claim.getTagList().size());
  }