@Test void initShouldThrowOnEmptyDestinationAttribute() { assertThatThrownBy(() -> mailet.init(FakeMailetConfig.builder() .mailetName("ICalendarParser") .setProperty(ICalendarParser.DESTINATION_ATTRIBUTE_PARAMETER_NAME, "") .build())) .isInstanceOf(MessagingException.class); }
@Override public void init() throws MessagingException { String sourceAttributeNameRaw = getInitParameter(SOURCE_ATTRIBUTE_PARAMETER_NAME, SOURCE_ATTRIBUTE_PARAMETER_DEFAULT_VALUE); if (Strings.isNullOrEmpty(sourceAttributeNameRaw)) { throw new MessagingException("source attribute cannot be empty"); } sourceAttributeName = AttributeName.of(sourceAttributeNameRaw); String destinationAttributeNameRaw = getInitParameter(DESTINATION_ATTRIBUTE_PARAMETER_NAME, DESTINATION_ATTRIBUTE_PARAMETER_DEFAULT_VALUE); if (Strings.isNullOrEmpty(destinationAttributeNameRaw)) { throw new MessagingException("destination attribute cannot be empty"); } destinationAttributeName = AttributeName.of(destinationAttributeNameRaw); }
ICalendarParser extends GenericMailet { @Override public void init() throws MessagingException { String sourceAttributeNameRaw = getInitParameter(SOURCE_ATTRIBUTE_PARAMETER_NAME, SOURCE_ATTRIBUTE_PARAMETER_DEFAULT_VALUE); if (Strings.isNullOrEmpty(sourceAttributeNameRaw)) { throw new MessagingException("source attribute cannot be empty"); } sourceAttributeName = AttributeName.of(sourceAttributeNameRaw); String destinationAttributeNameRaw = getInitParameter(DESTINATION_ATTRIBUTE_PARAMETER_NAME, DESTINATION_ATTRIBUTE_PARAMETER_DEFAULT_VALUE); if (Strings.isNullOrEmpty(destinationAttributeNameRaw)) { throw new MessagingException("destination attribute cannot be empty"); } destinationAttributeName = AttributeName.of(destinationAttributeNameRaw); } }
ICalendarParser extends GenericMailet { @Override public void init() throws MessagingException { String sourceAttributeNameRaw = getInitParameter(SOURCE_ATTRIBUTE_PARAMETER_NAME, SOURCE_ATTRIBUTE_PARAMETER_DEFAULT_VALUE); if (Strings.isNullOrEmpty(sourceAttributeNameRaw)) { throw new MessagingException("source attribute cannot be empty"); } sourceAttributeName = AttributeName.of(sourceAttributeNameRaw); String destinationAttributeNameRaw = getInitParameter(DESTINATION_ATTRIBUTE_PARAMETER_NAME, DESTINATION_ATTRIBUTE_PARAMETER_DEFAULT_VALUE); if (Strings.isNullOrEmpty(destinationAttributeNameRaw)) { throw new MessagingException("destination attribute cannot be empty"); } destinationAttributeName = AttributeName.of(destinationAttributeNameRaw); }  }
ICalendarParser extends GenericMailet { @Override public void init() throws MessagingException { String sourceAttributeNameRaw = getInitParameter(SOURCE_ATTRIBUTE_PARAMETER_NAME, SOURCE_ATTRIBUTE_PARAMETER_DEFAULT_VALUE); if (Strings.isNullOrEmpty(sourceAttributeNameRaw)) { throw new MessagingException("source attribute cannot be empty"); } sourceAttributeName = AttributeName.of(sourceAttributeNameRaw); String destinationAttributeNameRaw = getInitParameter(DESTINATION_ATTRIBUTE_PARAMETER_NAME, DESTINATION_ATTRIBUTE_PARAMETER_DEFAULT_VALUE); if (Strings.isNullOrEmpty(destinationAttributeNameRaw)) { throw new MessagingException("destination attribute cannot be empty"); } destinationAttributeName = AttributeName.of(destinationAttributeNameRaw); }  @Override void init(); @Override void service(Mail mail); @Override String getMailetInfo(); }
ICalendarParser extends GenericMailet { @Override public void init() throws MessagingException { String sourceAttributeNameRaw = getInitParameter(SOURCE_ATTRIBUTE_PARAMETER_NAME, SOURCE_ATTRIBUTE_PARAMETER_DEFAULT_VALUE); if (Strings.isNullOrEmpty(sourceAttributeNameRaw)) { throw new MessagingException("source attribute cannot be empty"); } sourceAttributeName = AttributeName.of(sourceAttributeNameRaw); String destinationAttributeNameRaw = getInitParameter(DESTINATION_ATTRIBUTE_PARAMETER_NAME, DESTINATION_ATTRIBUTE_PARAMETER_DEFAULT_VALUE); if (Strings.isNullOrEmpty(destinationAttributeNameRaw)) { throw new MessagingException("destination attribute cannot be empty"); } destinationAttributeName = AttributeName.of(destinationAttributeNameRaw); }  @Override void init(); @Override void service(Mail mail); @Override String getMailetInfo(); static final String SOURCE_ATTRIBUTE_PARAMETER_NAME; static final String DESTINATION_ATTRIBUTE_PARAMETER_NAME; static final String SOURCE_ATTRIBUTE_PARAMETER_DEFAULT_VALUE; static final String DESTINATION_ATTRIBUTE_PARAMETER_DEFAULT_VALUE; }