@Override public void done(boolean success) throws MailQueueException { mailQueueItem.done(success); if (success && mandatoryJmapMetaDataIsPresent()) { MessageId messageId = messageIdFactory.fromString((String) getMail().getAttribute(MailMetadata.MAIL_METADATA_MESSAGE_ID_ATTRIBUTE)); String username = (String) getMail().getAttribute(MailMetadata.MAIL_METADATA_USERNAME_ATTRIBUTE); if (getMail().getAttribute(IS_DELIVERED) == null) { try { MailboxSession mailboxSession = mailboxManager.createSystemSession(username); moveFromOutboxToSentWithSeenFlag(messageId, mailboxSession); getMail().setAttribute(IS_DELIVERED, IS_DELIVERED); } catch (MailShouldBeInOutboxException e) { LOG.info("Message does not exist on Outbox anymore, it could have already been sent", e); } catch (MailboxException e) { throw new MailQueueException(e.getMessage(), e); } } } }
@Test public void doneShouldCallDecoratedDone() throws Exception { try { testee.done(true); } catch (Exception e) { //Ignore } verify(mockedMailQueueItem).done(true); }
@Override public void done(boolean success) throws MailQueueException { mailQueueItem.done(success); } }