@Test public void processShouldGetAnnotationsByKeysAndReturnCompleteResponse() throws Exception { processor.process(annotationRequestBuilder.keys(keys).build(), mockResponder, imapSession); verify(mockMailboxManager, times(1)).getAnnotationsByKeys(eq(inbox), eq(mailboxSession), eq(keys)); verify(mockStatusResponseFactory, times(1)).taggedOk(any(Tag.class), any(ImapCommand.class), humanTextCaptor.capture()); verify(mockResponder, times(2)).respond(captorAnnotationResponse.capture()); verifyNoMoreInteractions(mockResponder); assertThat(humanTextCaptor.getAllValues()).containsOnly(HumanReadableText.COMPLETED); }
private void respond(ImapRequest request, Responder responder, String mailboxName, List<MailboxAnnotation> mailboxAnnotations, Optional<Integer> maxsize, Optional<Integer> maximumOversizedSize) { if (maximumOversizedSize.isPresent()) { responder.respond(new AnnotationResponse(mailboxName, filterItemsBySize(mailboxAnnotations, maxsize))); okComplete(request, ResponseCode.longestMetadataEntry(maximumOversizedSize.get()), responder); } else { responder.respond(new AnnotationResponse(mailboxName, mailboxAnnotations)); okComplete(request, responder); } }
GetAnnotationProcessor extends AbstractMailboxProcessor<GetAnnotationRequest> implements CapabilityImplementingProcessor { private void respond(ImapRequest request, Responder responder, String mailboxName, List<MailboxAnnotation> mailboxAnnotations, Optional<Integer> maxsize, Optional<Integer> maximumOversizedSize) { if (maximumOversizedSize.isPresent()) { responder.respond(new AnnotationResponse(mailboxName, filterItemsBySize(mailboxAnnotations, maxsize))); okComplete(request, ResponseCode.longestMetadataEntry(maximumOversizedSize.get()), responder); } else { responder.respond(new AnnotationResponse(mailboxName, mailboxAnnotations)); okComplete(request, responder); } } }
GetAnnotationProcessor extends AbstractMailboxProcessor<GetAnnotationRequest> implements CapabilityImplementingProcessor { private void respond(ImapRequest request, Responder responder, String mailboxName, List<MailboxAnnotation> mailboxAnnotations, Optional<Integer> maxsize, Optional<Integer> maximumOversizedSize) { if (maximumOversizedSize.isPresent()) { responder.respond(new AnnotationResponse(mailboxName, filterItemsBySize(mailboxAnnotations, maxsize))); okComplete(request, ResponseCode.longestMetadataEntry(maximumOversizedSize.get()), responder); } else { responder.respond(new AnnotationResponse(mailboxName, mailboxAnnotations)); okComplete(request, responder); } } GetAnnotationProcessor(ImapProcessor next, MailboxManager mailboxManager, StatusResponseFactory factory,
            MetricFactory metricFactory); }
GetAnnotationProcessor extends AbstractMailboxProcessor<GetAnnotationRequest> implements CapabilityImplementingProcessor { private void respond(ImapRequest request, Responder responder, String mailboxName, List<MailboxAnnotation> mailboxAnnotations, Optional<Integer> maxsize, Optional<Integer> maximumOversizedSize) { if (maximumOversizedSize.isPresent()) { responder.respond(new AnnotationResponse(mailboxName, filterItemsBySize(mailboxAnnotations, maxsize))); okComplete(request, ResponseCode.longestMetadataEntry(maximumOversizedSize.get()), responder); } else { responder.respond(new AnnotationResponse(mailboxName, mailboxAnnotations)); okComplete(request, responder); } } GetAnnotationProcessor(ImapProcessor next, MailboxManager mailboxManager, StatusResponseFactory factory,
            MetricFactory metricFactory); @Override List<Capability> getImplementedCapabilities(ImapSession session); }
GetAnnotationProcessor extends AbstractMailboxProcessor<GetAnnotationRequest> implements CapabilityImplementingProcessor { private void respond(ImapRequest request, Responder responder, String mailboxName, List<MailboxAnnotation> mailboxAnnotations, Optional<Integer> maxsize, Optional<Integer> maximumOversizedSize) { if (maximumOversizedSize.isPresent()) { responder.respond(new AnnotationResponse(mailboxName, filterItemsBySize(mailboxAnnotations, maxsize))); okComplete(request, ResponseCode.longestMetadataEntry(maximumOversizedSize.get()), responder); } else { responder.respond(new AnnotationResponse(mailboxName, mailboxAnnotations)); okComplete(request, responder); } } GetAnnotationProcessor(ImapProcessor next, MailboxManager mailboxManager, StatusResponseFactory factory,
            MetricFactory metricFactory); @Override List<Capability> getImplementedCapabilities(ImapSession session);  }