JAMES-1678 GetMailboxMessageListRequestTest renamed to GetMessageListRequestTest
Project: http://git-wip-us.apache.org/repos/asf/james-project/repo Commit: http://git-wip-us.apache.org/repos/asf/james-project/commit/00199af1 Tree: http://git-wip-us.apache.org/repos/asf/james-project/tree/00199af1 Diff: http://git-wip-us.apache.org/repos/asf/james-project/diff/00199af1 Branch: refs/heads/master Commit: 00199af12528560997107c2beec2134cf6699f87 Parents: c6f8836 Author: Laura Royet <lro...@linagora.com> Authored: Tue Feb 2 17:32:30 2016 +0100 Committer: Antoine Duprat <antdup...@gmail.com> Committed: Wed Feb 3 11:00:49 2016 +0100 ---------------------------------------------------------------------- .../model/GetMailboxMessageListRequestTest.java | 100 ------------------- .../jmap/model/GetMessageListRequestTest.java | 100 +++++++++++++++++++ 2 files changed, 100 insertions(+), 100 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/james-project/blob/00199af1/server/protocols/jmap/src/test/java/org/apache/james/jmap/model/GetMailboxMessageListRequestTest.java ---------------------------------------------------------------------- diff --git a/server/protocols/jmap/src/test/java/org/apache/james/jmap/model/GetMailboxMessageListRequestTest.java b/server/protocols/jmap/src/test/java/org/apache/james/jmap/model/GetMailboxMessageListRequestTest.java deleted file mode 100644 index ef8a69f..0000000 --- a/server/protocols/jmap/src/test/java/org/apache/james/jmap/model/GetMailboxMessageListRequestTest.java +++ /dev/null @@ -1,100 +0,0 @@ -/**************************************************************** - * Licensed to the Apache Software Foundation (ASF) under one * - * or more contributor license agreements. See the NOTICE file * - * distributed with this work for additional information * - * regarding copyright ownership. The ASF licenses this file * - * to you under the Apache License, Version 2.0 (the * - * "License"); you may not use this file except in compliance * - * with the License. You may obtain a copy of the License at * - * * - * http://www.apache.org/licenses/LICENSE-2.0 * - * * - * Unless required by applicable law or agreed to in writing, * - * software distributed under the License is distributed on an * - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY * - * KIND, either express or implied. See the License for the * - * specific language governing permissions and limitations * - * under the License. * - ****************************************************************/ - -package org.apache.james.jmap.model; - -import static org.assertj.core.api.Assertions.assertThat; - -import java.util.List; -import java.util.Optional; - -import org.apache.commons.lang.NotImplementedException; -import org.junit.Test; - -import com.google.common.collect.ImmutableList; - -public class GetMailboxMessageListRequestTest { - - @Test(expected=IllegalStateException.class) - public void builderShouldThrowWhenPositionIsNegative() { - GetMessageListRequest.builder().position(-1).build(); - } - - @Test(expected=IllegalStateException.class) - public void builderShouldThrowWhenLimitIsNegative() { - GetMessageListRequest.builder().limit(-1).build(); - } - - @Test(expected=NotImplementedException.class) - public void builderShouldThrowWhenAccountId() { - GetMessageListRequest.builder().accountId(null); - } - - @Test(expected=NotImplementedException.class) - public void builderShouldThrowWhenCollapseThreadsIsTrue() { - GetMessageListRequest.builder().collapseThreads(true); - } - - @Test(expected=NotImplementedException.class) - public void builderShouldThrowWhenAnchor() { - GetMessageListRequest.builder().anchor(null); - } - - @Test(expected=NotImplementedException.class) - public void builderShouldThrowWhenAnchorOffset() { - GetMessageListRequest.builder().anchorOffset(0); - } - - @Test(expected=NotImplementedException.class) - public void builderShouldThrowWhenFetchThreads() { - GetMessageListRequest.builder().fetchThreads(false); - } - - @Test(expected=NotImplementedException.class) - public void builderShouldThrowWhenFetchMessages() { - GetMessageListRequest.builder().fetchMessages(false); - } - - @Test(expected=NotImplementedException.class) - public void builderShouldThrowWhenFetchSearchSnippets() { - GetMessageListRequest.builder().fetchSearchSnippets(false); - } - - @Test - public void builderShouldWork() { - FilterCondition filterCondition = FilterCondition.builder() - .inMailboxes(ImmutableList.of("1", "2")) - .build(); - List<String> sort = ImmutableList.of("date desc"); - List<String> fetchMessageProperties = ImmutableList.of("id", "blobId"); - GetMessageListRequest expectedGetMessageListRequest = new GetMessageListRequest(Optional.empty(), Optional.of(filterCondition), sort, Optional.of(false), 1, Optional.empty(), Optional.empty(), Optional.of(2), - Optional.empty(), Optional.empty(), fetchMessageProperties, Optional.empty()); - - GetMessageListRequest getMessageListRequest = GetMessageListRequest.builder() - .filter(filterCondition) - .sort(sort) - .collapseThreads(false) - .position(1) - .limit(2) - .fetchMessageProperties(fetchMessageProperties) - .build(); - - assertThat(getMessageListRequest).isEqualToComparingFieldByField(expectedGetMessageListRequest); - } -} http://git-wip-us.apache.org/repos/asf/james-project/blob/00199af1/server/protocols/jmap/src/test/java/org/apache/james/jmap/model/GetMessageListRequestTest.java ---------------------------------------------------------------------- diff --git a/server/protocols/jmap/src/test/java/org/apache/james/jmap/model/GetMessageListRequestTest.java b/server/protocols/jmap/src/test/java/org/apache/james/jmap/model/GetMessageListRequestTest.java new file mode 100644 index 0000000..029600d --- /dev/null +++ b/server/protocols/jmap/src/test/java/org/apache/james/jmap/model/GetMessageListRequestTest.java @@ -0,0 +1,100 @@ +/**************************************************************** + * Licensed to the Apache Software Foundation (ASF) under one * + * or more contributor license agreements. See the NOTICE file * + * distributed with this work for additional information * + * regarding copyright ownership. The ASF licenses this file * + * to you under the Apache License, Version 2.0 (the * + * "License"); you may not use this file except in compliance * + * with the License. You may obtain a copy of the License at * + * * + * http://www.apache.org/licenses/LICENSE-2.0 * + * * + * Unless required by applicable law or agreed to in writing, * + * software distributed under the License is distributed on an * + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY * + * KIND, either express or implied. See the License for the * + * specific language governing permissions and limitations * + * under the License. * + ****************************************************************/ + +package org.apache.james.jmap.model; + +import static org.assertj.core.api.Assertions.assertThat; + +import java.util.List; +import java.util.Optional; + +import org.apache.commons.lang.NotImplementedException; +import org.junit.Test; + +import com.google.common.collect.ImmutableList; + +public class GetMessageListRequestTest { + + @Test(expected=IllegalStateException.class) + public void builderShouldThrowWhenPositionIsNegative() { + GetMessageListRequest.builder().position(-1).build(); + } + + @Test(expected=IllegalStateException.class) + public void builderShouldThrowWhenLimitIsNegative() { + GetMessageListRequest.builder().limit(-1).build(); + } + + @Test(expected=NotImplementedException.class) + public void builderShouldThrowWhenAccountId() { + GetMessageListRequest.builder().accountId(null); + } + + @Test(expected=NotImplementedException.class) + public void builderShouldThrowWhenCollapseThreadsIsTrue() { + GetMessageListRequest.builder().collapseThreads(true); + } + + @Test(expected=NotImplementedException.class) + public void builderShouldThrowWhenAnchor() { + GetMessageListRequest.builder().anchor(null); + } + + @Test(expected=NotImplementedException.class) + public void builderShouldThrowWhenAnchorOffset() { + GetMessageListRequest.builder().anchorOffset(0); + } + + @Test(expected=NotImplementedException.class) + public void builderShouldThrowWhenFetchThreads() { + GetMessageListRequest.builder().fetchThreads(false); + } + + @Test(expected=NotImplementedException.class) + public void builderShouldThrowWhenFetchMessages() { + GetMessageListRequest.builder().fetchMessages(false); + } + + @Test(expected=NotImplementedException.class) + public void builderShouldThrowWhenFetchSearchSnippets() { + GetMessageListRequest.builder().fetchSearchSnippets(false); + } + + @Test + public void builderShouldWork() { + FilterCondition filterCondition = FilterCondition.builder() + .inMailboxes(ImmutableList.of("1", "2")) + .build(); + List<String> sort = ImmutableList.of("date desc"); + List<String> fetchMessageProperties = ImmutableList.of("id", "blobId"); + GetMessageListRequest expectedGetMessageListRequest = new GetMessageListRequest(Optional.empty(), Optional.of(filterCondition), sort, Optional.of(false), 1, Optional.empty(), Optional.empty(), Optional.of(2), + Optional.empty(), Optional.empty(), fetchMessageProperties, Optional.empty()); + + GetMessageListRequest getMessageListRequest = GetMessageListRequest.builder() + .filter(filterCondition) + .sort(sort) + .collapseThreads(false) + .position(1) + .limit(2) + .fetchMessageProperties(fetchMessageProperties) + .build(); + + assertThat(getMessageListRequest).isEqualToComparingFieldByField(expectedGetMessageListRequest); + } +} --------------------------------------------------------------------- To unsubscribe, e-mail: server-dev-unsubscr...@james.apache.org For additional commands, e-mail: server-dev-h...@james.apache.org