@Test public void buildShouldWork() { ZonedDateTime before = ZonedDateTime.parse("2016-07-19T14:30:00Z"); ZonedDateTime after = ZonedDateTime.parse("2016-07-19T14:31:00Z"); long minSize = 4; long maxSize = 123; boolean isFlagged = true; boolean isUnread = true; boolean isAnswered = true; boolean isDraft = true; boolean isForwarded = true; boolean hasAttachment = true; String text = "text"; String from = "sender@james.org"; String to = "recipient@james.org"; String cc = "copy@james.org"; String bcc = "blindcopy@james.org"; String subject = "subject"; String body = "body"; String attachments = "attachments"; Header header = Header.from(ImmutableList.of("name", "value")); Optional<String> hasKeyword = Optional.of("$Draft"); Optional<String> notKeyword = Optional.of("$Flagged"); Optional<String> attachmentFileName = Optional.of("file.txt"); FilterCondition expectedFilterCondition = new FilterCondition(Optional.of(ImmutableList.of("1")), Optional.of(ImmutableList.of("2")), Optional.of(before), Optional.of(after), Optional.of(Number.fromLong(minSize)), Optional.of(Number.fromLong(maxSize)), Optional.of(isFlagged), Optional.of(isUnread), Optional.of(isAnswered), Optional.of(isDraft), Optional.of(isForwarded), Optional.of(hasAttachment), Optional.of(text), Optional.of(from), Optional.of(to), Optional.of(cc), Optional.of(bcc), Optional.of(subject), Optional.of(body), Optional.of(attachments), Optional.of(header), hasKeyword, notKeyword, attachmentFileName); FilterCondition filterCondition = FilterCondition.builder() .inMailboxes(Optional.of(ImmutableList.of("1"))) .notInMailboxes("2") .before(before) .after(after) .minSize(minSize) .maxSize(maxSize) .isFlagged(isFlagged) .isUnread(isUnread) .isAnswered(isAnswered) .isDraft(isDraft) .isForwarded(isForwarded) .hasAttachment(hasAttachment) .text(text) .from(from) .to(to) .cc(cc) .bcc(bcc) .subject(subject) .body(body) .attachments(attachments) .header(header) .hasKeyword(hasKeyword) .notKeyword(notKeyword) .attachmentFileName(attachmentFileName) .build(); assertThat(filterCondition).isEqualToComparingFieldByField(expectedFilterCondition); }
public static Builder builder() { return new Builder(); }
FilterCondition implements Filter { public static Builder builder() { return new Builder(); } }
FilterCondition implements Filter { public static Builder builder() { return new Builder(); } @VisibleForTesting  FilterCondition(Optional<List<String>> inMailboxes, Optional<List<String>> notInMailboxes, Optional<ZonedDateTime> before, Optional<ZonedDateTime> after, Optional<Number> minSize, Optional<Number> maxSize,
                                       Optional<Boolean> isFlagged, Optional<Boolean> isUnread, Optional<Boolean> isAnswered, Optional<Boolean> isDraft, Optional<Boolean> isForwarded,
                                       Optional<Boolean> hasAttachment,
                                       Optional<String> text, Optional<String> from, Optional<String> to, Optional<String> cc, Optional<String> bcc, Optional<String> subject,
                                       Optional<String> body, Optional<String> attachments, Optional<Header> header, Optional<String> hasKeyword, Optional<String> notKeyword, Optional<String> attachmentFileName); }
FilterCondition implements Filter { public static Builder builder() { return new Builder(); } @VisibleForTesting  FilterCondition(Optional<List<String>> inMailboxes, Optional<List<String>> notInMailboxes, Optional<ZonedDateTime> before, Optional<ZonedDateTime> after, Optional<Number> minSize, Optional<Number> maxSize,
                                       Optional<Boolean> isFlagged, Optional<Boolean> isUnread, Optional<Boolean> isAnswered, Optional<Boolean> isDraft, Optional<Boolean> isForwarded,
                                       Optional<Boolean> hasAttachment,
                                       Optional<String> text, Optional<String> from, Optional<String> to, Optional<String> cc, Optional<String> bcc, Optional<String> subject,
                                       Optional<String> body, Optional<String> attachments, Optional<Header> header, Optional<String> hasKeyword, Optional<String> notKeyword, Optional<String> attachmentFileName); static Builder builder(); Optional<List<String>> getInMailboxes(); Optional<List<String>> getNotInMailboxes(); Optional<ZonedDateTime> getBefore(); Optional<ZonedDateTime> getAfter(); Optional<Number> getMinSize(); Optional<Number> getMaxSize(); Optional<Boolean> getIsFlagged(); Optional<Boolean> getIsUnread(); Optional<Boolean> getIsAnswered(); Optional<Boolean> getIsDraft(); Optional<Boolean> getIsForwarded(); Optional<Boolean> getHasAttachment(); Optional<String> getText(); Optional<String> getFrom(); Optional<String> getTo(); Optional<String> getCc(); Optional<String> getBcc(); Optional<String> getSubject(); Optional<String> getBody(); Optional<String> getAttachments(); Optional<Header> getHeader(); Optional<String> getHasKeyword(); Optional<String> getNotKeyword(); Optional<String> getAttachmentFileName(); @Override final boolean equals(Object obj); @Override final int hashCode(); @Override String toString(); @Override String prettyPrint(String indentation); }
FilterCondition implements Filter { public static Builder builder() { return new Builder(); } @VisibleForTesting  FilterCondition(Optional<List<String>> inMailboxes, Optional<List<String>> notInMailboxes, Optional<ZonedDateTime> before, Optional<ZonedDateTime> after, Optional<Number> minSize, Optional<Number> maxSize,
                                       Optional<Boolean> isFlagged, Optional<Boolean> isUnread, Optional<Boolean> isAnswered, Optional<Boolean> isDraft, Optional<Boolean> isForwarded,
                                       Optional<Boolean> hasAttachment,
                                       Optional<String> text, Optional<String> from, Optional<String> to, Optional<String> cc, Optional<String> bcc, Optional<String> subject,
                                       Optional<String> body, Optional<String> attachments, Optional<Header> header, Optional<String> hasKeyword, Optional<String> notKeyword, Optional<String> attachmentFileName); static Builder builder(); Optional<List<String>> getInMailboxes(); Optional<List<String>> getNotInMailboxes(); Optional<ZonedDateTime> getBefore(); Optional<ZonedDateTime> getAfter(); Optional<Number> getMinSize(); Optional<Number> getMaxSize(); Optional<Boolean> getIsFlagged(); Optional<Boolean> getIsUnread(); Optional<Boolean> getIsAnswered(); Optional<Boolean> getIsDraft(); Optional<Boolean> getIsForwarded(); Optional<Boolean> getHasAttachment(); Optional<String> getText(); Optional<String> getFrom(); Optional<String> getTo(); Optional<String> getCc(); Optional<String> getBcc(); Optional<String> getSubject(); Optional<String> getBody(); Optional<String> getAttachments(); Optional<Header> getHeader(); Optional<String> getHasKeyword(); Optional<String> getNotKeyword(); Optional<String> getAttachmentFileName(); @Override final boolean equals(Object obj); @Override final int hashCode(); @Override String toString(); @Override String prettyPrint(String indentation);  }