SenderIs extends GenericMatcher { @Override public void init() throws javax.mail.MessagingException { if (Strings.isNullOrEmpty(getCondition())) { throw new MessagingException("SenderIs should have at least one address as parameter"); } senders = MailAddressCollectionReader.read(getCondition()); if (senders.size() < 1) { throw new MessagingException("SenderIs should have at least one address as parameter"); } }  @Override void init(); @Override Collection<MailAddress> match(Mail mail);  }
@Test void senderIsShouldThrowWhenNoAddressesPassedByConfiguration() { assertThatThrownBy(() -> matcher.init(FakeMatcherConfig.builder() .matcherName("SenderIs") .build())) .isInstanceOf(MessagingException.class); }
@Test void senderIsShouldThrowWhenNoConfiguration() { assertThatThrownBy(() -> matcher.init(FakeMatcherConfig.builder() .matcherName("SenderIs") .build())) .isInstanceOf(MessagingException.class); }