コード例 #1
0
  private List<Tag> createTagList(Group group, int numberOfTags) {
    List<Tag> tagList = new ArrayList<>();
    for (int i = 0; i < numberOfTags; i++) {
      Tag tag = createTag(group);
      tagList.add(tag);
    }

    tagList = tagService.saveAllTagsForGroup(tagList, group);
    return tagList;
  }
コード例 #2
0
  /** Save success */
  @Test
  public void save() {
    Client client = createClient();
    Group group = createGroup(client);

    Tag tag = createTagList(group, 1).get(0);
    Team team = createTeam(client);
    tag = tagService.reload(tag);

    TeamTag afterSaveTeamTag = teamTagService.saveSingleTeamTag(team, tag);
    assertThat("TeamTag was given an id", afterSaveTeamTag.getId(), is(notNullValue()));

    TeamTagSearchFilter searchFilter = new TeamTagSearchFilter();
    HashSet<Tag> tagSet = new HashSet<>();
    tagSet.add(tag);
    searchFilter.setTagSet(tagSet);
    Page<TeamTag> teamsWithTag = teamTagService.findTeamsWithTag(null, searchFilter);
    assertThat(
        "we can find the team tag by the team tag id", teamsWithTag, hasItem(afterSaveTeamTag));
  }