You are viewing a plain text version of this content. The canonical link for it is here.
Posted to server-dev@james.apache.org by ad...@apache.org on 2017/11/15 11:15:54 UTC

[13/19] james-project git commit: JAMES-2214 s/validate/assert/ for SetMessageCreationProcessor check methods

JAMES-2214 s/validate/assert/ for SetMessageCreationProcessor check methods


Project: http://git-wip-us.apache.org/repos/asf/james-project/repo
Commit: http://git-wip-us.apache.org/repos/asf/james-project/commit/264ffd72
Tree: http://git-wip-us.apache.org/repos/asf/james-project/tree/264ffd72
Diff: http://git-wip-us.apache.org/repos/asf/james-project/diff/264ffd72

Branch: refs/heads/master
Commit: 264ffd72c194fcb113a7722df0c0cc6180d40626
Parents: 8ad6ba6
Author: benwa <bt...@linagora.com>
Authored: Mon Nov 13 15:59:55 2017 +0700
Committer: benwa <bt...@linagora.com>
Committed: Wed Nov 15 18:05:45 2017 +0700

----------------------------------------------------------------------
 .../jmap/methods/SetMessagesCreationProcessor.java    |  4 ++--
 .../methods/SetMessagesCreationProcessorTest.java     | 14 +++++++-------
 2 files changed, 9 insertions(+), 9 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/james-project/blob/264ffd72/server/protocols/jmap/src/main/java/org/apache/james/jmap/methods/SetMessagesCreationProcessor.java
----------------------------------------------------------------------
diff --git a/server/protocols/jmap/src/main/java/org/apache/james/jmap/methods/SetMessagesCreationProcessor.java b/server/protocols/jmap/src/main/java/org/apache/james/jmap/methods/SetMessagesCreationProcessor.java
index 4b0e38b..ac12072 100644
--- a/server/protocols/jmap/src/main/java/org/apache/james/jmap/methods/SetMessagesCreationProcessor.java
+++ b/server/protocols/jmap/src/main/java/org/apache/james/jmap/methods/SetMessagesCreationProcessor.java
@@ -110,7 +110,7 @@ public class SetMessagesCreationProcessor implements SetMessagesProcessor {
 
     private void handleCreate(CreationMessageEntry create, Builder responseBuilder, MailboxSession mailboxSession) {
         try {
-            validateIsUserOwnerOfMailboxes(create, mailboxSession);
+            assertIsUserOwnerOfMailboxes(create, mailboxSession);
             performCreate(create, responseBuilder, mailboxSession);
         } catch (MailboxSendingNotAllowedException e) {
             responseBuilder.notCreated(create.getCreationId(), 
@@ -217,7 +217,7 @@ public class SetMessagesCreationProcessor implements SetMessagesProcessor {
         attachmentChecker.assertAttachmentsExist(entry, session);
     }
 
-    @VisibleForTesting void validateIsUserOwnerOfMailboxes(CreationMessageEntry entry, MailboxSession session) throws MailboxNotOwnedException {
+    @VisibleForTesting void assertIsUserOwnerOfMailboxes(CreationMessageEntry entry, MailboxSession session) throws MailboxNotOwnedException {
         if (containsMailboxNotOwn(entry.getValue().getMailboxIds(), session)) {
             throw new MailboxNotOwnedException();
         }

http://git-wip-us.apache.org/repos/asf/james-project/blob/264ffd72/server/protocols/jmap/src/test/java/org/apache/james/jmap/methods/SetMessagesCreationProcessorTest.java
----------------------------------------------------------------------
diff --git a/server/protocols/jmap/src/test/java/org/apache/james/jmap/methods/SetMessagesCreationProcessorTest.java b/server/protocols/jmap/src/test/java/org/apache/james/jmap/methods/SetMessagesCreationProcessorTest.java
index 8a55816..0d8a9cb 100644
--- a/server/protocols/jmap/src/test/java/org/apache/james/jmap/methods/SetMessagesCreationProcessorTest.java
+++ b/server/protocols/jmap/src/test/java/org/apache/james/jmap/methods/SetMessagesCreationProcessorTest.java
@@ -322,11 +322,11 @@ public class SetMessagesCreationProcessorTest {
         CreationMessageId creationMessageId = CreationMessageId.of("anything-really");
         CreationMessageEntry entry = new CreationMessageEntry(creationMessageId, creationMessageBuilder.mailboxId(mailboxId.serialize()).build());
 
-        assertThatThrownBy(() -> sut.validateIsUserOwnerOfMailboxes(entry, session));
+        assertThatThrownBy(() -> sut.assertIsUserOwnerOfMailboxes(entry, session));
     }
 
     @Test
-    public void validateIsUserOwnerOfMailboxesShouldThrowWhenRetrievingMailboxPathFails() throws Exception {
+    public void assertIsUserOwnerOfMailboxesShouldThrowWhenRetrievingMailboxPathFails() throws Exception {
         CreationMessageId creationMessageId = CreationMessageId.of("anything-really");
         InMemoryId mailboxId = InMemoryId.of(6789);
         MessageManager mailbox = mock(MessageManager.class);
@@ -339,11 +339,11 @@ public class SetMessagesCreationProcessorTest {
 
         CreationMessageEntry entry = new CreationMessageEntry(creationMessageId, creationMessageBuilder.mailboxId(mailboxId.serialize()).build());
 
-        assertThatThrownBy(() -> sut.validateIsUserOwnerOfMailboxes(entry, session));
+        assertThatThrownBy(() -> sut.assertIsUserOwnerOfMailboxes(entry, session));
     }
 
     @Test
-    public void validateIsUserOwnerOfMailboxesShouldThrowWhenUserIsNotTheOwnerOfTheMailbox() throws Exception {
+    public void assertIsUserOwnerOfMailboxesShouldThrowWhenUserIsNotTheOwnerOfTheMailbox() throws Exception {
         CreationMessageId creationMessageId = CreationMessageId.of("anything-really");
         InMemoryId mailboxId = InMemoryId.of(6789);
         MessageManager mailbox = mock(MessageManager.class);
@@ -357,12 +357,12 @@ public class SetMessagesCreationProcessorTest {
 
         CreationMessageEntry entry = new CreationMessageEntry(creationMessageId, creationMessageBuilder.mailboxId(mailboxId.serialize()).build());
 
-        assertThatThrownBy(() -> sut.validateIsUserOwnerOfMailboxes(entry, session))
+        assertThatThrownBy(() -> sut.assertIsUserOwnerOfMailboxes(entry, session))
             .isInstanceOf(MailboxNotOwnedException.class);
     }
 
     @Test
-    public void validateIsUserOwnerOfMailboxesShouldNotThrowWhenUserIsTheOwnerOfTheMailbox() throws Exception {
+    public void assertIsUserOwnerOfMailboxesShouldNotThrowWhenUserIsTheOwnerOfTheMailbox() throws Exception {
         CreationMessageId creationMessageId = CreationMessageId.of("anything-really");
         InMemoryId mailboxId = InMemoryId.of(6789);
         MessageManager mailbox = mock(MessageManager.class);
@@ -376,7 +376,7 @@ public class SetMessagesCreationProcessorTest {
 
         CreationMessageEntry entry = new CreationMessageEntry(creationMessageId, creationMessageBuilder.mailboxId(mailboxId.serialize()).build());
 
-        sut.validateIsUserOwnerOfMailboxes(entry, session);
+        sut.assertIsUserOwnerOfMailboxes(entry, session);
     }
     
     public static class TestSystemMailboxesProvider implements SystemMailboxesProvider {


---------------------------------------------------------------------
To unsubscribe, e-mail: server-dev-unsubscribe@james.apache.org
For additional commands, e-mail: server-dev-help@james.apache.org