@Test void testValidateTopicLevels() throws Exception { AbstractTopic.validateTopicLevels(toTopicLevels("test", "", "level")); AbstractTopic.validateTopicLevels(toTopicLevels("", "test", "")); AbstractTopic.validateTopicLevels(toTopicLevels("test", "+", "level")); AbstractTopic.validateTopicLevels(toTopicLevels("test", "level", "#")); AbstractTopic.validateTopicLevels(toTopicLevels("+", "+", "#")); AbstractTopic.validateTopicLevels(toTopicLevels("#")); AbstractTopic.validateTopicLevels(toTopicLevels("+")); AbstractTopic.validateTopicLevels(toTopicLevels("", "#")); }
protected static void validateTopicLevels(List<TopicLevel> levels) throws TopicFormatException { for (int i = 0; i < (levels.size() - 1); i++) { if (levels.get(i).isMultiLevelWildcard()) throw new TopicFormatException("Only the last level may be a multi level wildcard"); } }
AbstractTopic implements Topic { protected static void validateTopicLevels(List<TopicLevel> levels) throws TopicFormatException { for (int i = 0; i < (levels.size() - 1); i++) { if (levels.get(i).isMultiLevelWildcard()) throw new TopicFormatException("Only the last level may be a multi level wildcard"); } } }
AbstractTopic implements Topic { protected static void validateTopicLevels(List<TopicLevel> levels) throws TopicFormatException { for (int i = 0; i < (levels.size() - 1); i++) { if (levels.get(i).isMultiLevelWildcard()) throw new TopicFormatException("Only the last level may be a multi level wildcard"); } } protected  AbstractTopic(String topicString); }
AbstractTopic implements Topic { protected static void validateTopicLevels(List<TopicLevel> levels) throws TopicFormatException { for (int i = 0; i < (levels.size() - 1); i++) { if (levels.get(i).isMultiLevelWildcard()) throw new TopicFormatException("Only the last level may be a multi level wildcard"); } } protected  AbstractTopic(String topicString); @Override String getStringRepresentation(); @Override List<TopicLevel> getTopicLevels(); @Override boolean isSpecialTopic(); @Override String toString(); @Override int hashCode(); @Override boolean equals(Object obj); }
AbstractTopic implements Topic { protected static void validateTopicLevels(List<TopicLevel> levels) throws TopicFormatException { for (int i = 0; i < (levels.size() - 1); i++) { if (levels.get(i).isMultiLevelWildcard()) throw new TopicFormatException("Only the last level may be a multi level wildcard"); } } protected  AbstractTopic(String topicString); @Override String getStringRepresentation(); @Override List<TopicLevel> getTopicLevels(); @Override boolean isSpecialTopic(); @Override String toString(); @Override int hashCode(); @Override boolean equals(Object obj);  }