@Test void invalidCharsetShouldBeWellConvertedToJson() throws IOException { MessageToElasticSearchJson messageToElasticSearchJson = new MessageToElasticSearchJson( new DefaultTextExtractor(), ZoneId.of("Europe/Paris"), IndexAttachments.YES); MailboxMessage spamMail = new SimpleMailboxMessage(MESSAGE_ID, date, SIZE, BODY_START_OCTET, ClassLoaderUtils.getSystemResourceAsSharedStream("eml/invalidCharset.eml"), new Flags(), propertyBuilder, MAILBOX_ID); spamMail.setUid(UID); spamMail.setModSeq(MOD_SEQ); String actual = messageToElasticSearchJson.convertToJson(spamMail, ImmutableList.of(USERNAME)); assertThatJson(actual) .when(IGNORING_ARRAY_ORDER) .isEqualTo(ClassLoaderUtils.getSystemResourceAsString("eml/invalidCharset.json")); }
public String convertToJson(MailboxMessage message, List<Username> usernames) throws JsonProcessingException { Preconditions.checkNotNull(message); return mapper.writeValueAsString(IndexableMessage.builder() .message(message) .extractor(textExtractor) .zoneId(zoneId) .indexAttachments(indexAttachments) .build()); }
MessageToElasticSearchJson { public String convertToJson(MailboxMessage message, List<Username> usernames) throws JsonProcessingException { Preconditions.checkNotNull(message); return mapper.writeValueAsString(IndexableMessage.builder() .message(message) .extractor(textExtractor) .zoneId(zoneId) .indexAttachments(indexAttachments) .build()); } }
MessageToElasticSearchJson { public String convertToJson(MailboxMessage message, List<Username> usernames) throws JsonProcessingException { Preconditions.checkNotNull(message); return mapper.writeValueAsString(IndexableMessage.builder() .message(message) .extractor(textExtractor) .zoneId(zoneId) .indexAttachments(indexAttachments) .build()); } MessageToElasticSearchJson(TextExtractor textExtractor, ZoneId zoneId, IndexAttachments indexAttachments); @Inject  MessageToElasticSearchJson(TextExtractor textExtractor, IndexAttachments indexAttachments); }
MessageToElasticSearchJson { public String convertToJson(MailboxMessage message, List<Username> usernames) throws JsonProcessingException { Preconditions.checkNotNull(message); return mapper.writeValueAsString(IndexableMessage.builder() .message(message) .extractor(textExtractor) .zoneId(zoneId) .indexAttachments(indexAttachments) .build()); } MessageToElasticSearchJson(TextExtractor textExtractor, ZoneId zoneId, IndexAttachments indexAttachments); @Inject  MessageToElasticSearchJson(TextExtractor textExtractor, IndexAttachments indexAttachments); String convertToJson(MailboxMessage message, List<Username> usernames); String convertToJsonWithoutAttachment(MailboxMessage message, List<Username> usernames); String getUpdatedJsonMessagePart(Flags flags, ModSeq modSeq); }
MessageToElasticSearchJson { public String convertToJson(MailboxMessage message, List<Username> usernames) throws JsonProcessingException { Preconditions.checkNotNull(message); return mapper.writeValueAsString(IndexableMessage.builder() .message(message) .extractor(textExtractor) .zoneId(zoneId) .indexAttachments(indexAttachments) .build()); } MessageToElasticSearchJson(TextExtractor textExtractor, ZoneId zoneId, IndexAttachments indexAttachments); @Inject  MessageToElasticSearchJson(TextExtractor textExtractor, IndexAttachments indexAttachments); String convertToJson(MailboxMessage message, List<Username> usernames); String convertToJsonWithoutAttachment(MailboxMessage message, List<Username> usernames); String getUpdatedJsonMessagePart(Flags flags, ModSeq modSeq);  }