@Test public void testGcmTopicExtractionForEmptyCriteria() { final Criteria criteria = new Criteria(); assertThat(TokenLoaderUtils.extractFCMTopics(criteria, "123")).isNotEmpty(); assertThat(TokenLoaderUtils.extractFCMTopics(criteria, "123")).containsOnly( Constants.TOPIC_PREFIX+"123" ); }
public static Set<String> extractFCMTopics(final Criteria criteria, final String variantID) { final Set<String> topics = new TreeSet<>(); if (isEmptyCriteria(criteria)) { topics.add(Constants.TOPIC_PREFIX + variantID); } else if (isCategoryOnlyCriteria(criteria)) { topics.addAll(criteria.getCategories().stream() .map(category -> Constants.TOPIC_PREFIX + category) .collect(Collectors.toList())); } return topics; }
TokenLoaderUtils { public static Set<String> extractFCMTopics(final Criteria criteria, final String variantID) { final Set<String> topics = new TreeSet<>(); if (isEmptyCriteria(criteria)) { topics.add(Constants.TOPIC_PREFIX + variantID); } else if (isCategoryOnlyCriteria(criteria)) { topics.addAll(criteria.getCategories().stream() .map(category -> Constants.TOPIC_PREFIX + category) .collect(Collectors.toList())); } return topics; } }
TokenLoaderUtils { public static Set<String> extractFCMTopics(final Criteria criteria, final String variantID) { final Set<String> topics = new TreeSet<>(); if (isEmptyCriteria(criteria)) { topics.add(Constants.TOPIC_PREFIX + variantID); } else if (isCategoryOnlyCriteria(criteria)) { topics.addAll(criteria.getCategories().stream() .map(category -> Constants.TOPIC_PREFIX + category) .collect(Collectors.toList())); } return topics; } private  TokenLoaderUtils(); }
TokenLoaderUtils { public static Set<String> extractFCMTopics(final Criteria criteria, final String variantID) { final Set<String> topics = new TreeSet<>(); if (isEmptyCriteria(criteria)) { topics.add(Constants.TOPIC_PREFIX + variantID); } else if (isCategoryOnlyCriteria(criteria)) { topics.addAll(criteria.getCategories().stream() .map(category -> Constants.TOPIC_PREFIX + category) .collect(Collectors.toList())); } return topics; } private  TokenLoaderUtils(); static Set<String> extractFCMTopics(final Criteria criteria, final String variantID); static boolean isCategoryOnlyCriteria(final Criteria criteria); static boolean isEmptyCriteria(final Criteria criteria); static boolean isFCMTopicRequest(final Criteria criteria); }
TokenLoaderUtils { public static Set<String> extractFCMTopics(final Criteria criteria, final String variantID) { final Set<String> topics = new TreeSet<>(); if (isEmptyCriteria(criteria)) { topics.add(Constants.TOPIC_PREFIX + variantID); } else if (isCategoryOnlyCriteria(criteria)) { topics.addAll(criteria.getCategories().stream() .map(category -> Constants.TOPIC_PREFIX + category) .collect(Collectors.toList())); } return topics; } private  TokenLoaderUtils(); static Set<String> extractFCMTopics(final Criteria criteria, final String variantID); static boolean isCategoryOnlyCriteria(final Criteria criteria); static boolean isEmptyCriteria(final Criteria criteria); static boolean isFCMTopicRequest(final Criteria criteria);  }