@Test public void testEncode() throws Exception { encoder.encode(response, composer); assertThat(writer.getString()).isEqualTo("* SEARCH 1 4 9 16\r\n"); }
@Override public void encode(SearchResponse response, ImapResponseComposer composer) throws IOException { final long[] ids = response.getIds(); ModSeq highestModSeq = response.getHighestModSeq(); composer.untagged(); composer.commandName(ImapConstants.SEARCH_COMMAND); if (ids != null) { for (long id : ids) { composer.message(id); } } if (highestModSeq != null) { composer.openParen(); composer.message("MODSEQ"); composer.message(highestModSeq.asLong()); composer.closeParen(); } composer.end(); }
SearchResponseEncoder implements ImapResponseEncoder<SearchResponse> { @Override public void encode(SearchResponse response, ImapResponseComposer composer) throws IOException { final long[] ids = response.getIds(); ModSeq highestModSeq = response.getHighestModSeq(); composer.untagged(); composer.commandName(ImapConstants.SEARCH_COMMAND); if (ids != null) { for (long id : ids) { composer.message(id); } } if (highestModSeq != null) { composer.openParen(); composer.message("MODSEQ"); composer.message(highestModSeq.asLong()); composer.closeParen(); } composer.end(); } }
SearchResponseEncoder implements ImapResponseEncoder<SearchResponse> { @Override public void encode(SearchResponse response, ImapResponseComposer composer) throws IOException { final long[] ids = response.getIds(); ModSeq highestModSeq = response.getHighestModSeq(); composer.untagged(); composer.commandName(ImapConstants.SEARCH_COMMAND); if (ids != null) { for (long id : ids) { composer.message(id); } } if (highestModSeq != null) { composer.openParen(); composer.message("MODSEQ"); composer.message(highestModSeq.asLong()); composer.closeParen(); } composer.end(); }  }
SearchResponseEncoder implements ImapResponseEncoder<SearchResponse> { @Override public void encode(SearchResponse response, ImapResponseComposer composer) throws IOException { final long[] ids = response.getIds(); ModSeq highestModSeq = response.getHighestModSeq(); composer.untagged(); composer.commandName(ImapConstants.SEARCH_COMMAND); if (ids != null) { for (long id : ids) { composer.message(id); } } if (highestModSeq != null) { composer.openParen(); composer.message("MODSEQ"); composer.message(highestModSeq.asLong()); composer.closeParen(); } composer.end(); }  @Override Class<SearchResponse> acceptableMessages(); @Override void encode(SearchResponse response, ImapResponseComposer composer); }
SearchResponseEncoder implements ImapResponseEncoder<SearchResponse> { @Override public void encode(SearchResponse response, ImapResponseComposer composer) throws IOException { final long[] ids = response.getIds(); ModSeq highestModSeq = response.getHighestModSeq(); composer.untagged(); composer.commandName(ImapConstants.SEARCH_COMMAND); if (ids != null) { for (long id : ids) { composer.message(id); } } if (highestModSeq != null) { composer.openParen(); composer.message("MODSEQ"); composer.message(highestModSeq.asLong()); composer.closeParen(); } composer.end(); }  @Override Class<SearchResponse> acceptableMessages(); @Override void encode(SearchResponse response, ImapResponseComposer composer);  }