This is an automated email from the ASF dual-hosted git repository.

rouazana pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/james-project.git

commit 9fe02e525c6411179963e64b9c82f2ff4a92e25a
Author: Tran Tien Duc <[email protected]>
AuthorDate: Wed Jun 5 10:46:08 2019 +0700

    JAMES-2621 MailboxManager doesn't throw when creating a mailbox containing
    another user path
---
 .../org/apache/james/mailbox/MailboxManagerTest.java   | 18 ++++++++++++++++++
 1 file changed, 18 insertions(+)

diff --git 
a/mailbox/api/src/test/java/org/apache/james/mailbox/MailboxManagerTest.java 
b/mailbox/api/src/test/java/org/apache/james/mailbox/MailboxManagerTest.java
index c152e99..4661852 100644
--- a/mailbox/api/src/test/java/org/apache/james/mailbox/MailboxManagerTest.java
+++ b/mailbox/api/src/test/java/org/apache/james/mailbox/MailboxManagerTest.java
@@ -1325,6 +1325,24 @@ public abstract class MailboxManagerTest<T extends 
MailboxManager> {
             assertThatCode(() -> 
mailboxManager.copyMessages(MessageRange.all(), inbox, inbox, session))
                 .doesNotThrowAnyException();
         }
+
+        @Test
+        void createMailboxShouldNotThrowWhenMailboxPathBelongsToUser() throws 
MailboxException {
+            session = mailboxManager.createSystemSession(USER_1);
+            Optional<MailboxId> mailboxId = mailboxManager
+                .createMailbox(MailboxPath.forUser(USER_1, "mailboxName"), 
session);
+
+            assertThat(mailboxId).isNotEmpty();
+        }
+
+        @Test
+        void createMailboxDoesNotThrowWhenMailboxPathBelongsToAnotherUser() 
throws MailboxException {
+            session = mailboxManager.createSystemSession(USER_1);
+
+            assertThatCode(() -> mailboxManager
+                    .createMailbox(MailboxPath.forUser(USER_2, "mailboxName"), 
session))
+                .doesNotThrowAnyException();
+        }
     }
 
     @Nested


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to