@Test void isValidNumOfUniqueTagsTrueTest() { String name = ModelUtils.getTag().getName(); assertEquals(true, tagService.isValidNumOfUniqueTags(Collections.singletonList(name))); }
@Override public Boolean isValidNumOfUniqueTags(List<String> tagNames) { Set<String> tagsSet = new HashSet<>(tagNames); if (tagsSet.size() < tagNames.size()) { throw new DuplicatedTagException(ErrorMessage.DUPLICATED_TAG); } if (tagsSet.size() > ValidationConstants.MAX_AMOUNT_OF_TAGS) { throw new InvalidNumOfTagsException(ErrorMessage.INVALID_NUM_OF_TAGS); } return true; }
TagsServiceImpl implements TagsService { @Override public Boolean isValidNumOfUniqueTags(List<String> tagNames) { Set<String> tagsSet = new HashSet<>(tagNames); if (tagsSet.size() < tagNames.size()) { throw new DuplicatedTagException(ErrorMessage.DUPLICATED_TAG); } if (tagsSet.size() > ValidationConstants.MAX_AMOUNT_OF_TAGS) { throw new InvalidNumOfTagsException(ErrorMessage.INVALID_NUM_OF_TAGS); } return true; } }
TagsServiceImpl implements TagsService { @Override public Boolean isValidNumOfUniqueTags(List<String> tagNames) { Set<String> tagsSet = new HashSet<>(tagNames); if (tagsSet.size() < tagNames.size()) { throw new DuplicatedTagException(ErrorMessage.DUPLICATED_TAG); } if (tagsSet.size() > ValidationConstants.MAX_AMOUNT_OF_TAGS) { throw new InvalidNumOfTagsException(ErrorMessage.INVALID_NUM_OF_TAGS); } return true; }  }
TagsServiceImpl implements TagsService { @Override public Boolean isValidNumOfUniqueTags(List<String> tagNames) { Set<String> tagsSet = new HashSet<>(tagNames); if (tagsSet.size() < tagNames.size()) { throw new DuplicatedTagException(ErrorMessage.DUPLICATED_TAG); } if (tagsSet.size() > ValidationConstants.MAX_AMOUNT_OF_TAGS) { throw new InvalidNumOfTagsException(ErrorMessage.INVALID_NUM_OF_TAGS); } return true; }  @Override List<Tag> findEcoNewsTagsByNames(List<String> ecoNewsTagNames); @Override List<Tag> findTipsAndTricksTagsByNames(List<String> tipsAndTricksTagNames); @Override List<String> findAllEcoNewsTags(); @Override List<String> findAllTipsAndTricksTags(); @Override Boolean isAllTipsAndTricksValid(List<String> tipsAndTricksTagNames); @Override Boolean isValidNumOfUniqueTags(List<String> tagNames); }
TagsServiceImpl implements TagsService { @Override public Boolean isValidNumOfUniqueTags(List<String> tagNames) { Set<String> tagsSet = new HashSet<>(tagNames); if (tagsSet.size() < tagNames.size()) { throw new DuplicatedTagException(ErrorMessage.DUPLICATED_TAG); } if (tagsSet.size() > ValidationConstants.MAX_AMOUNT_OF_TAGS) { throw new InvalidNumOfTagsException(ErrorMessage.INVALID_NUM_OF_TAGS); } return true; }  @Override List<Tag> findEcoNewsTagsByNames(List<String> ecoNewsTagNames); @Override List<Tag> findTipsAndTricksTagsByNames(List<String> tipsAndTricksTagNames); @Override List<String> findAllEcoNewsTags(); @Override List<String> findAllTipsAndTricksTags(); @Override Boolean isAllTipsAndTricksValid(List<String> tipsAndTricksTagNames); @Override Boolean isValidNumOfUniqueTags(List<String> tagNames);  }