@Test public void initShouldThrowWhenNoAttributeParameter() throws MessagingException { FakeMailetConfig customMailetConfig = FakeMailetConfig.builder() .mailetName("Test") .mailetContext(mailetContext) .build(); assertThatThrownBy(() -> mailet.init(customMailetConfig)) .isInstanceOf(MailetException.class); }
@Override public void init() throws MessagingException { extractAttributeTo = getInitParameterAsOptional(Configuration.ATTRIBUTE) .map(AttributeName::of) .orElseThrow(() -> new MailetException("No value for " + Configuration.ATTRIBUTE + " parameter was provided.")); objectMapper = new ObjectMapper().registerModule(new Jdk8Module()); }
ContactExtractor extends GenericMailet implements Mailet { @Override public void init() throws MessagingException { extractAttributeTo = getInitParameterAsOptional(Configuration.ATTRIBUTE) .map(AttributeName::of) .orElseThrow(() -> new MailetException("No value for " + Configuration.ATTRIBUTE + " parameter was provided.")); objectMapper = new ObjectMapper().registerModule(new Jdk8Module()); } }
ContactExtractor extends GenericMailet implements Mailet { @Override public void init() throws MessagingException { extractAttributeTo = getInitParameterAsOptional(Configuration.ATTRIBUTE) .map(AttributeName::of) .orElseThrow(() -> new MailetException("No value for " + Configuration.ATTRIBUTE + " parameter was provided.")); objectMapper = new ObjectMapper().registerModule(new Jdk8Module()); }  }
ContactExtractor extends GenericMailet implements Mailet { @Override public void init() throws MessagingException { extractAttributeTo = getInitParameterAsOptional(Configuration.ATTRIBUTE) .map(AttributeName::of) .orElseThrow(() -> new MailetException("No value for " + Configuration.ATTRIBUTE + " parameter was provided.")); objectMapper = new ObjectMapper().registerModule(new Jdk8Module()); }  @Override void init(); @Override String getMailetInfo(); @Override void service(Mail mail); }
ContactExtractor extends GenericMailet implements Mailet { @Override public void init() throws MessagingException { extractAttributeTo = getInitParameterAsOptional(Configuration.ATTRIBUTE) .map(AttributeName::of) .orElseThrow(() -> new MailetException("No value for " + Configuration.ATTRIBUTE + " parameter was provided.")); objectMapper = new ObjectMapper().registerModule(new Jdk8Module()); }  @Override void init(); @Override String getMailetInfo(); @Override void service(Mail mail);  }