@Test public void decodeMessageShouldReturnRequestContainsMultiAnnotationsWithNil() throws DecodingException { InputStream inputStream = new ByteArrayInputStream((INBOX + " (/private/comment NIL /shared/comment \"This one is for you!\") \n").getBytes()); ImapRequestStreamLineReader lineReader = new ImapRequestStreamLineReader(inputStream, new ByteArrayOutputStream()); SetAnnotationRequest request = (SetAnnotationRequest) parser.decode(lineReader, TAG, null); assertThat(request.getMailboxName()).isEqualTo(INBOX); assertThat(request.getMailboxAnnotations()).containsExactly(NIL_ANNOTATION, SHARED_ANNOTATION); }
@Override protected ImapMessage decode(ImapRequestLineReader request, Tag tag, ImapSession session) throws DecodingException { String mailboxName = request.mailbox(); ImmutableList.Builder<MailboxAnnotation> listMailboxAnnotations = ImmutableList.<MailboxAnnotation>builder(); if (request.nextWordChar() == '(') { request.consumeChar('('); do { listMailboxAnnotations.add(readNextAnnotation(request)); } while (request.nextWordChar() != ')'); request.consumeChar(')'); } request.eol(); return new SetAnnotationRequest(tag, mailboxName, listMailboxAnnotations.build()); }
SetAnnotationCommandParser extends AbstractImapCommandParser { @Override protected ImapMessage decode(ImapRequestLineReader request, Tag tag, ImapSession session) throws DecodingException { String mailboxName = request.mailbox(); ImmutableList.Builder<MailboxAnnotation> listMailboxAnnotations = ImmutableList.<MailboxAnnotation>builder(); if (request.nextWordChar() == '(') { request.consumeChar('('); do { listMailboxAnnotations.add(readNextAnnotation(request)); } while (request.nextWordChar() != ')'); request.consumeChar(')'); } request.eol(); return new SetAnnotationRequest(tag, mailboxName, listMailboxAnnotations.build()); } }
SetAnnotationCommandParser extends AbstractImapCommandParser { @Override protected ImapMessage decode(ImapRequestLineReader request, Tag tag, ImapSession session) throws DecodingException { String mailboxName = request.mailbox(); ImmutableList.Builder<MailboxAnnotation> listMailboxAnnotations = ImmutableList.<MailboxAnnotation>builder(); if (request.nextWordChar() == '(') { request.consumeChar('('); do { listMailboxAnnotations.add(readNextAnnotation(request)); } while (request.nextWordChar() != ')'); request.consumeChar(')'); } request.eol(); return new SetAnnotationRequest(tag, mailboxName, listMailboxAnnotations.build()); } SetAnnotationCommandParser(StatusResponseFactory statusResponseFactory); }
SetAnnotationCommandParser extends AbstractImapCommandParser { @Override protected ImapMessage decode(ImapRequestLineReader request, Tag tag, ImapSession session) throws DecodingException { String mailboxName = request.mailbox(); ImmutableList.Builder<MailboxAnnotation> listMailboxAnnotations = ImmutableList.<MailboxAnnotation>builder(); if (request.nextWordChar() == '(') { request.consumeChar('('); do { listMailboxAnnotations.add(readNextAnnotation(request)); } while (request.nextWordChar() != ')'); request.consumeChar(')'); } request.eol(); return new SetAnnotationRequest(tag, mailboxName, listMailboxAnnotations.build()); } SetAnnotationCommandParser(StatusResponseFactory statusResponseFactory);  }
SetAnnotationCommandParser extends AbstractImapCommandParser { @Override protected ImapMessage decode(ImapRequestLineReader request, Tag tag, ImapSession session) throws DecodingException { String mailboxName = request.mailbox(); ImmutableList.Builder<MailboxAnnotation> listMailboxAnnotations = ImmutableList.<MailboxAnnotation>builder(); if (request.nextWordChar() == '(') { request.consumeChar('('); do { listMailboxAnnotations.add(readNextAnnotation(request)); } while (request.nextWordChar() != ')'); request.consumeChar(')'); } request.eol(); return new SetAnnotationRequest(tag, mailboxName, listMailboxAnnotations.build()); } SetAnnotationCommandParser(StatusResponseFactory statusResponseFactory);   }