Skip to content

Commit

Permalink
JAMES-1753 Support notInMailboxes filtering in getMessageList
Browse files Browse the repository at this point in the history
  • Loading branch information
Raphael Ouazana committed Jun 9, 2016
1 parent b9629e9 commit af7b1c6
Show file tree
Hide file tree
Showing 6 changed files with 176 additions and 43 deletions.
Original file line number Original file line Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@
import org.apache.james.jmap.api.access.AccessToken; import org.apache.james.jmap.api.access.AccessToken;
import org.apache.james.mailbox.model.MailboxConstants; import org.apache.james.mailbox.model.MailboxConstants;
import org.apache.james.mailbox.model.MailboxPath; import org.apache.james.mailbox.model.MailboxPath;
import org.apache.james.mailbox.store.mail.model.MailboxId;
import org.junit.After; import org.junit.After;
import org.junit.Before; import org.junit.Before;
import org.junit.Test; import org.junit.Test;
Expand Down Expand Up @@ -239,6 +240,121 @@ public void getMessageListShouldFilterMessagesWhenMultipleInMailboxesFilterMatch
.body(ARGUMENTS + ".messageIds", contains("username@domain.tld|mailbox|1")); .body(ARGUMENTS + ".messageIds", contains("username@domain.tld|mailbox|1"));
} }


@Test
public void getMessageListShouldFilterMessagesWhenNotInMailboxesFilterMatches() throws Exception {
jmapServer.serverProbe().createMailbox(MailboxConstants.USER_NAMESPACE, username, "mailbox");
jmapServer.serverProbe().appendMessage(username, new MailboxPath(MailboxConstants.USER_NAMESPACE, username, "mailbox"),
new ByteArrayInputStream("Subject: test\r\n\r\ntestmail".getBytes()), new Date(), false, new Flags());
MailboxId mailboxId = jmapServer.serverProbe().getMailbox(MailboxConstants.USER_NAMESPACE, username, "mailbox").getMailboxId();

jmapServer.serverProbe().createMailbox(MailboxConstants.USER_NAMESPACE, username, "mailbox2");
await();

given()
.accept(ContentType.JSON)
.contentType(ContentType.JSON)
.header("Authorization", accessToken.serialize())
.body(String.format("[[\"getMessageList\", {\"filter\":{\"notInMailboxes\":[\"%s\"]}}, \"#0\"]]", mailboxId.serialize()))
.when()
.post("/jmap")
.then()
.statusCode(200)
.body(NAME, equalTo("messageList"))
.body(ARGUMENTS + ".messageIds", empty());
}

@Test
public void getMessageListShouldFilterMessagesWhenNotInMailboxesFilterMatchesTwice() throws Exception {
jmapServer.serverProbe().createMailbox(MailboxConstants.USER_NAMESPACE, username, "mailbox");
jmapServer.serverProbe().appendMessage(username, new MailboxPath(MailboxConstants.USER_NAMESPACE, username, "mailbox"),
new ByteArrayInputStream("Subject: test\r\n\r\ntestmail".getBytes()), new Date(), false, new Flags());
MailboxId mailboxId = jmapServer.serverProbe().getMailbox(MailboxConstants.USER_NAMESPACE, username, "mailbox").getMailboxId();

jmapServer.serverProbe().createMailbox(MailboxConstants.USER_NAMESPACE, username, "mailbox2");
jmapServer.serverProbe().appendMessage(username, new MailboxPath(MailboxConstants.USER_NAMESPACE, username, "mailbox2"),
new ByteArrayInputStream("Subject: test\r\n\r\ntestmail".getBytes()), new Date(), false, new Flags());
MailboxId mailbox2Id = jmapServer.serverProbe().getMailbox(MailboxConstants.USER_NAMESPACE, username, "mailbox2").getMailboxId();
await();

given()
.accept(ContentType.JSON)
.contentType(ContentType.JSON)
.header("Authorization", accessToken.serialize())
.body(String.format("[[\"getMessageList\", {\"filter\":{\"notInMailboxes\":[\"%s\", \"%s\"]}}, \"#0\"]]", mailboxId.serialize(), mailbox2Id.serialize()))
.when()
.post("/jmap")
.then()
.statusCode(200)
.body(NAME, equalTo("messageList"))
.body(ARGUMENTS + ".messageIds", empty());
}

@Test
public void getMessageListShouldFilterMessagesWhenIdenticalNotInMailboxesAndInmailboxesFilterMatch() throws Exception {
jmapServer.serverProbe().createMailbox(MailboxConstants.USER_NAMESPACE, username, "mailbox");
jmapServer.serverProbe().appendMessage(username, new MailboxPath(MailboxConstants.USER_NAMESPACE, username, "mailbox"),
new ByteArrayInputStream("Subject: test\r\n\r\ntestmail".getBytes()), new Date(), false, new Flags());
MailboxId mailboxId = jmapServer.serverProbe().getMailbox(MailboxConstants.USER_NAMESPACE, username, "mailbox").getMailboxId();
await();

given()
.accept(ContentType.JSON)
.contentType(ContentType.JSON)
.header("Authorization", accessToken.serialize())
.body(String.format("[[\"getMessageList\", {\"filter\":{\"notInMailboxes\":[\"%s\"], \"inMailboxes\":[\"%s\"]}}, \"#0\"]]", mailboxId.serialize(), mailboxId.serialize()))
.when()
.post("/jmap")
.then()
.statusCode(200)
.body(NAME, equalTo("messageList"))
.body(ARGUMENTS + ".messageIds", empty());
}

@Test
public void getMessageListShouldNotFilterMessagesWhenNotInMailboxesFilterDoesNotMatch() throws Exception {
jmapServer.serverProbe().createMailbox(MailboxConstants.USER_NAMESPACE, username, "mailbox");
jmapServer.serverProbe().appendMessage(username, new MailboxPath(MailboxConstants.USER_NAMESPACE, username, "mailbox"),
new ByteArrayInputStream("Subject: test\r\n\r\ntestmail".getBytes()), new Date(), false, new Flags());

jmapServer.serverProbe().createMailbox(MailboxConstants.USER_NAMESPACE, username, "mailbox2");
MailboxId mailbox2Id = jmapServer.serverProbe().getMailbox(MailboxConstants.USER_NAMESPACE, username, "mailbox2").getMailboxId();
await();

given()
.accept(ContentType.JSON)
.contentType(ContentType.JSON)
.header("Authorization", accessToken.serialize())
.body(String.format("[[\"getMessageList\", {\"filter\":{\"notInMailboxes\":[\"%s\"]}}, \"#0\"]]", mailbox2Id.serialize()))
.when()
.post("/jmap")
.then()
.statusCode(200)
.body(NAME, equalTo("messageList"))
.body(ARGUMENTS + ".messageIds", contains("username@domain.tld|mailbox|1"));
}

@Test
public void getMessageListShouldNotFilterMessagesWhenEmptyNotInMailboxesFilter() throws Exception {
jmapServer.serverProbe().createMailbox(MailboxConstants.USER_NAMESPACE, username, "mailbox");
jmapServer.serverProbe().appendMessage(username, new MailboxPath(MailboxConstants.USER_NAMESPACE, username, "mailbox"),
new ByteArrayInputStream("Subject: test\r\n\r\ntestmail".getBytes()), new Date(), false, new Flags());

jmapServer.serverProbe().createMailbox(MailboxConstants.USER_NAMESPACE, username, "mailbox2");
await();

given()
.accept(ContentType.JSON)
.contentType(ContentType.JSON)
.header("Authorization", accessToken.serialize())
.body(String.format("[[\"getMessageList\", {\"filter\":{\"notInMailboxes\":[]}}, \"#0\"]]"))
.when()
.post("/jmap")
.then()
.statusCode(200)
.body(NAME, equalTo("messageList"))
.body(ARGUMENTS + ".messageIds", contains("username@domain.tld|mailbox|1"));
}

@Test @Test
public void getMessageListShouldFilterMessagesWhenInMailboxesFilterDoesntMatches() throws Exception { public void getMessageListShouldFilterMessagesWhenInMailboxesFilterDoesntMatches() throws Exception {
jmapServer.serverProbe().createMailbox(MailboxConstants.USER_NAMESPACE, username, "mailbox"); jmapServer.serverProbe().createMailbox(MailboxConstants.USER_NAMESPACE, username, "mailbox");
Expand Down
Original file line number Original file line Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
import java.util.Comparator; import java.util.Comparator;
import java.util.List; import java.util.List;
import java.util.Optional; import java.util.Optional;
import java.util.Set; import java.util.function.Predicate;
import java.util.stream.Stream; import java.util.stream.Stream;


import javax.inject.Inject; import javax.inject.Inject;
Expand All @@ -34,6 +34,7 @@
import org.apache.james.jmap.model.GetMessageListResponse; import org.apache.james.jmap.model.GetMessageListResponse;
import org.apache.james.jmap.model.GetMessagesRequest; import org.apache.james.jmap.model.GetMessagesRequest;
import org.apache.james.jmap.model.MessageId; import org.apache.james.jmap.model.MessageId;
import org.apache.james.jmap.utils.MailboxUtils;
import org.apache.james.jmap.utils.SortToComparatorConvertor; import org.apache.james.jmap.utils.SortToComparatorConvertor;
import org.apache.james.mailbox.MailboxManager; import org.apache.james.mailbox.MailboxManager;
import org.apache.james.mailbox.MailboxSession; import org.apache.james.mailbox.MailboxSession;
Expand All @@ -45,7 +46,6 @@
import org.apache.james.mailbox.model.MessageRange; import org.apache.james.mailbox.model.MessageRange;
import org.apache.james.mailbox.model.SearchQuery; import org.apache.james.mailbox.model.SearchQuery;
import org.apache.james.mailbox.store.MailboxSessionMapperFactory; import org.apache.james.mailbox.store.MailboxSessionMapperFactory;
import org.apache.james.mailbox.store.StoreMailboxPath;
import org.apache.james.mailbox.store.mail.MessageMapper; import org.apache.james.mailbox.store.mail.MessageMapper;
import org.apache.james.mailbox.store.mail.MessageMapper.FetchType; import org.apache.james.mailbox.store.mail.MessageMapper.FetchType;
import org.apache.james.mailbox.store.mail.model.Mailbox; import org.apache.james.mailbox.store.mail.model.Mailbox;
Expand All @@ -59,8 +59,6 @@
import com.google.common.base.Preconditions; import com.google.common.base.Preconditions;
import com.google.common.base.Throwables; import com.google.common.base.Throwables;
import com.google.common.collect.ImmutableList; import com.google.common.collect.ImmutableList;
import com.google.common.collect.ImmutableSet;
import com.google.common.collect.Sets;


public class GetMessageListMethod implements Method { public class GetMessageListMethod implements Method {


Expand All @@ -76,15 +74,17 @@ public class GetMessageListMethod implements Method {
private final MailboxSessionMapperFactory mailboxSessionMapperFactory; private final MailboxSessionMapperFactory mailboxSessionMapperFactory;
private final int maximumLimit; private final int maximumLimit;
private final GetMessagesMethod getMessagesMethod; private final GetMessagesMethod getMessagesMethod;
private final MailboxUtils mailboxUtils;


@Inject @Inject
@VisibleForTesting public GetMessageListMethod(MailboxManager mailboxManager, MailboxSessionMapperFactory mailboxSessionMapperFactory, @VisibleForTesting public GetMessageListMethod(MailboxManager mailboxManager, MailboxSessionMapperFactory mailboxSessionMapperFactory,
@Named(MAXIMUM_LIMIT) int maximumLimit, GetMessagesMethod getMessagesMethod) { @Named(MAXIMUM_LIMIT) int maximumLimit, GetMessagesMethod getMessagesMethod, MailboxUtils mailboxUtils) {


this.mailboxManager = mailboxManager; this.mailboxManager = mailboxManager;
this.mailboxSessionMapperFactory = mailboxSessionMapperFactory; this.mailboxSessionMapperFactory = mailboxSessionMapperFactory;
this.maximumLimit = maximumLimit; this.maximumLimit = maximumLimit;
this.getMessagesMethod = getMessagesMethod; this.getMessagesMethod = getMessagesMethod;
this.mailboxUtils = mailboxUtils;
} }


@Override @Override
Expand Down Expand Up @@ -169,24 +169,35 @@ private Comparator<MailboxMessage> comparatorFor(GetMessageListRequest messageLi
return SortToComparatorConvertor.comparatorFor(messageListRequest.getSort()); return SortToComparatorConvertor.comparatorFor(messageListRequest.getSort());
} }


private ImmutableSet<MailboxPath> listRequestedMailboxes(GetMessageListRequest messageListRequest, List<MailboxPath> mailboxPaths, MailboxSession session) { private List<MailboxPath> listRequestedMailboxes(GetMessageListRequest messageListRequest, List<MailboxPath> mailboxPaths, MailboxSession session) {
ImmutableSet<MailboxPath> mailboxPathSet = ImmutableSet.copyOf(mailboxPaths);
return messageListRequest.getFilter() return messageListRequest.getFilter()
.filter(FilterCondition.class::isInstance) .filter(FilterCondition.class::isInstance)
.map(FilterCondition.class::cast) .map(FilterCondition.class::cast)
.map(FilterCondition::getInMailboxes) .map(filterCondition -> filterMailboxPaths(mailboxPaths, session, filterCondition))
.map(Throwing.function(mailboxIds -> mailboxIdsToMailboxPaths(mailboxIds, session))) .orElse(mailboxPaths);
.map(requestedMailboxPaths -> Sets.intersection(requestedMailboxPaths, mailboxPathSet).immutableCopy()) }
.orElse(mailboxPathSet);
private List<MailboxPath> filterMailboxPaths(List<MailboxPath> mailboxPaths, MailboxSession session, FilterCondition filterCondition) {
Predicate<MailboxPath> inMailboxesPredicate = filterCondition.getInMailboxes()
.map(list -> mailboxIdsToMailboxPaths(list, session))
.<Predicate<MailboxPath>>map(list -> mailboxPath -> list.contains(mailboxPath))
.orElse(x -> true);
Predicate<MailboxPath> notInMailboxesPredicate = filterCondition.getNotInMailboxes()
.map(list -> mailboxIdsToMailboxPaths(list, session))
.<Predicate<MailboxPath>>map(list -> mailboxPath -> !list.contains(mailboxPath))
.orElse(x -> true);
return mailboxPaths.stream()
.filter(inMailboxesPredicate)
.filter(notInMailboxesPredicate)
.collect(ImmutableCollectors.toImmutableList());
} }


private Set<MailboxPath> mailboxIdsToMailboxPaths(List<String> mailboxIds, MailboxSession session) throws MailboxException { private List<MailboxPath> mailboxIdsToMailboxPaths(List<String> mailboxIds, MailboxSession session) {
Set<String> mailboxIdSet = Sets.newHashSet(mailboxIds); return mailboxIds.stream()
return mailboxSessionMapperFactory.createMailboxMapper(session).list() .map(id -> mailboxUtils.mailboxPathFromMailboxId(id, session))
.stream() .filter(Optional::isPresent)
.filter(mailbox -> mailboxIdSet.contains(mailbox.getMailboxId().serialize())) .map(Optional::get)
.map(mailbox -> new StoreMailboxPath(mailbox)) .collect(ImmutableCollectors.toImmutableList());
.collect(ImmutableCollectors.toImmutableSet());
} }


private Optional<MessageManager> getMessageManager(MailboxPath mailboxPath, MailboxSession mailboxSession) { private Optional<MessageManager> getMessageManager(MailboxPath mailboxPath, MailboxSession mailboxSession) {
Expand Down
Original file line number Original file line Diff line number Diff line change
Expand Up @@ -40,8 +40,8 @@ public static Builder builder() {
@JsonPOJOBuilder(withPrefix = "") @JsonPOJOBuilder(withPrefix = "")
public static class Builder { public static class Builder {


private final ImmutableList.Builder<String> inMailboxes; private Optional<List<String>> inMailboxes;
private final ImmutableList.Builder<String> notInMailboxes; private Optional<List<String>> notInMailboxes;
private Date before; private Date before;
private Date after; private Date after;
private Integer minSize; private Integer minSize;
Expand All @@ -61,18 +61,19 @@ public static class Builder {
private final ImmutableList.Builder<String> header; private final ImmutableList.Builder<String> header;


private Builder() { private Builder() {
inMailboxes = ImmutableList.builder(); inMailboxes = Optional.empty();
notInMailboxes = ImmutableList.builder(); notInMailboxes = Optional.empty();
header = ImmutableList.builder(); header = ImmutableList.builder();
} }


public Builder inMailboxes(List<String> inMailboxes) { public Builder inMailboxes(Optional<List<String>> inMailboxes) {
this.inMailboxes.addAll(inMailboxes); this.inMailboxes = inMailboxes.map(ImmutableList::copyOf);
return this; return this;
} }


public Builder notInMailboxes(List<Filter> notInMailboxes) { public Builder notInMailboxes(Optional<List<String>> notInMailboxes) {
throw new NotImplementedException(); this.notInMailboxes = notInMailboxes.map(ImmutableList::copyOf);
return this;
} }


public Builder before(Date before) { public Builder before(Date before) {
Expand Down Expand Up @@ -144,14 +145,14 @@ public Builder header(List<String> body) {
} }


public FilterCondition build() { public FilterCondition build() {
return new FilterCondition(inMailboxes.build(), notInMailboxes.build(), Optional.ofNullable(before), Optional.ofNullable(after), Optional.ofNullable(minSize), Optional.ofNullable(maxSize), return new FilterCondition(inMailboxes, notInMailboxes, Optional.ofNullable(before), Optional.ofNullable(after), Optional.ofNullable(minSize), Optional.ofNullable(maxSize),
Optional.ofNullable(isFlagged), Optional.ofNullable(isUnread), Optional.ofNullable(isAnswered), Optional.ofNullable(isDraft), Optional.ofNullable(hasAttachment), Optional.ofNullable(isFlagged), Optional.ofNullable(isUnread), Optional.ofNullable(isAnswered), Optional.ofNullable(isDraft), Optional.ofNullable(hasAttachment),
Optional.ofNullable(text), Optional.ofNullable(from), Optional.ofNullable(to), Optional.ofNullable(cc), Optional.ofNullable(bcc), Optional.ofNullable(subject), Optional.ofNullable(body), header.build()); Optional.ofNullable(text), Optional.ofNullable(from), Optional.ofNullable(to), Optional.ofNullable(cc), Optional.ofNullable(bcc), Optional.ofNullable(subject), Optional.ofNullable(body), header.build());
} }
} }


private final List<String> inMailboxes; private final Optional<List<String>> inMailboxes;
private final List<String> notInMailboxes; private final Optional<List<String>> notInMailboxes;
private final Optional<Date> before; private final Optional<Date> before;
private final Optional<Date> after; private final Optional<Date> after;
private final Optional<Integer> minSize; private final Optional<Integer> minSize;
Expand All @@ -170,7 +171,7 @@ public FilterCondition build() {
private final Optional<String> body; private final Optional<String> body;
private final List<String> header; private final List<String> header;


@VisibleForTesting FilterCondition(List<String> inMailboxes, List<String> notInMailboxes, Optional<Date> before, Optional<Date> after, Optional<Integer> minSize, Optional<Integer> maxSize, @VisibleForTesting FilterCondition(Optional<List<String>> inMailboxes, Optional<List<String>> notInMailboxes, Optional<Date> before, Optional<Date> after, Optional<Integer> minSize, Optional<Integer> maxSize,
Optional<Boolean> isFlagged, Optional<Boolean> isUnread, Optional<Boolean> isAnswered, Optional<Boolean> isDraft, Optional<Boolean> hasAttachment, Optional<Boolean> isFlagged, Optional<Boolean> isUnread, Optional<Boolean> isAnswered, Optional<Boolean> isDraft, Optional<Boolean> hasAttachment,
Optional<String> text, Optional<String> from, Optional<String> to, Optional<String> cc, Optional<String> bcc, Optional<String> subject, Optional<String> body, List<String> header) { Optional<String> text, Optional<String> from, Optional<String> to, Optional<String> cc, Optional<String> bcc, Optional<String> subject, Optional<String> body, List<String> header) {


Expand All @@ -195,11 +196,11 @@ public FilterCondition build() {
this.header = header; this.header = header;
} }


public List<String> getInMailboxes() { public Optional<List<String>> getInMailboxes() {
return inMailboxes; return inMailboxes;
} }


public List<String> getNotInMailboxes() { public Optional<List<String>> getNotInMailboxes() {
return notInMailboxes; return notInMailboxes;
} }


Expand Down
Original file line number Original file line Diff line number Diff line change
Expand Up @@ -39,14 +39,17 @@ public void buildShouldWorkWhenNoInMailboxes() {
@Test @Test
public void buildShouldWorkWhenGivenInMailboxes() { public void buildShouldWorkWhenGivenInMailboxes() {
FilterCondition filterCondition = FilterCondition.builder() FilterCondition filterCondition = FilterCondition.builder()
.inMailboxes(ImmutableList.of("1", "2")) .inMailboxes(Optional.of(ImmutableList.of("1", "2")))
.build(); .build();
assertThat(filterCondition.getInMailboxes()).containsOnly("1", "2"); assertThat(filterCondition.getInMailboxes()).isEqualTo(Optional.of(ImmutableList.of("1", "2")));
} }


@Test(expected=NotImplementedException.class) @Test
public void builderShouldThrowWhenNotInMailboxes() { public void builderShouldBuildWhenGivenNotInMailboxes() {
FilterCondition.builder().notInMailboxes(ImmutableList.of()); FilterCondition filterCondition = FilterCondition.builder()
.notInMailboxes(Optional.of(ImmutableList.of("1", "2")))
.build();
assertThat(filterCondition.getNotInMailboxes()).isEqualTo(Optional.of(ImmutableList.of("1", "2")));
} }


@Test(expected=NotImplementedException.class) @Test(expected=NotImplementedException.class)
Expand Down Expand Up @@ -136,12 +139,13 @@ public void builderShouldThrowWhenHeader() {


@Test @Test
public void buildShouldWork() { public void buildShouldWork() {
FilterCondition expectedFilterCondition = new FilterCondition(ImmutableList.of("1"), ImmutableList.of(), Optional.empty(), Optional.empty(), Optional.empty(), Optional.empty(), FilterCondition expectedFilterCondition = new FilterCondition(Optional.of(ImmutableList.of("1")), Optional.of(ImmutableList.of("2")), Optional.empty(), Optional.empty(), Optional.empty(), Optional.empty(),
Optional.empty(), Optional.empty(), Optional.empty(), Optional.empty(), Optional.empty(), Optional.empty(), Optional.empty(), Optional.empty(), Optional.empty(), Optional.empty(), Optional.empty(), Optional.empty(), Optional.empty(), Optional.empty(),
Optional.empty(), Optional.empty(), Optional.empty(), Optional.empty(), Optional.empty(), ImmutableList.of()); Optional.empty(), Optional.empty(), Optional.empty(), Optional.empty(), Optional.empty(), ImmutableList.of());


FilterCondition filterCondition = FilterCondition.builder() FilterCondition filterCondition = FilterCondition.builder()
.inMailboxes(ImmutableList.of("1")) .inMailboxes(Optional.of(ImmutableList.of("1")))
.notInMailboxes(Optional.of(ImmutableList.of("2")))
.build(); .build();


assertThat(filterCondition).isEqualToComparingFieldByField(expectedFilterCondition); assertThat(filterCondition).isEqualToComparingFieldByField(expectedFilterCondition);
Expand Down
Original file line number Original file line Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@
import static org.assertj.core.api.Assertions.assertThat; import static org.assertj.core.api.Assertions.assertThat;


import java.util.List; import java.util.List;
import java.util.Optional;


import org.apache.commons.lang.NotImplementedException; import org.apache.commons.lang.NotImplementedException;
import org.junit.Test; import org.junit.Test;
Expand Down Expand Up @@ -68,7 +69,7 @@ public void builderShouldThrowWhenThreadIds() {
@Test @Test
public void builderShouldWork() { public void builderShouldWork() {
FilterCondition filterCondition = FilterCondition.builder() FilterCondition filterCondition = FilterCondition.builder()
.inMailboxes(ImmutableList.of("1", "2")) .inMailboxes(Optional.of(ImmutableList.of("1", "2")))
.build(); .build();
List<String> sort = ImmutableList.of("date desc"); List<String> sort = ImmutableList.of("date desc");
List<MessageId> messageIds = ImmutableList.of(MessageId.of("user|mailbox|3"), MessageId.of("user|mailbox|4")); List<MessageId> messageIds = ImmutableList.of(MessageId.of("user|mailbox|3"), MessageId.of("user|mailbox|4"));
Expand Down
Original file line number Original file line Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ public void builderShouldThrowWhenFetchSearchSnippets() {
@Test @Test
public void builderShouldWork() { public void builderShouldWork() {
FilterCondition filterCondition = FilterCondition.builder() FilterCondition filterCondition = FilterCondition.builder()
.inMailboxes(ImmutableList.of("1", "2")) .inMailboxes(Optional.of(ImmutableList.of("1", "2")))
.build(); .build();
List<String> sort = ImmutableList.of("date desc"); List<String> sort = ImmutableList.of("date desc");
List<String> fetchMessageProperties = ImmutableList.of("id", "blobId"); List<String> fetchMessageProperties = ImmutableList.of("id", "blobId");
Expand Down

0 comments on commit af7b1c6

Please sign in to comment.