@Test void getCombinedNameShouldWork() { PrefixedRegex prefixedRegex = new PrefixedRegex(PREFIX, "mailbox", PATH_DELIMITER); String actual = prefixedRegex.getCombinedName(); assertThat(actual).isEqualTo("name.mailbox"); }
@Override public String getCombinedName() { if (prefix != null && prefix.length() > 0) { final int baseLength = prefix.length(); if (prefix.charAt(baseLength - 1) == pathDelimiter) { if (regex != null && regex.length() > 0) { if (regex.charAt(0) == pathDelimiter) { return prefix + regex.substring(1); } else { return prefix + regex; } } else { return prefix; } } else { if (regex != null && regex.length() > 0) { if (regex.charAt(0) == pathDelimiter) { return prefix + regex; } else { return prefix + pathDelimiter + regex; } } else { return prefix; } } } else { return regex; } }
PrefixedRegex implements MailboxNameExpression { @Override public String getCombinedName() { if (prefix != null && prefix.length() > 0) { final int baseLength = prefix.length(); if (prefix.charAt(baseLength - 1) == pathDelimiter) { if (regex != null && regex.length() > 0) { if (regex.charAt(0) == pathDelimiter) { return prefix + regex.substring(1); } else { return prefix + regex; } } else { return prefix; } } else { if (regex != null && regex.length() > 0) { if (regex.charAt(0) == pathDelimiter) { return prefix + regex; } else { return prefix + pathDelimiter + regex; } } else { return prefix; } } } else { return regex; } } }
PrefixedRegex implements MailboxNameExpression { @Override public String getCombinedName() { if (prefix != null && prefix.length() > 0) { final int baseLength = prefix.length(); if (prefix.charAt(baseLength - 1) == pathDelimiter) { if (regex != null && regex.length() > 0) { if (regex.charAt(0) == pathDelimiter) { return prefix + regex.substring(1); } else { return prefix + regex; } } else { return prefix; } } else { if (regex != null && regex.length() > 0) { if (regex.charAt(0) == pathDelimiter) { return prefix + regex; } else { return prefix + pathDelimiter + regex; } } else { return prefix; } } } else { return regex; } } PrefixedRegex(String prefix, String regex, char pathDelimiter); }
PrefixedRegex implements MailboxNameExpression { @Override public String getCombinedName() { if (prefix != null && prefix.length() > 0) { final int baseLength = prefix.length(); if (prefix.charAt(baseLength - 1) == pathDelimiter) { if (regex != null && regex.length() > 0) { if (regex.charAt(0) == pathDelimiter) { return prefix + regex.substring(1); } else { return prefix + regex; } } else { return prefix; } } else { if (regex != null && regex.length() > 0) { if (regex.charAt(0) == pathDelimiter) { return prefix + regex; } else { return prefix + pathDelimiter + regex; } } else { return prefix; } } } else { return regex; } } 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(); }
PrefixedRegex implements MailboxNameExpression { @Override public String getCombinedName() { if (prefix != null && prefix.length() > 0) { final int baseLength = prefix.length(); if (prefix.charAt(baseLength - 1) == pathDelimiter) { if (regex != null && regex.length() > 0) { if (regex.charAt(0) == pathDelimiter) { return prefix + regex.substring(1); } else { return prefix + regex; } } else { return prefix; } } else { if (regex != null && regex.length() > 0) { if (regex.charAt(0) == pathDelimiter) { return prefix + regex; } else { return prefix + pathDelimiter + regex; } } else { return prefix; } } } else { return regex; } } 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();  }