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

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

commit 5f8d524ce6632b15f1077e1a9351d8061d31140e
Author: Rene Cordier <rcord...@linagora.com>
AuthorDate: Tue Dec 10 11:45:22 2019 +0700

    [Refactoring] Move AbstractMessageManagerTest to JUnit 5
---
 .../mailbox/inmemory/InMemoryMessageManagerTest.java | 17 ++++++-----------
 .../mailbox/store/AbstractMessageManagerTest.java    | 20 ++++++++------------
 2 files changed, 14 insertions(+), 23 deletions(-)

diff --git 
a/mailbox/memory/src/test/java/org/apache/james/mailbox/inmemory/InMemoryMessageManagerTest.java
 
b/mailbox/memory/src/test/java/org/apache/james/mailbox/inmemory/InMemoryMessageManagerTest.java
index fddfc18..df575e3 100644
--- 
a/mailbox/memory/src/test/java/org/apache/james/mailbox/inmemory/InMemoryMessageManagerTest.java
+++ 
b/mailbox/memory/src/test/java/org/apache/james/mailbox/inmemory/InMemoryMessageManagerTest.java
@@ -21,19 +21,14 @@ package org.apache.james.mailbox.inmemory;
 import org.apache.james.mailbox.inmemory.manager.InMemoryIntegrationResources;
 import org.apache.james.mailbox.store.AbstractMessageManagerTest;
 import org.apache.james.mailbox.store.MessageManagerTestSystem;
-import org.junit.Before;
+import org.junit.jupiter.api.BeforeEach;
 
-public class InMemoryMessageManagerTest extends AbstractMessageManagerTest {
+class InMemoryMessageManagerTest extends AbstractMessageManagerTest {
 
-    @Override
-    @Before
-    public void setUp() throws Exception {
-        super.setUp();
-    }
-    
-    @Override
-    protected MessageManagerTestSystem createTestSystem() {
-        return new 
InMemoryMessageManagerTestSystem(InMemoryIntegrationResources.defaultResources().getMailboxManager());
+    @BeforeEach
+    void setUp() throws Exception {
+        MessageManagerTestSystem testSystem = new 
InMemoryMessageManagerTestSystem(InMemoryIntegrationResources.defaultResources().getMailboxManager());
+        super.setup(testSystem);
     }
 
 }
diff --git 
a/mailbox/store/src/test/java/org/apache/james/mailbox/store/AbstractMessageManagerTest.java
 
b/mailbox/store/src/test/java/org/apache/james/mailbox/store/AbstractMessageManagerTest.java
index 0d517df..3c23ef3 100644
--- 
a/mailbox/store/src/test/java/org/apache/james/mailbox/store/AbstractMessageManagerTest.java
+++ 
b/mailbox/store/src/test/java/org/apache/james/mailbox/store/AbstractMessageManagerTest.java
@@ -31,23 +31,19 @@ import org.apache.james.mailbox.MailboxSessionUtil;
 import org.apache.james.mailbox.MessageManager;
 import org.apache.james.mailbox.fixture.MailboxFixture;
 import org.apache.james.mailbox.model.MailboxACL;
-import org.junit.Test;
+import org.junit.jupiter.api.Test;
 
 public abstract class AbstractMessageManagerTest {
 
-    private static final boolean NO_RESET_RECENT = false;
+    static final boolean NO_RESET_RECENT = false;
 
-    private MessageManagerTestSystem testSystem;
-    private MailboxManager mailboxManager;
-    private MailboxSession aliceSession;
-    private MailboxSession bobSession;
+    MailboxManager mailboxManager;
+    MailboxSession aliceSession;
+    MailboxSession bobSession;
 
-    protected abstract MessageManagerTestSystem createTestSystem() throws 
Exception;
-
-    public void setUp() throws Exception {
+    protected void setup(MessageManagerTestSystem testSystem) throws Exception 
{
         aliceSession = MailboxSessionUtil.create(ALICE);
         bobSession = MailboxSessionUtil.create(BOB);
-        testSystem = createTestSystem();
         mailboxManager = testSystem.getMailboxManager();
 
         testSystem.createMailbox(INBOX_ALICE, aliceSession);
@@ -57,7 +53,7 @@ public abstract class AbstractMessageManagerTest {
     }
 
     @Test
-    public void getMetadataShouldListUsersAclWhenShared() throws Exception {
+    void getMetadataShouldListUsersAclWhenShared() throws Exception {
         mailboxManager.applyRightsCommand(INBOX_ALICE, 
MailboxACL.command().forUser(BOB).rights(MailboxACL.Right.Read).asAddition(), 
aliceSession);
         mailboxManager.applyRightsCommand(INBOX_ALICE, 
MailboxACL.command().forUser(CEDRIC).rights(MailboxACL.Right.Read).asAddition(),
 aliceSession);
         MessageManager messageManager = mailboxManager.getMailbox(INBOX_ALICE, 
aliceSession);
@@ -67,7 +63,7 @@ public abstract class AbstractMessageManagerTest {
     }
 
     @Test
-    public void getMetadataShouldNotExposeOtherUsersWhenSessionIsNotOwner() 
throws Exception {
+    void getMetadataShouldNotExposeOtherUsersWhenSessionIsNotOwner() throws 
Exception {
         mailboxManager.applyRightsCommand(INBOX_ALICE, 
MailboxACL.command().forUser(BOB).rights(MailboxACL.Right.Read).asAddition(), 
aliceSession);
         mailboxManager.applyRightsCommand(INBOX_ALICE, 
MailboxACL.command().forUser(CEDRIC).rights(MailboxACL.Right.Read).asAddition(),
 aliceSession);
         MessageManager messageManager = mailboxManager.getMailbox(INBOX_ALICE, 
aliceSession);


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

Reply via email to