PrefixedRegex implements MailboxNameExpression { @Override public boolean isWild() { return regex != null && ( regex.indexOf(FREEWILDCARD) >= 0 || regex.indexOf(LOCALWILDCARD) >= 0); } PrefixedRegex(String prefix, String regex, char pathDelimiter); @Override boolean isExpressionMatch(String name); @Override MailboxNameExpression includeChildren(); @Override String getCombinedName(); @Override boolean isWild(); @Override final boolean equals(Object o); @Override final int hashCode();  }
@Test void isWildShouldReturnTrueWhenOnlyFreeWildcard() { PrefixedRegex prefixedRegex = new PrefixedRegex(PREFIX, "*", PATH_DELIMITER); boolean actual = prefixedRegex.isWild(); assertThat(actual).isTrue(); }
@Test void isWildShouldReturnTrueWhenOnlyLocalWildcard() { PrefixedRegex prefixedRegex = new PrefixedRegex(PREFIX, "%", PATH_DELIMITER); boolean actual = prefixedRegex.isWild(); assertThat(actual).isTrue(); }
@Test void isWildShouldReturnTrueWhenFreeWildcardAtBeginning() { PrefixedRegex prefixedRegex = new PrefixedRegex(PREFIX, "*One", PATH_DELIMITER); boolean actual = prefixedRegex.isWild(); assertThat(actual).isTrue(); }
@Test void isWildShouldReturnTrueWhenLocalWildcardAtBeginning() { PrefixedRegex prefixedRegex = new PrefixedRegex(PREFIX, "%One", PATH_DELIMITER); boolean actual = prefixedRegex.isWild(); assertThat(actual).isTrue(); }
@Test void isWildShouldReturnTrueWhenFreeWildcardInMiddle() { PrefixedRegex prefixedRegex = new PrefixedRegex(PREFIX, "A*A", PATH_DELIMITER); boolean actual = prefixedRegex.isWild(); assertThat(actual).isTrue(); }
@Test void isWildShouldReturnTrueWhenLocalWildcardInMiddle() { PrefixedRegex prefixedRegex = new PrefixedRegex(PREFIX, "A%A", PATH_DELIMITER); boolean actual = prefixedRegex.isWild(); assertThat(actual).isTrue(); }
@Test void isWildShouldReturnTrueWhenFreeWildcardAtEnd() { PrefixedRegex prefixedRegex = new PrefixedRegex(PREFIX, "One*", PATH_DELIMITER); boolean actual = prefixedRegex.isWild(); assertThat(actual).isTrue(); }
@Test void isWildShouldReturnTrueWhenLocalWildcardAtEnd() { PrefixedRegex prefixedRegex = new PrefixedRegex(PREFIX, "One%", PATH_DELIMITER); boolean actual = prefixedRegex.isWild(); assertThat(actual).isTrue(); }
@Test void isWildShouldReturnFalseWhenEmptyExpression() { PrefixedRegex prefixedRegex = new PrefixedRegex(PREFIX, "", PATH_DELIMITER); boolean actual = prefixedRegex.isWild(); assertThat(actual).isFalse(); }
@Test void isWildShouldReturnFalseWhenNullExpression() { PrefixedRegex prefixedRegex = new PrefixedRegex(PREFIX, null, PATH_DELIMITER); boolean actual = prefixedRegex.isWild(); assertThat(actual).isFalse(); }
@Test void isWildShouldReturnFalseWhenNoWildcard() { PrefixedRegex prefixedRegex = new PrefixedRegex(PREFIX, "ONE", PATH_DELIMITER); boolean actual = prefixedRegex.isWild(); assertThat(actual).isFalse(); }