@Test void canCreateTagSearchString() { final String one = "oNe"; final String two = "TwO"; final String three = "3"; final Set<TagEntity> tags = Sets.newHashSet(); Assertions .assertThat(PredicateUtils.createTagSearchString(tags)) .isEqualTo( PredicateUtils.TAG_DELIMITER + PredicateUtils.TAG_DELIMITER ); final TagEntity oneTag = new TagEntity(); oneTag.setTag(one); final TagEntity twoTag = new TagEntity(); twoTag.setTag(two); final TagEntity threeTag = new TagEntity(); threeTag.setTag(three); tags.add(oneTag); Assertions .assertThat(PredicateUtils.createTagSearchString(tags)) .isEqualTo( PredicateUtils.TAG_DELIMITER + one + PredicateUtils.TAG_DELIMITER ); tags.add(twoTag); Assertions.assertThat(PredicateUtils.createTagSearchString(tags)) .isEqualTo( PredicateUtils.TAG_DELIMITER + one + PredicateUtils.TAG_DELIMITER + PredicateUtils.TAG_DELIMITER + two + PredicateUtils.TAG_DELIMITER ); tags.add(threeTag); Assertions.assertThat(PredicateUtils.createTagSearchString(tags)) .isEqualTo( PredicateUtils.TAG_DELIMITER + three + PredicateUtils.TAG_DELIMITER + PredicateUtils.TAG_DELIMITER + one + PredicateUtils.TAG_DELIMITER + PredicateUtils.TAG_DELIMITER + two + PredicateUtils.TAG_DELIMITER ); }
public static String createTagSearchString(final Set<TagEntity> tags) { return TAG_DELIMITER + tags .stream() .map(TagEntity::getTag) .sorted(String.CASE_INSENSITIVE_ORDER) .reduce((one, two) -> one + TAG_DELIMITER + TAG_DELIMITER + two) .orElse("") + TAG_DELIMITER; }
PredicateUtils { public static String createTagSearchString(final Set<TagEntity> tags) { return TAG_DELIMITER + tags .stream() .map(TagEntity::getTag) .sorted(String.CASE_INSENSITIVE_ORDER) .reduce((one, two) -> one + TAG_DELIMITER + TAG_DELIMITER + two) .orElse("") + TAG_DELIMITER; } }
PredicateUtils { public static String createTagSearchString(final Set<TagEntity> tags) { return TAG_DELIMITER + tags .stream() .map(TagEntity::getTag) .sorted(String.CASE_INSENSITIVE_ORDER) .reduce((one, two) -> one + TAG_DELIMITER + TAG_DELIMITER + two) .orElse("") + TAG_DELIMITER; } private  PredicateUtils(); }
PredicateUtils { public static String createTagSearchString(final Set<TagEntity> tags) { return TAG_DELIMITER + tags .stream() .map(TagEntity::getTag) .sorted(String.CASE_INSENSITIVE_ORDER) .reduce((one, two) -> one + TAG_DELIMITER + TAG_DELIMITER + two) .orElse("") + TAG_DELIMITER; } private  PredicateUtils(); static String createTagSearchString(final Set<TagEntity> tags); }
PredicateUtils { public static String createTagSearchString(final Set<TagEntity> tags) { return TAG_DELIMITER + tags .stream() .map(TagEntity::getTag) .sorted(String.CASE_INSENSITIVE_ORDER) .reduce((one, two) -> one + TAG_DELIMITER + TAG_DELIMITER + two) .orElse("") + TAG_DELIMITER; } private  PredicateUtils(); static String createTagSearchString(final Set<TagEntity> tags);  }