/** Test saveSingleTeamTag */ @Test public void testSaveSingleTeamTag() { Client client = createClient(); Group group = createGroup(client); List<Tag> tagList = createTagList(group, 1); Tag tag = tagList.get(0); Team team1 = createTeam(client); TeamTag teamTag = teamTagService.saveSingleTeamTag(team1, tag); TeamTag newTeamTag = teamTagService.reload(teamTag); assertThat("teamTagPage was saved", newTeamTag.getTag().getId(), is(tag.getId())); }
@Override @Transactional(readOnly = true) public Page<TeamTag> findTeamsWithTag( Pageable pageable, TeamTagSearchFilter teamTagSearchFilter) { Set<Tag> tagSet = teamTagSearchFilter.getTagSet(); Set<Tag> newTagSet = new HashSet<>(); for (Tag tag : tagSet) { tag = tagPersistence.reload(new Tag(tag.getId())); if (tag != null) { newTagSet.add(tag); } } teamTagSearchFilter.setTagSet(newTagSet); return teamTagPersistence.findTeamsWithTag(pageable, teamTagSearchFilter); }
private Tag createTag(Group group) { Tag tag = new Tag(); tag.setName("Test Tag " + RandomStringUtils.randomAlphanumeric(9)); tag.setGroup(group); return tag; }