@Test void initShouldThrowWhenEmptyCondition() { assertThatThrownBy(() -> matcher.init(FakeMatcherConfig.builder() .matcherName("SenderIsRegex") .build())) .isInstanceOf(MessagingException.class); }
@Override public void init() throws MessagingException { String patternString = getCondition(); if (Strings.isNullOrEmpty(patternString)) { throw new MessagingException("Pattern is missing"); } patternString = patternString.trim(); try { pattern = Pattern.compile(patternString); } catch (PatternSyntaxException mpe) { throw new MessagingException("Malformed pattern: " + patternString, mpe); } }
SenderIsRegex extends GenericMatcher { @Override public void init() throws MessagingException { String patternString = getCondition(); if (Strings.isNullOrEmpty(patternString)) { throw new MessagingException("Pattern is missing"); } patternString = patternString.trim(); try { pattern = Pattern.compile(patternString); } catch (PatternSyntaxException mpe) { throw new MessagingException("Malformed pattern: " + patternString, mpe); } } }
SenderIsRegex extends GenericMatcher { @Override public void init() throws MessagingException { String patternString = getCondition(); if (Strings.isNullOrEmpty(patternString)) { throw new MessagingException("Pattern is missing"); } patternString = patternString.trim(); try { pattern = Pattern.compile(patternString); } catch (PatternSyntaxException mpe) { throw new MessagingException("Malformed pattern: " + patternString, mpe); } }  }
SenderIsRegex extends GenericMatcher { @Override public void init() throws MessagingException { String patternString = getCondition(); if (Strings.isNullOrEmpty(patternString)) { throw new MessagingException("Pattern is missing"); } patternString = patternString.trim(); try { pattern = Pattern.compile(patternString); } catch (PatternSyntaxException mpe) { throw new MessagingException("Malformed pattern: " + patternString, mpe); } }  @Override void init(); @Override Collection<MailAddress> match(Mail mail); }
SenderIsRegex extends GenericMatcher { @Override public void init() throws MessagingException { String patternString = getCondition(); if (Strings.isNullOrEmpty(patternString)) { throw new MessagingException("Pattern is missing"); } patternString = patternString.trim(); try { pattern = Pattern.compile(patternString); } catch (PatternSyntaxException mpe) { throw new MessagingException("Malformed pattern: " + patternString, mpe); } }  @Override void init(); @Override Collection<MailAddress> match(Mail mail);  }