DSNBounce extends GenericMailet implements RedirectNotify { @Override public void init() throws MessagingException { if (getInitParameters().isDebug()) { LOGGER.debug("Initializing"); } checkInitParameters(getAllowedInitParameters()); if (getInitParameters().isStatic()) { if (getInitParameters().isDebug()) { LOGGER.debug(getInitParameters().asString()); } } messageString = getInitParameter("messageString", "Hi. This is the James mail server at [machine].\nI'm afraid I wasn't able to deliver your message to the following addresses.\nThis is a permanent error; I've given up. Sorry it didn't work out. Below\nI include the list of recipients and the reason why I was unable to deliver\nyour message.\n"); } @Inject  DSNBounce(DNSService dns);  DSNBounce(DNSService dns, DateTimeFormatter dateFormatter); @Override void init(); @Override String getMailetInfo(); @Override InitParameters getInitParameters(); @Override Set<String> getAllowedInitParameters(); @Override DNSService getDNSService(); @Override String getMessage(Mail originalMail); @Override List<MailAddress> getRecipients(); @Override List<MailAddress> getRecipients(Mail originalMail); @Override List<InternetAddress> getTo(); @Override List<MailAddress> getTo(Mail originalMail); @Override Optional<MailAddress> getReplyTo(); @Override Optional<MailAddress> getReplyTo(Mail originalMail); @Override Optional<MailAddress> getReversePath(); @Override Optional<MailAddress> getReversePath(Mail originalMail); @Override Optional<MailAddress> getSender(); @Override Optional<MailAddress> getSender(Mail originalMail); @Override Optional<String> getSubjectPrefix(Mail newMail, String subjectPrefix, Mail originalMail); @Override void service(Mail originalMail); @Override MimeMessageModifier getMimeMessageModifier(Mail newMail, Mail originalMail);  }
@Test void initShouldFailWhenUnknownParameterIsConfigured() { FakeMailetConfig mailetConfig = FakeMailetConfig.builder() .mailetName(MAILET_NAME) .mailetContext(fakeMailContext) .setProperty("unknwon", "value") .build(); assertThatThrownBy(() -> dsnBounce.init(mailetConfig)) .isInstanceOf(MessagingException.class); }