code: private static void validateCategories(String... categories) {
  
          for (String category : categories) {
              if (!category.matches(FCM_TOPIC_PATTERN)) {
                  throw new IllegalArgumentException(String.format("%s does not match %s", category, FCM_TOPIC_PATTERN));
              }
          }
      }
docs: Validates categories against Google's pattern.
  
  @param categories a group of Strings each will be validated.
  
  @throws IllegalArgumentException if a category fails to match [a-zA-Z0-9-_.~%]+