[Refactoring] Move AbstractMessageManagerTest to JUnit 5
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 @@
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.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 @@
}
@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 @@
}
@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);