@Test void shouldNotMatchWhenErrorCodeIsMissing() throws Exception { Mail mail = createMail(); Collection<MailAddress> actual = testee.match(mail); assertThat(actual).isEmpty(); }
@Override public Collection<MailAddress> match(Mail mail) { return AttributeUtils.getValueAndCastFromMail(mail, DELIVERY_ERROR_CODE, Integer.class) .filter(errorCode::equals) .map(any -> mail.getRecipients()) .orElse(ImmutableList.of()); }
RemoteDeliveryFailedWithSMTPCode extends GenericMatcher { @Override public Collection<MailAddress> match(Mail mail) { return AttributeUtils.getValueAndCastFromMail(mail, DELIVERY_ERROR_CODE, Integer.class) .filter(errorCode::equals) .map(any -> mail.getRecipients()) .orElse(ImmutableList.of()); } }
RemoteDeliveryFailedWithSMTPCode extends GenericMatcher { @Override public Collection<MailAddress> match(Mail mail) { return AttributeUtils.getValueAndCastFromMail(mail, DELIVERY_ERROR_CODE, Integer.class) .filter(errorCode::equals) .map(any -> mail.getRecipients()) .orElse(ImmutableList.of()); }  }
RemoteDeliveryFailedWithSMTPCode extends GenericMatcher { @Override public Collection<MailAddress> match(Mail mail) { return AttributeUtils.getValueAndCastFromMail(mail, DELIVERY_ERROR_CODE, Integer.class) .filter(errorCode::equals) .map(any -> mail.getRecipients()) .orElse(ImmutableList.of()); }  @Override void init(); @Override Collection<MailAddress> match(Mail mail); }
RemoteDeliveryFailedWithSMTPCode extends GenericMatcher { @Override public Collection<MailAddress> match(Mail mail) { return AttributeUtils.getValueAndCastFromMail(mail, DELIVERY_ERROR_CODE, Integer.class) .filter(errorCode::equals) .map(any -> mail.getRecipients()) .orElse(ImmutableList.of()); }  @Override void init(); @Override Collection<MailAddress> match(Mail mail);  }