@Test void htmlEmailShouldBeWellConvertedToJson() throws IOException { MessageToElasticSearchJson messageToElasticSearchJson = new MessageToElasticSearchJson( new DefaultTextExtractor(), ZoneId.of("Europe/Paris"), IndexAttachments.YES); MailboxMessage htmlMail = new SimpleMailboxMessage(MESSAGE_ID, date, SIZE, BODY_START_OCTET, ClassLoaderUtils.getSystemResourceAsSharedStream("eml/htmlMail.eml"), new FlagsBuilder().add(Flags.Flag.DELETED, Flags.Flag.SEEN).add("social", "pocket-money").build(), propertyBuilder, MAILBOX_ID); htmlMail.setModSeq(MOD_SEQ); htmlMail.setUid(UID); assertThatJson(messageToElasticSearchJson.convertToJson(htmlMail, ImmutableList.of(USERNAME))) .when(IGNORING_ARRAY_ORDER) .isEqualTo(ClassLoaderUtils.getSystemResourceAsString("eml/htmlMail.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);  }