@Test public void processShouldThrowWhenBothIsFlagAndKeywords() { expectedException.expect(IllegalArgumentException.class); SetMessagesRequest createMessageWithError = SetMessagesRequest.builder() .create( creationMessageId, creationMessageBuilder .mailboxId(OUTBOX_ID.serialize()) .isAnswered(Optional.of(true)) .keywords(ImmutableMap.of("$Answered", true)) .build()) .build(); sut.process(createMessageWithError, session); }
@Override public SetMessagesResponse process(SetMessagesRequest request, MailboxSession mailboxSession) { TimeMetric timeMetric = metricFactory.timer(JMAP_PREFIX + "SetMessageCreationProcessor"); Builder responseBuilder = SetMessagesResponse.builder(); request.getCreate() .forEach(create -> handleCreate(create, responseBuilder, mailboxSession)); timeMetric.stopAndPublish(); return responseBuilder.build(); }
SetMessagesCreationProcessor implements SetMessagesProcessor { @Override public SetMessagesResponse process(SetMessagesRequest request, MailboxSession mailboxSession) { TimeMetric timeMetric = metricFactory.timer(JMAP_PREFIX + "SetMessageCreationProcessor"); Builder responseBuilder = SetMessagesResponse.builder(); request.getCreate() .forEach(create -> handleCreate(create, responseBuilder, mailboxSession)); timeMetric.stopAndPublish(); return responseBuilder.build(); } }
SetMessagesCreationProcessor implements SetMessagesProcessor { @Override public SetMessagesResponse process(SetMessagesRequest request, MailboxSession mailboxSession) { TimeMetric timeMetric = metricFactory.timer(JMAP_PREFIX + "SetMessageCreationProcessor"); Builder responseBuilder = SetMessagesResponse.builder(); request.getCreate() .forEach(create -> handleCreate(create, responseBuilder, mailboxSession)); timeMetric.stopAndPublish(); return responseBuilder.build(); } @VisibleForTesting @Inject  SetMessagesCreationProcessor(MessageFullViewFactory messageFullViewFactory,
                                 SystemMailboxesProvider systemMailboxesProvider,
                                 AttachmentChecker attachmentChecker,
                                 MetricFactory metricFactory,
                                 MailboxManager mailboxManager,
                                 MailboxId.Factory mailboxIdFactory,
                                 MessageAppender messageAppender,
                                 MessageSender messageSender,
                                 ReferenceUpdater referenceUpdater,
                                 CanSendFrom canSendFrom); }
SetMessagesCreationProcessor implements SetMessagesProcessor { @Override public SetMessagesResponse process(SetMessagesRequest request, MailboxSession mailboxSession) { TimeMetric timeMetric = metricFactory.timer(JMAP_PREFIX + "SetMessageCreationProcessor"); Builder responseBuilder = SetMessagesResponse.builder(); request.getCreate() .forEach(create -> handleCreate(create, responseBuilder, mailboxSession)); timeMetric.stopAndPublish(); return responseBuilder.build(); } @VisibleForTesting @Inject  SetMessagesCreationProcessor(MessageFullViewFactory messageFullViewFactory,
                                 SystemMailboxesProvider systemMailboxesProvider,
                                 AttachmentChecker attachmentChecker,
                                 MetricFactory metricFactory,
                                 MailboxManager mailboxManager,
                                 MailboxId.Factory mailboxIdFactory,
                                 MessageAppender messageAppender,
                                 MessageSender messageSender,
                                 ReferenceUpdater referenceUpdater,
                                 CanSendFrom canSendFrom); @Override SetMessagesResponse process(SetMessagesRequest request, MailboxSession mailboxSession); }
SetMessagesCreationProcessor implements SetMessagesProcessor { @Override public SetMessagesResponse process(SetMessagesRequest request, MailboxSession mailboxSession) { TimeMetric timeMetric = metricFactory.timer(JMAP_PREFIX + "SetMessageCreationProcessor"); Builder responseBuilder = SetMessagesResponse.builder(); request.getCreate() .forEach(create -> handleCreate(create, responseBuilder, mailboxSession)); timeMetric.stopAndPublish(); return responseBuilder.build(); } @VisibleForTesting @Inject  SetMessagesCreationProcessor(MessageFullViewFactory messageFullViewFactory,
                                 SystemMailboxesProvider systemMailboxesProvider,
                                 AttachmentChecker attachmentChecker,
                                 MetricFactory metricFactory,
                                 MailboxManager mailboxManager,
                                 MailboxId.Factory mailboxIdFactory,
                                 MessageAppender messageAppender,
                                 MessageSender messageSender,
                                 ReferenceUpdater referenceUpdater,
                                 CanSendFrom canSendFrom); @Override SetMessagesResponse process(SetMessagesRequest request, MailboxSession mailboxSession);  }