You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@james.apache.org by bt...@apache.org on 2021/02/09 04:29:37 UTC
[james-project] 09/33: [REFACTORING] Get rid of some JUNIT 4 usages
in server-mailets tests
This is an automated email from the ASF dual-hosted git repository.
btellier pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/james-project.git
commit cbe33c239c5079e7380d9f6014a45a26281756b9
Author: Benoit Tellier <bt...@linagora.com>
AuthorDate: Sat Feb 6 12:19:18 2021 +0700
[REFACTORING] Get rid of some JUNIT 4 usages in server-mailets tests
---
.../RecipientRewriteTableProcessorTest.java | 58 +++----
.../mailets/RecipientRewriteTableTest.java | 38 +++--
.../transport/mailets/ResourceLocatorTest.java | 15 +-
.../james/transport/mailets/WithPriorityTest.java | 26 ++--
.../mailets/WithStorageDirectiveTest.java | 38 +++--
.../mailets/delivery/LocalDeliveryTest.java | 14 +-
.../mailets/delivery/MailDispatcherTest.java | 30 ++--
.../mailets/delivery/SieveIntegrationTest.java | 170 ++++++++++-----------
.../mailets/delivery/SimpleMailStoreTest.java | 17 +--
.../mailets/jsieve/DiscardActionTest.java | 13 +-
.../managesieve/ManageSieveMailetTestCase.java | 98 ++++++------
.../redirect/LoadedOnceInitParametersTest.java | 7 +-
.../redirect/NotifyMailetInitParametersTest.java | 99 ++++++------
.../mailets/redirect/NotifyMailetsMessageTest.java | 61 ++++----
.../redirect/RedirectMailetInitParametersTest.java | 15 +-
.../mailets/redirect/SpecialAddressTest.java | 27 ++--
...dressesArrayToMailAddressListConverterTest.java | 14 +-
.../mailets/remote/delivery/BouncerTest.java | 48 +++---
.../remote/delivery/DeliveryRetryHelperTest.java | 18 +--
.../mailets/remote/delivery/MailDelivrerTest.java | 54 +++----
.../remote/delivery/RemoteDeliveryRunningTest.java | 19 ++-
.../remote/delivery/RemoteDeliveryTest.java | 20 +--
.../transport/matchers/AtLeastPriorityTest.java | 16 +-
.../transport/matchers/AtMostPriorityTest.java | 16 +-
.../james/transport/matchers/HasPriorityTest.java | 12 +-
.../transport/matchers/InSpammerBlacklistTest.java | 12 +-
.../transport/matchers/IsMarkedAsSpamTest.java | 23 ++-
.../james/transport/matchers/IsOverQuotaTest.java | 20 +--
.../transport/matchers/IsSenderInRRTLoopTest.java | 22 +--
.../matchers/RemoteAddrInNetworkTest.java | 14 +-
.../matchers/RemoteAddrNotInNetworkTest.java | 18 +--
.../james/transport/util/RecipientsUtilsTest.java | 21 ++-
.../james/transport/util/ReplyToUtilsTest.java | 11 +-
.../james/transport/util/SenderUtilsTest.java | 13 +-
.../apache/james/transport/util/SizeUtilsTest.java | 23 ++-
.../apache/james/transport/util/TosUtilsTest.java | 21 ++-
36 files changed, 557 insertions(+), 584 deletions(-)
diff --git a/server/mailet/mailets/src/test/java/org/apache/james/transport/mailets/RecipientRewriteTableProcessorTest.java b/server/mailet/mailets/src/test/java/org/apache/james/transport/mailets/RecipientRewriteTableProcessorTest.java
index 746ebef..1fa6964 100644
--- a/server/mailet/mailets/src/test/java/org/apache/james/transport/mailets/RecipientRewriteTableProcessorTest.java
+++ b/server/mailet/mailets/src/test/java/org/apache/james/transport/mailets/RecipientRewriteTableProcessorTest.java
@@ -20,8 +20,10 @@
package org.apache.james.transport.mailets;
import static org.assertj.core.api.Assertions.assertThat;
+import static org.assertj.core.api.Assertions.assertThatThrownBy;
import static org.mockito.ArgumentMatchers.any;
import static org.mockito.ArgumentMatchers.eq;
+import static org.mockito.Mockito.mock;
import static org.mockito.Mockito.when;
import java.util.Collection;
@@ -42,14 +44,12 @@ import org.apache.mailet.Mail;
import org.apache.mailet.base.MailAddressFixture;
import org.apache.mailet.base.test.FakeMail;
import org.apache.mailet.base.test.FakeMailContext;
-import org.junit.Before;
-import org.junit.Test;
-import org.mockito.Mock;
-import org.mockito.MockitoAnnotations;
+import org.junit.jupiter.api.BeforeEach;
+import org.junit.jupiter.api.Test;
import com.google.common.collect.ImmutableList;
-public class RecipientRewriteTableProcessorTest {
+class RecipientRewriteTableProcessorTest {
private static final String NONEDOMAIN = "nonedomain";
private static final String INVALID_MAIL_ADDRESS = "server-dev@";
@@ -58,15 +58,14 @@ public class RecipientRewriteTableProcessorTest {
private MappingsImpl mappings;
private FakeMailContext mailetContext;
private MailAddress nonDomainWithDefaultLocal;
-
- @Mock DomainList domainList;
- @Mock org.apache.james.rrt.api.RecipientRewriteTable virtualTableStore;
-
+ private DomainList domainList;
+ private org.apache.james.rrt.api.RecipientRewriteTable virtualTableStore;
private RecipientRewriteTableProcessor processor;
- @Before
- public void setup() throws Exception {
- MockitoAnnotations.initMocks(this);
+ @BeforeEach
+ void setup() throws Exception {
+ domainList = mock(DomainList.class);
+ virtualTableStore = mock(org.apache.james.rrt.api.RecipientRewriteTable.class);
mailetContext = FakeMailContext.defaultContext();
processor = new RecipientRewriteTableProcessor(virtualTableStore, domainList, mailetContext);
mail = FakeMail.builder().name("mail").sender(MailAddressFixture.ANY_AT_JAMES).build();
@@ -78,7 +77,7 @@ public class RecipientRewriteTableProcessorTest {
nonDomainWithDefaultLocal = new MailAddress(NONEDOMAIN + "@" + MailAddressFixture.JAMES_LOCAL);
}
- @Test(expected = MessagingException.class)
+ @Test
public void handleMappingsShouldThrowExceptionWhenMappingsContainAtLeastOneNoneDomainObjectButCannotGetDefaultDomain() throws Exception {
when(domainList.getDefaultDomain()).thenThrow(DomainListException.class);
mappings = MappingsImpl.builder()
@@ -87,11 +86,13 @@ public class RecipientRewriteTableProcessorTest {
.add(MailAddressFixture.OTHER_AT_JAMES.toString())
.build();
- processor.handleMappings(mappings, FakeMail.builder().name("mail").sender(MailAddressFixture.ANY_AT_JAMES).build(), MailAddressFixture.OTHER_AT_JAMES);
+ assertThatThrownBy(() ->
+ processor.handleMappings(mappings, FakeMail.builder().name("mail").sender(MailAddressFixture.ANY_AT_JAMES).build(), MailAddressFixture.OTHER_AT_JAMES))
+ .isInstanceOf(MessagingException.class);
}
@Test
- public void handleMappingsShouldDoNotCareDefaultDomainWhenMappingsDoesNotContainAnyNoneDomainObject() throws Exception {
+ void handleMappingsShouldDoNotCareDefaultDomainWhenMappingsDoesNotContainAnyNoneDomainObject() throws Exception {
when(domainList.getDefaultDomain()).thenThrow(DomainListException.class);
mappings = MappingsImpl.builder()
.add(MailAddressFixture.ANY_AT_JAMES.toString())
@@ -102,7 +103,7 @@ public class RecipientRewriteTableProcessorTest {
}
@Test
- public void handleMappingsShouldReturnTheMailAddressBelongToLocalServer() throws Exception {
+ void handleMappingsShouldReturnTheMailAddressBelongToLocalServer() throws Exception {
when(domainList.getDefaultDomain()).thenReturn(Domain.of(MailAddressFixture.JAMES_LOCAL));
mappings = MappingsImpl.builder()
.add(MailAddressFixture.ANY_AT_JAMES.toString())
@@ -116,7 +117,7 @@ public class RecipientRewriteTableProcessorTest {
}
@Test
- public void handleMappingsShouldReturnTheOnlyMailAddressBelongToLocalServer() throws Exception {
+ void handleMappingsShouldReturnTheOnlyMailAddressBelongToLocalServer() throws Exception {
when(domainList.getDefaultDomain()).thenReturn(Domain.of(MailAddressFixture.JAMES2_APACHE_ORG));
mappings = MappingsImpl.builder()
@@ -132,7 +133,7 @@ public class RecipientRewriteTableProcessorTest {
}
@Test
- public void handleMappingsShouldRemoveMappingElementWhenCannotCreateMailAddress() throws Exception {
+ void handleMappingsShouldRemoveMappingElementWhenCannotCreateMailAddress() throws Exception {
when(domainList.getDefaultDomain()).thenReturn(Domain.of(MailAddressFixture.JAMES_LOCAL));
mappings = MappingsImpl.builder()
.add(MailAddressFixture.ANY_AT_JAMES.toString())
@@ -147,7 +148,7 @@ public class RecipientRewriteTableProcessorTest {
}
@Test
- public void handleMappingsShouldForwardEmailToRemoteServer() throws Exception {
+ void handleMappingsShouldForwardEmailToRemoteServer() throws Exception {
when(domainList.getDefaultDomain()).thenReturn(Domain.of(MailAddressFixture.JAMES_LOCAL));
mappings = MappingsImpl.builder()
@@ -170,7 +171,7 @@ public class RecipientRewriteTableProcessorTest {
}
@Test
- public void handleMappingsShouldNotForwardAnyEmailToRemoteServerWhenNoMoreReomoteAddress() throws Exception {
+ void handleMappingsShouldNotForwardAnyEmailToRemoteServerWhenNoMoreReomoteAddress() throws Exception {
when(domainList.getDefaultDomain()).thenReturn(Domain.of(MailAddressFixture.JAMES_LOCAL));
mappings = MappingsImpl.builder()
@@ -184,7 +185,7 @@ public class RecipientRewriteTableProcessorTest {
}
@Test
- public void handleMappingWithOnlyLocalRecipient() throws Exception {
+ void handleMappingWithOnlyLocalRecipient() throws Exception {
when(domainList.getDefaultDomain()).thenReturn(Domain.of(MailAddressFixture.JAMES_LOCAL));
mappings = MappingsImpl.builder()
@@ -199,7 +200,7 @@ public class RecipientRewriteTableProcessorTest {
}
@Test
- public void handleMappingWithOnlyRemoteRecipient() throws Exception {
+ void handleMappingWithOnlyRemoteRecipient() throws Exception {
when(domainList.getDefaultDomain()).thenReturn(Domain.of(MailAddressFixture.JAMES_LOCAL));
mappings = MappingsImpl.builder()
@@ -221,7 +222,7 @@ public class RecipientRewriteTableProcessorTest {
}
@Test
- public void processShouldNotRewriteRecipientWhenVirtualTableStoreReturnNullMappings() throws Exception {
+ void processShouldNotRewriteRecipientWhenVirtualTableStoreReturnNullMappings() throws Exception {
when(virtualTableStore.getResolvedMappings(any(String.class), any(Domain.class))).thenReturn(null);
mail = FakeMail.builder()
@@ -236,7 +237,7 @@ public class RecipientRewriteTableProcessorTest {
}
@Test
- public void processShouldSendMailToAllErrorRecipientsWhenErrorMappingException() throws Exception {
+ void processShouldSendMailToAllErrorRecipientsWhenErrorMappingException() throws Exception {
when(virtualTableStore.getResolvedMappings(eq("other"), eq(Domain.of(MailAddressFixture.JAMES_LOCAL)))).thenThrow(ErrorMappingException.class);
mail = FakeMail.builder()
@@ -261,7 +262,7 @@ public class RecipientRewriteTableProcessorTest {
}
@Test
- public void processShouldNotDuplicateRewrittenMailAddresses() throws Exception {
+ void processShouldNotDuplicateRewrittenMailAddresses() throws Exception {
when(virtualTableStore.getResolvedMappings(eq("other"), eq(Domain.of(MailAddressFixture.JAMES_LOCAL))))
.thenReturn(MappingsImpl.builder()
.add(Mapping.alias(MailAddressFixture.ANY_AT_LOCAL.asString()))
@@ -281,7 +282,7 @@ public class RecipientRewriteTableProcessorTest {
}
@Test
- public void processShouldSendMailToAllErrorRecipientsWhenRecipientRewriteTableException() throws Exception {
+ void processShouldSendMailToAllErrorRecipientsWhenRecipientRewriteTableException() throws Exception {
when(virtualTableStore.getResolvedMappings(eq("other"), eq(Domain.of(MailAddressFixture.JAMES_LOCAL)))).thenThrow(RecipientRewriteTableException.class);
mail = FakeMail.builder()
@@ -306,7 +307,7 @@ public class RecipientRewriteTableProcessorTest {
}
@Test
- public void processShouldNotSendMailWhenNoErrorRecipients() throws Exception {
+ void processShouldNotSendMailWhenNoErrorRecipients() throws Exception {
when(virtualTableStore.getResolvedMappings(any(String.class), any(Domain.class))).thenReturn(null);
mail = FakeMail.builder()
@@ -321,7 +322,7 @@ public class RecipientRewriteTableProcessorTest {
}
@Test
- public void processShouldResetMailStateToGhostWhenCanNotBuildNewRecipient() throws Exception {
+ void processShouldResetMailStateToGhostWhenCanNotBuildNewRecipient() throws Exception {
when(virtualTableStore.getResolvedMappings(any(String.class), any(Domain.class))).thenReturn(mappings);
when(domainList.getDefaultDomain()).thenReturn(Domain.of(MailAddressFixture.JAMES_LOCAL));
@@ -336,5 +337,4 @@ public class RecipientRewriteTableProcessorTest {
assertThat(mail.getState()).isEqualTo(Mail.GHOST);
assertThat(mail.getRecipients()).isEmpty();
}
-
}
\ No newline at end of file
diff --git a/server/mailet/mailets/src/test/java/org/apache/james/transport/mailets/RecipientRewriteTableTest.java b/server/mailet/mailets/src/test/java/org/apache/james/transport/mailets/RecipientRewriteTableTest.java
index b79eda6..a085170 100644
--- a/server/mailet/mailets/src/test/java/org/apache/james/transport/mailets/RecipientRewriteTableTest.java
+++ b/server/mailet/mailets/src/test/java/org/apache/james/transport/mailets/RecipientRewriteTableTest.java
@@ -19,6 +19,8 @@
package org.apache.james.transport.mailets;
import static org.assertj.core.api.Assertions.assertThat;
+import static org.assertj.core.api.Assertions.assertThatThrownBy;
+import static org.mockito.Mockito.mock;
import javax.mail.internet.MimeMessage;
@@ -29,32 +31,25 @@ import org.apache.mailet.base.MailAddressFixture;
import org.apache.mailet.base.test.FakeMail;
import org.apache.mailet.base.test.FakeMailContext;
import org.apache.mailet.base.test.FakeMailetConfig;
-import org.junit.Before;
-import org.junit.Test;
-import org.mockito.Mock;
-import org.mockito.MockitoAnnotations;
-
-public class RecipientRewriteTableTest {
+import org.junit.jupiter.api.BeforeEach;
+import org.junit.jupiter.api.Test;
+class RecipientRewriteTableTest {
private RecipientRewriteTable mailet;
-
- @Mock org.apache.james.rrt.api.RecipientRewriteTable virtualTableStore;
- @Mock DomainList domainList;
-
private FakeMail mail;
private MimeMessage message;
private FakeMailetConfig mailetConfig;
- private MailetContext mailetContext;
- @Before
- public void setUp() throws Exception {
- MockitoAnnotations.initMocks(this);
+ @BeforeEach
+ void setUp() throws Exception {
+ DomainList domainList = mock(DomainList.class);
+ org.apache.james.rrt.api.RecipientRewriteTable virtualTableStore = mock(org.apache.james.rrt.api.RecipientRewriteTable.class);
mailet = new RecipientRewriteTable(virtualTableStore, domainList);
message = MimeMessageUtil.defaultMimeMessage();
- mailetContext = FakeMailContext.defaultContext();
+ MailetContext mailetContext = FakeMailContext.defaultContext();
mailetConfig = FakeMailetConfig.builder()
.mailetName("vut")
@@ -65,22 +60,23 @@ public class RecipientRewriteTableTest {
}
@Test
- public void getMailetInfoShouldReturnCorrectInformation() throws Exception {
+ void getMailetInfoShouldReturnCorrectInformation() {
assertThat(mailet.getMailetInfo()).isEqualTo("RecipientRewriteTable Mailet");
}
- @Test(expected = NullPointerException.class)
- public void serviceShouldThrowExceptionWithNullMail() throws Exception {
- mailet.service(null);
+ @Test
+ public void serviceShouldThrowExceptionWithNullMail() {
+ assertThatThrownBy(() -> mailet.service(null))
+ .isInstanceOf(NullPointerException.class);
}
@Test
- public void serviceShouldDoNothingIfAbsentMessageInMail() throws Exception {
+ void serviceShouldDoNothingIfAbsentMessageInMail() throws Exception {
mailet.service(mail);
}
@Test
- public void serviceShouldWork() throws Exception {
+ void serviceShouldWork() throws Exception {
mailet.init(mailetConfig);
mail = FakeMail.builder()
.name("name")
diff --git a/server/mailet/mailets/src/test/java/org/apache/james/transport/mailets/ResourceLocatorTest.java b/server/mailet/mailets/src/test/java/org/apache/james/transport/mailets/ResourceLocatorTest.java
index 8aebfe4..c630e90 100644
--- a/server/mailet/mailets/src/test/java/org/apache/james/transport/mailets/ResourceLocatorTest.java
+++ b/server/mailet/mailets/src/test/java/org/apache/james/transport/mailets/ResourceLocatorTest.java
@@ -20,6 +20,7 @@
package org.apache.james.transport.mailets;
import static org.assertj.core.api.Assertions.assertThat;
+import static org.assertj.core.api.Assertions.assertThatThrownBy;
import static org.mockito.Mockito.mock;
import static org.mockito.Mockito.when;
@@ -32,11 +33,10 @@ import org.apache.james.sieverepository.api.SieveRepository;
import org.apache.james.sieverepository.api.exception.ScriptNotFoundException;
import org.apache.james.transport.mailets.jsieve.ResourceLocator;
import org.apache.james.user.api.UsersRepository;
-import org.junit.Before;
-import org.junit.Test;
-
-public class ResourceLocatorTest {
+import org.junit.jupiter.api.BeforeEach;
+import org.junit.jupiter.api.Test;
+class ResourceLocatorTest {
public static final String RECEIVER_LOCALHOST = "receiver@localhost";
public static final Username USERNAME = Username.of(RECEIVER_LOCALHOST);
private SieveRepository sieveRepository;
@@ -44,7 +44,7 @@ public class ResourceLocatorTest {
private MailAddress mailAddress;
private UsersRepository usersRepository;
- @Before
+ @BeforeEach
public void setUp() throws Exception {
sieveRepository = mock(SieveRepository.class);
usersRepository = mock(UsersRepository.class);
@@ -52,12 +52,13 @@ public class ResourceLocatorTest {
mailAddress = new MailAddress(RECEIVER_LOCALHOST);
}
- @Test(expected = ScriptNotFoundException.class)
+ @Test
public void resourceLocatorImplShouldPropagateScriptNotFound() throws Exception {
when(sieveRepository.getActive(USERNAME)).thenThrow(new ScriptNotFoundException());
when(usersRepository.getUsername(mailAddress)).thenReturn(Username.of(RECEIVER_LOCALHOST));
- resourceLocator.get(mailAddress);
+ assertThatThrownBy(() -> resourceLocator.get(mailAddress))
+ .isInstanceOf(ScriptNotFoundException.class);
}
@Test
diff --git a/server/mailet/mailets/src/test/java/org/apache/james/transport/mailets/WithPriorityTest.java b/server/mailet/mailets/src/test/java/org/apache/james/transport/mailets/WithPriorityTest.java
index 76fbdaf..b8b3628 100644
--- a/server/mailet/mailets/src/test/java/org/apache/james/transport/mailets/WithPriorityTest.java
+++ b/server/mailet/mailets/src/test/java/org/apache/james/transport/mailets/WithPriorityTest.java
@@ -30,21 +30,21 @@ import org.apache.mailet.MailetConfig;
import org.apache.mailet.base.test.FakeMail;
import org.apache.mailet.base.test.FakeMailContext;
import org.apache.mailet.base.test.FakeMailetConfig;
-import org.junit.Before;
-import org.junit.Test;
+import org.junit.jupiter.api.BeforeEach;
+import org.junit.jupiter.api.Test;
-public class WithPriorityTest {
+class WithPriorityTest {
private static final Attribute PROPERTY_PRIORITY = new Attribute(MailPrioritySupport.MAIL_PRIORITY, AttributeValue.of(7));
private WithPriority mailet;
- @Before
- public void setup() throws Exception {
+ @BeforeEach
+ void setup() {
mailet = new WithPriority();
}
@Test
- public void getMailetInfoShouldReturnExpectedContent() {
+ void getMailetInfoShouldReturnExpectedContent() {
String expected = "With Priority Mailet";
String actual = mailet.getMailetInfo();
@@ -53,7 +53,7 @@ public class WithPriorityTest {
}
@Test
- public void initShouldNotThrowWhenValidPriority() {
+ void initShouldNotThrowWhenValidPriority() {
MailetConfig mockedMailetConfig = FakeMailetConfig.builder()
.mailetContext(FakeMailContext.defaultContext())
.setProperty("priority", "7")
@@ -64,7 +64,7 @@ public class WithPriorityTest {
}
@Test
- public void initShouldThrowWhenInvalidPriority() {
+ void initShouldThrowWhenInvalidPriority() {
MailetConfig mockedMailetConfig = FakeMailetConfig.builder()
.mailetContext(FakeMailContext.defaultContext())
.setProperty("priority", "-1")
@@ -75,7 +75,7 @@ public class WithPriorityTest {
}
@Test
- public void initShouldThrowWhenPriorityIsNotANumber() {
+ void initShouldThrowWhenPriorityIsNotANumber() {
MailetConfig mockedMailetConfig = FakeMailetConfig.builder()
.mailetContext(FakeMailContext.defaultContext())
.setProperty("priority", "k")
@@ -86,7 +86,7 @@ public class WithPriorityTest {
}
@Test
- public void initShouldThrowWhenPriorityIsEmpty() {
+ void initShouldThrowWhenPriorityIsEmpty() {
MailetConfig mockedMailetConfig = FakeMailetConfig.builder()
.mailetContext(FakeMailContext.defaultContext())
.setProperty("priority", "")
@@ -97,7 +97,7 @@ public class WithPriorityTest {
}
@Test
- public void initShouldThrowWhenNoPriority() {
+ void initShouldThrowWhenNoPriority() {
MailetConfig mockedMailetConfig = FakeMailetConfig.builder()
.mailetContext(FakeMailContext.defaultContext())
.build();
@@ -107,7 +107,7 @@ public class WithPriorityTest {
}
@Test
- public void serviceShouldSetMailPriorityWhenNone() throws Exception {
+ void serviceShouldSetMailPriorityWhenNone() throws Exception {
MailetConfig mockedMailetConfig = FakeMailetConfig.builder()
.mailetContext(FakeMailContext.defaultContext())
.setProperty("priority", PROPERTY_PRIORITY.getValue().value().toString())
@@ -121,7 +121,7 @@ public class WithPriorityTest {
}
@Test
- public void serviceShouldSetMailPriorityWhenPriorityExists() throws Exception {
+ void serviceShouldSetMailPriorityWhenPriorityExists() throws Exception {
MailetConfig mockedMailetConfig = FakeMailetConfig.builder()
.mailetContext(FakeMailContext.defaultContext())
.setProperty("priority", PROPERTY_PRIORITY.getValue().value().toString())
diff --git a/server/mailet/mailets/src/test/java/org/apache/james/transport/mailets/WithStorageDirectiveTest.java b/server/mailet/mailets/src/test/java/org/apache/james/transport/mailets/WithStorageDirectiveTest.java
index e2a6a36..5338cb8 100644
--- a/server/mailet/mailets/src/test/java/org/apache/james/transport/mailets/WithStorageDirectiveTest.java
+++ b/server/mailet/mailets/src/test/java/org/apache/james/transport/mailets/WithStorageDirectiveTest.java
@@ -30,33 +30,29 @@ import org.apache.mailet.AttributeValue;
import org.apache.mailet.base.MailAddressFixture;
import org.apache.mailet.base.test.FakeMail;
import org.apache.mailet.base.test.FakeMailetConfig;
-import org.assertj.core.api.JUnitSoftAssertions;
-import org.junit.Before;
-import org.junit.Rule;
-import org.junit.Test;
+import org.assertj.core.api.SoftAssertions;
+import org.junit.jupiter.api.BeforeEach;
+import org.junit.jupiter.api.Test;
-public class WithStorageDirectiveTest {
+class WithStorageDirectiveTest {
private static final DomainList NO_DOMAIN_LIST = null;
private WithStorageDirective testee;
- @Rule
- public JUnitSoftAssertions softly = new JUnitSoftAssertions();
-
- @Before
- public void setUp() {
+ @BeforeEach
+ void setUp() {
testee = new WithStorageDirective(MemoryUsersRepository.withVirtualHosting(NO_DOMAIN_LIST));
}
@Test
- public void initShouldThrowWhenNoTargetFolderEntry() {
+ void initShouldThrowWhenNoTargetFolderEntry() {
assertThatThrownBy(() -> testee.init(FakeMailetConfig.builder()
.build()))
.isInstanceOf(IllegalStateException.class);
}
@Test
- public void initShouldThrowWhenEmptyTargetFolderEntry() {
+ void initShouldThrowWhenEmptyTargetFolderEntry() {
assertThatThrownBy(() -> testee.init(FakeMailetConfig.builder()
.setProperty(WithStorageDirective.TARGET_FOLDER_NAME, "")
.build()))
@@ -64,7 +60,7 @@ public class WithStorageDirectiveTest {
}
@Test
- public void serviceShouldAddDeliveryPathForRecipients() throws Exception {
+ void serviceShouldAddDeliveryPathForRecipients() throws Exception {
String targetFolderName = "Spam";
testee.init(FakeMailetConfig.builder()
.setProperty(WithStorageDirective.TARGET_FOLDER_NAME, targetFolderName)
@@ -79,14 +75,14 @@ public class WithStorageDirectiveTest {
AttributeName recipient1 = AttributeName.of("DeliveryPath_recipient1@localhost");
AttributeName recipient2 = AttributeName.of("DeliveryPath_recipient2@localhost");
- softly.assertThat(mail.attributes())
+ assertThat(mail.attributes())
.containsOnly(
new Attribute(recipient1, AttributeValue.of(targetFolderName)),
new Attribute(recipient2, AttributeValue.of(targetFolderName)));
}
@Test
- public void serviceShouldNotThrowWhenNoRecipients() throws Exception {
+ void serviceShouldNotThrowWhenNoRecipients() throws Exception {
String targetFolderName = "Spam";
testee.init(FakeMailetConfig.builder()
.setProperty(WithStorageDirective.TARGET_FOLDER_NAME, targetFolderName)
@@ -104,7 +100,7 @@ public class WithStorageDirectiveTest {
}
@Test
- public void serviceShouldOverridePreviousStorageDirectives() throws Exception {
+ void serviceShouldOverridePreviousStorageDirectives() throws Exception {
AttributeName name1 = AttributeName.of("DeliveryPath_recipient1@localhost");
AttributeName name2 = AttributeName.of("DeliveryPath_recipient2@localhost");
AttributeValue<String> targetFolderName = AttributeValue.of("Spam");
@@ -122,10 +118,12 @@ public class WithStorageDirectiveTest {
testee.service(mail);
- softly.assertThat(mail.attributes())
- .containsExactlyInAnyOrder(attribute1, attribute2);
- softly.assertThat(mail.getAttribute(name1)).contains(attribute1);
- softly.assertThat(mail.getAttribute(name2)).contains(attribute2);
+ SoftAssertions.assertSoftly(softly -> {
+ softly.assertThat(mail.attributes())
+ .containsExactlyInAnyOrder(attribute1, attribute2);
+ softly.assertThat(mail.getAttribute(name1)).contains(attribute1);
+ softly.assertThat(mail.getAttribute(name2)).contains(attribute2);
+ });
}
}
\ No newline at end of file
diff --git a/server/mailet/mailets/src/test/java/org/apache/james/transport/mailets/delivery/LocalDeliveryTest.java b/server/mailet/mailets/src/test/java/org/apache/james/transport/mailets/delivery/LocalDeliveryTest.java
index 44716b2..75a3b3a 100644
--- a/server/mailet/mailets/src/test/java/org/apache/james/transport/mailets/delivery/LocalDeliveryTest.java
+++ b/server/mailet/mailets/src/test/java/org/apache/james/transport/mailets/delivery/LocalDeliveryTest.java
@@ -47,13 +47,13 @@ import org.apache.mailet.Mail;
import org.apache.mailet.base.test.FakeMail;
import org.apache.mailet.base.test.FakeMailContext;
import org.apache.mailet.base.test.FakeMailetConfig;
-import org.junit.Before;
-import org.junit.Test;
+import org.junit.jupiter.api.BeforeEach;
+import org.junit.jupiter.api.Test;
import org.slf4j.Logger;
import reactor.core.publisher.Mono;
-public class LocalDeliveryTest {
+class LocalDeliveryTest {
public static final String RECEIVER_DOMAIN_COM = "receiver@domain.com";
private UsersRepository usersRepository;
@@ -62,8 +62,8 @@ public class LocalDeliveryTest {
private LocalDelivery testee;
private MailboxSession session;
- @Before
- public void setUp() throws Exception {
+ @BeforeEach
+ void setUp() throws Exception {
usersRepository = mock(UsersRepository.class);
mailboxManager = mock(MailboxManager.class);
@@ -83,7 +83,7 @@ public class LocalDeliveryTest {
}
@Test
- public void mailShouldBeWellDeliveredByDefaultToUserWhenVirtualHostingIsTurnedOn() throws Exception {
+ void mailShouldBeWellDeliveredByDefaultToUserWhenVirtualHostingIsTurnedOn() throws Exception {
// Given
Username username = Username.of("receiver@domain.com");
MailboxPath inbox = MailboxPath.inbox(username);
@@ -105,7 +105,7 @@ public class LocalDeliveryTest {
}
@Test
- public void mailShouldBeWellDeliveredByDefaultToUserWhenVirtualHostingIsTurnedOff() throws Exception {
+ void mailShouldBeWellDeliveredByDefaultToUserWhenVirtualHostingIsTurnedOff() throws Exception {
// Given
Username username = Username.of("receiver");
MailboxPath inbox = MailboxPath.inbox(username);
diff --git a/server/mailet/mailets/src/test/java/org/apache/james/transport/mailets/delivery/MailDispatcherTest.java b/server/mailet/mailets/src/test/java/org/apache/james/transport/mailets/delivery/MailDispatcherTest.java
index 82275b7..59b7644 100644
--- a/server/mailet/mailets/src/test/java/org/apache/james/transport/mailets/delivery/MailDispatcherTest.java
+++ b/server/mailet/mailets/src/test/java/org/apache/james/transport/mailets/delivery/MailDispatcherTest.java
@@ -42,13 +42,13 @@ import org.apache.mailet.base.MailAddressFixture;
import org.apache.mailet.base.RFC2822Headers;
import org.apache.mailet.base.test.FakeMail;
import org.apache.mailet.base.test.FakeMailContext;
-import org.junit.Before;
-import org.junit.Test;
+import org.junit.jupiter.api.BeforeEach;
+import org.junit.jupiter.api.Test;
import org.mockito.ArgumentCaptor;
import com.google.common.collect.ArrayListMultimap;
-public class MailDispatcherTest {
+class MailDispatcherTest {
private static final String TEST_HEADER_NAME = "X-HEADER";
private static final String VALUE_FOR_USER_1 = "value for user 1";
private static final String VALUE_FOR_USER_2 = "value for user 2";
@@ -58,14 +58,14 @@ public class MailDispatcherTest {
private FakeMailContext fakeMailContext;
private MailStore mailStore;
- @Before
+ @BeforeEach
public void setUp() throws Exception {
fakeMailContext = FakeMailContext.defaultContext();
mailStore = mock(MailStore.class);
}
@Test
- public void dispatchShouldStoreMail() throws Exception {
+ void dispatchShouldStoreMail() throws Exception {
MailDispatcher testee = MailDispatcher.builder()
.mailetContext(fakeMailContext)
.mailStore(mailStore)
@@ -87,7 +87,7 @@ public class MailDispatcherTest {
}
@Test
- public void dispatchShouldConsumeMailIfSpecified() throws Exception {
+ void dispatchShouldConsumeMailIfSpecified() throws Exception {
MailDispatcher testee = MailDispatcher.builder()
.mailetContext(fakeMailContext)
.mailStore(mailStore)
@@ -106,7 +106,7 @@ public class MailDispatcherTest {
}
@Test
- public void dispatchShouldNotConsumeMailIfNotSpecified() throws Exception {
+ void dispatchShouldNotConsumeMailIfNotSpecified() throws Exception {
MailDispatcher testee = MailDispatcher.builder()
.mailetContext(fakeMailContext)
.mailStore(mailStore)
@@ -126,7 +126,7 @@ public class MailDispatcherTest {
}
@Test
- public void errorsShouldBeWellHandled() throws Exception {
+ void errorsShouldBeWellHandled() throws Exception {
MailDispatcher testee = MailDispatcher.builder()
.mailetContext(fakeMailContext)
.mailStore(mailStore)
@@ -162,7 +162,7 @@ public class MailDispatcherTest {
}
@Test
- public void dispatchShouldUpdateReturnPath() throws Exception {
+ void dispatchShouldUpdateReturnPath() throws Exception {
MailDispatcher testee = MailDispatcher.builder()
.mailetContext(fakeMailContext)
.mailStore(mailStore)
@@ -186,7 +186,7 @@ public class MailDispatcherTest {
}
@Test
- public void dispatchShouldNotAddSpecificHeaderIfRecipientDoesNotMatch() throws Exception {
+ void dispatchShouldNotAddSpecificHeaderIfRecipientDoesNotMatch() throws Exception {
AccumulatorHeaderMailStore accumulatorTestHeaderMailStore = new AccumulatorHeaderMailStore(TEST_HEADER_NAME);
MailDispatcher testee = MailDispatcher.builder()
.mailetContext(fakeMailContext)
@@ -209,7 +209,7 @@ public class MailDispatcherTest {
}
@Test
- public void dispatchShouldAddSpecificHeaderIfRecipientMatches() throws Exception {
+ void dispatchShouldAddSpecificHeaderIfRecipientMatches() throws Exception {
AccumulatorHeaderMailStore accumulatorTestHeaderMailStore = new AccumulatorHeaderMailStore(TEST_HEADER_NAME);
MailDispatcher testee = MailDispatcher.builder()
.mailetContext(fakeMailContext)
@@ -232,7 +232,7 @@ public class MailDispatcherTest {
}
@Test
- public void dispatchShouldNotAddSpecificHeaderToOtherRecipients() throws Exception {
+ void dispatchShouldNotAddSpecificHeaderToOtherRecipients() throws Exception {
AccumulatorHeaderMailStore accumulatorTestHeaderMailStore = new AccumulatorHeaderMailStore(TEST_HEADER_NAME);
MailDispatcher testee = MailDispatcher.builder()
.mailetContext(fakeMailContext)
@@ -257,7 +257,7 @@ public class MailDispatcherTest {
}
@Test
- public void dispatchShouldAddSpecificHeaderToEachRecipients() throws Exception {
+ void dispatchShouldAddSpecificHeaderToEachRecipients() throws Exception {
AccumulatorHeaderMailStore accumulatorTestHeaderMailStore = new AccumulatorHeaderMailStore(TEST_HEADER_NAME);
MailDispatcher testee = MailDispatcher.builder()
.mailetContext(fakeMailContext)
@@ -283,7 +283,7 @@ public class MailDispatcherTest {
}
@Test
- public void dispatchShouldNotAlterOriginalMessageWhenPerRecipientHeaderDoesNotExist() throws Exception {
+ void dispatchShouldNotAlterOriginalMessageWhenPerRecipientHeaderDoesNotExist() throws Exception {
AccumulatorHeaderMailStore accumulatorTestHeaderMailStore = new AccumulatorHeaderMailStore(TEST_HEADER_NAME);
MailDispatcher testee = MailDispatcher.builder()
.mailetContext(fakeMailContext)
@@ -306,7 +306,7 @@ public class MailDispatcherTest {
}
@Test
- public void dispatchShouldNotAlterOriginalMessageWhenPerRecipientHeaderExists() throws Exception {
+ void dispatchShouldNotAlterOriginalMessageWhenPerRecipientHeaderExists() throws Exception {
AccumulatorHeaderMailStore accumulatorTestHeaderMailStore = new AccumulatorHeaderMailStore(TEST_HEADER_NAME);
MailDispatcher testee = MailDispatcher.builder()
.mailetContext(fakeMailContext)
diff --git a/server/mailet/mailets/src/test/java/org/apache/james/transport/mailets/delivery/SieveIntegrationTest.java b/server/mailet/mailets/src/test/java/org/apache/james/transport/mailets/delivery/SieveIntegrationTest.java
index ee72e3a..a0ce6b0 100644
--- a/server/mailet/mailets/src/test/java/org/apache/james/transport/mailets/delivery/SieveIntegrationTest.java
+++ b/server/mailet/mailets/src/test/java/org/apache/james/transport/mailets/delivery/SieveIntegrationTest.java
@@ -47,11 +47,11 @@ import org.apache.mailet.Mail;
import org.apache.mailet.base.test.FakeMail;
import org.apache.mailet.base.test.FakeMailContext;
import org.apache.mailet.base.test.FakeMailetConfig;
-import org.junit.Before;
-import org.junit.Test;
+import org.junit.jupiter.api.BeforeEach;
+import org.junit.jupiter.api.Test;
import org.slf4j.Logger;
-public class SieveIntegrationTest {
+class SieveIntegrationTest {
private static final String LOCAL_PART = "receiver";
private static final String RECEIVER_DOMAIN_COM = LOCAL_PART + "@domain.com";
@@ -79,8 +79,8 @@ public class SieveIntegrationTest {
private ResourceLocator resourceLocator;
private FakeMailContext fakeMailContext;
- @Before
- public void setUp() throws Exception {
+ @BeforeEach
+ void setUp() throws Exception {
resourceLocator = mock(ResourceLocator.class);
usersRepository = mock(UsersRepository.class);
fakeMailContext = FakeMailContext.builder().logger(mock(Logger.class)).build();
@@ -90,7 +90,7 @@ public class SieveIntegrationTest {
}
@Test
- public void serviceShouldNotModifyEmailWhenErrorRetrievingScript() throws Exception {
+ void serviceShouldNotModifyEmailWhenErrorRetrievingScript() throws Exception {
when(usersRepository.supportVirtualHosting()).thenReturn(true);
when(usersRepository.getUsername(new MailAddress(RECEIVER_DOMAIN_COM))).thenReturn(Username.of(RECEIVER_DOMAIN_COM));
when(resourceLocator.get(new MailAddress(RECEIVER_DOMAIN_COM))).thenThrow(new ScriptNotFoundException());
@@ -103,7 +103,7 @@ public class SieveIntegrationTest {
}
@Test
- public void mailShouldBeWellDeliveredByDefaultToUserWhenVirtualHostingIsTurnedOn() throws Exception {
+ void mailShouldBeWellDeliveredByDefaultToUserWhenVirtualHostingIsTurnedOn() throws Exception {
prepareTestUsingScript("org/apache/james/transport/mailets/delivery/keep.script");
when(usersRepository.supportVirtualHosting()).thenReturn(true);
when(usersRepository.getUsername(new MailAddress(RECEIVER_DOMAIN_COM))).thenReturn(Username.of(RECEIVER_DOMAIN_COM));
@@ -115,7 +115,7 @@ public class SieveIntegrationTest {
}
@Test
- public void mailShouldBeWellDeliveredByDefaultToUserWhenvirtualHostingIsTurnedOff() throws Exception {
+ void mailShouldBeWellDeliveredByDefaultToUserWhenvirtualHostingIsTurnedOff() throws Exception {
prepareTestUsingScript("org/apache/james/transport/mailets/delivery/keep.script");
when(usersRepository.supportVirtualHosting()).thenReturn(false);
when(usersRepository.getUsername(new MailAddress("receiver@localhost"))).thenReturn(Username.of("receiver"));
@@ -127,7 +127,7 @@ public class SieveIntegrationTest {
}
@Test
- public void keepScriptShouldWork() throws Exception {
+ void keepScriptShouldWork() throws Exception {
prepareTestUsingScript("org/apache/james/transport/mailets/delivery/keep.script");
FakeMail mail = createMail();
@@ -137,7 +137,7 @@ public class SieveIntegrationTest {
}
@Test
- public void discardScriptShouldWork() throws Exception {
+ void discardScriptShouldWork() throws Exception {
prepareTestUsingScript("org/apache/james/transport/mailets/delivery/discard.script");
FakeMail mail = createMail();
@@ -147,7 +147,7 @@ public class SieveIntegrationTest {
}
@Test
- public void fileintoScriptShouldWork() throws Exception {
+ void fileintoScriptShouldWork() throws Exception {
prepareTestUsingScript("org/apache/james/transport/mailets/delivery/fileinto.script");
FakeMail mail = createMail();
@@ -157,7 +157,7 @@ public class SieveIntegrationTest {
}
@Test
- public void allOfAllFalseScriptShouldWork() throws Exception {
+ void allOfAllFalseScriptShouldWork() throws Exception {
prepareTestUsingScript("org/apache/james/transport/mailets/delivery/allofAllFalse.script");
FakeMail mail = createMail();
@@ -167,7 +167,7 @@ public class SieveIntegrationTest {
}
@Test
- public void allOfOneFalseScriptShouldWork() throws Exception {
+ void allOfOneFalseScriptShouldWork() throws Exception {
prepareTestUsingScript("org/apache/james/transport/mailets/delivery/allofOneFalse.script");
FakeMail mail = createMail();
@@ -177,7 +177,7 @@ public class SieveIntegrationTest {
}
@Test
- public void allOfAllTrueScriptShouldWork() throws Exception {
+ void allOfAllTrueScriptShouldWork() throws Exception {
prepareTestUsingScript("org/apache/james/transport/mailets/delivery/allofAllTrue.script");
FakeMail mail = createMail();
@@ -187,7 +187,7 @@ public class SieveIntegrationTest {
}
@Test
- public void anyOfAllFalseScriptShouldWork() throws Exception {
+ void anyOfAllFalseScriptShouldWork() throws Exception {
prepareTestUsingScript("org/apache/james/transport/mailets/delivery/anyofAllFalse.script");
FakeMail mail = createMail();
@@ -197,7 +197,7 @@ public class SieveIntegrationTest {
}
@Test
- public void falseScriptShouldWork() throws Exception {
+ void falseScriptShouldWork() throws Exception {
prepareTestUsingScript("org/apache/james/transport/mailets/delivery/false.script");
FakeMail mail = createMail();
@@ -207,7 +207,7 @@ public class SieveIntegrationTest {
}
@Test
- public void trueScriptShouldWork() throws Exception {
+ void trueScriptShouldWork() throws Exception {
prepareTestUsingScript("org/apache/james/transport/mailets/delivery/true.script");
FakeMail mail = createMail();
@@ -217,7 +217,7 @@ public class SieveIntegrationTest {
}
@Test
- public void notFalseScriptShouldWork() throws Exception {
+ void notFalseScriptShouldWork() throws Exception {
prepareTestUsingScript("org/apache/james/transport/mailets/delivery/notFalse.script");
FakeMail mail = createMail();
@@ -227,7 +227,7 @@ public class SieveIntegrationTest {
}
@Test
- public void notTrueScriptShouldWork() throws Exception {
+ void notTrueScriptShouldWork() throws Exception {
prepareTestUsingScript("org/apache/james/transport/mailets/delivery/notTrue.script");
FakeMail mail = createMail();
@@ -237,7 +237,7 @@ public class SieveIntegrationTest {
}
@Test
- public void anyOfOneFalseScriptShouldWork() throws Exception {
+ void anyOfOneFalseScriptShouldWork() throws Exception {
prepareTestUsingScript("org/apache/james/transport/mailets/delivery/anyofOneFalse.script");
FakeMail mail = createMail();
@@ -247,7 +247,7 @@ public class SieveIntegrationTest {
}
@Test
- public void anyOfAllTrueScriptShouldWork() throws Exception {
+ void anyOfAllTrueScriptShouldWork() throws Exception {
prepareTestUsingScript("org/apache/james/transport/mailets/delivery/anyofAllTrue.script");
FakeMail mail = createMail();
@@ -257,7 +257,7 @@ public class SieveIntegrationTest {
}
@Test
- public void stopScriptShouldWork() throws Exception {
+ void stopScriptShouldWork() throws Exception {
prepareTestUsingScript("org/apache/james/transport/mailets/delivery/stop.script");
FakeMail mail = createMail();
@@ -267,7 +267,7 @@ public class SieveIntegrationTest {
}
@Test
- public void headerScriptShouldWorkIfHeaderIsAbsent() throws Exception {
+ void headerScriptShouldWorkIfHeaderIsAbsent() throws Exception {
prepareTestUsingScript("org/apache/james/transport/mailets/delivery/header.script");
FakeMail mail = createMail();
@@ -277,7 +277,7 @@ public class SieveIntegrationTest {
}
@Test
- public void headerInstructionShouldSupportFoldedEncodedHeaders() throws Exception {
+ void headerInstructionShouldSupportFoldedEncodedHeaders() throws Exception {
prepareTestUsingScript("org/apache/james/transport/mailets/delivery/headerEncodedFolded.script");
FakeMail mail = FakeMail.builder()
@@ -296,7 +296,7 @@ public class SieveIntegrationTest {
@Test
- public void headerScriptShouldWorkIfHeaderIsPresent() throws Exception {
+ void headerScriptShouldWorkIfHeaderIsPresent() throws Exception {
prepareTestUsingScript("org/apache/james/transport/mailets/delivery/header.script");
FakeMail mail = createMailWithSubject("JAMES-1620 revolution");
@@ -306,7 +306,7 @@ public class SieveIntegrationTest {
}
@Test
- public void sizeOverScriptShouldWorkIfUnderLimit() throws Exception {
+ void sizeOverScriptShouldWorkIfUnderLimit() throws Exception {
prepareTestUsingScript("org/apache/james/transport/mailets/delivery/sizeOver.script");
FakeMail mail = createMail();
@@ -317,7 +317,7 @@ public class SieveIntegrationTest {
}
@Test
- public void sizeUnderScriptShouldWorkIfUnderLimit() throws Exception {
+ void sizeUnderScriptShouldWorkIfUnderLimit() throws Exception {
prepareTestUsingScript("org/apache/james/transport/mailets/delivery/sizeUnder.script");
FakeMail mail = createMail();
@@ -328,7 +328,7 @@ public class SieveIntegrationTest {
}
@Test
- public void sizeOverScriptShouldWorkIfOverLimit() throws Exception {
+ void sizeOverScriptShouldWorkIfOverLimit() throws Exception {
prepareTestUsingScript("org/apache/james/transport/mailets/delivery/sizeOver.script");
FakeMail mail = createMail();
@@ -339,7 +339,7 @@ public class SieveIntegrationTest {
}
@Test
- public void sizeUnderScriptShouldWorkIfOverLimit() throws Exception {
+ void sizeUnderScriptShouldWorkIfOverLimit() throws Exception {
prepareTestUsingScript("org/apache/james/transport/mailets/delivery/sizeUnder.script");
FakeMail mail = createMail();
@@ -350,7 +350,7 @@ public class SieveIntegrationTest {
}
@Test
- public void addressLocalPartShouldWork() throws Exception {
+ void addressLocalPartShouldWork() throws Exception {
prepareTestUsingScript("org/apache/james/transport/mailets/delivery/addressLocalPart.script");
FakeMail mail = createMailWithSubjectAndHeaders("Default", new Header("Cc", "source@any.com"));
@@ -361,7 +361,7 @@ public class SieveIntegrationTest {
@Test
- public void addressLocalPartShouldOnlyMatchLocalPart() throws Exception {
+ void addressLocalPartShouldOnlyMatchLocalPart() throws Exception {
prepareTestUsingScript("org/apache/james/transport/mailets/delivery/addressLocalPart.script");
FakeMail mail = createMailWithSubjectAndHeaders("Default", new Header("Cc", "source1@domain.com"));
@@ -372,7 +372,7 @@ public class SieveIntegrationTest {
@Test
- public void addressDomainShouldWork() throws Exception {
+ void addressDomainShouldWork() throws Exception {
prepareTestUsingScript("org/apache/james/transport/mailets/delivery/addressDomain.script");
FakeMail mail = createMailWithSubjectAndHeaders("Default", new Header("Cc", "source1@domain.com"));
@@ -382,7 +382,7 @@ public class SieveIntegrationTest {
}
@Test
- public void addressDomainShouldOnlyMatchLocalPart() throws Exception {
+ void addressDomainShouldOnlyMatchLocalPart() throws Exception {
prepareTestUsingScript("org/apache/james/transport/mailets/delivery/addressDomain.script");
FakeMail mail = createMailWithSubjectAndHeaders("Default", new Header("Cc", "source@domain.org"));
@@ -392,7 +392,7 @@ public class SieveIntegrationTest {
}
@Test
- public void addressBccAllShouldNotMatchOtherHeaders() throws Exception {
+ void addressBccAllShouldNotMatchOtherHeaders() throws Exception {
prepareTestUsingScript("org/apache/james/transport/mailets/delivery/addressAllBcc.script");
FakeMail mail = createMailWithSubjectAndHeaders("Default", new Header("Cc", "source@domain.com"));
@@ -402,7 +402,7 @@ public class SieveIntegrationTest {
}
@Test
- public void addressBccAllShouldMatchSpecifiedAddress() throws Exception {
+ void addressBccAllShouldMatchSpecifiedAddress() throws Exception {
prepareTestUsingScript("org/apache/james/transport/mailets/delivery/addressAllBcc.script");
FakeMail mail = createMailWithSubjectAndHeaders("Default", new Header("Bcc", "source@domain.com"));
@@ -412,7 +412,7 @@ public class SieveIntegrationTest {
}
@Test
- public void addressBccAllShouldNotMatchOtherAddress() throws Exception {
+ void addressBccAllShouldNotMatchOtherAddress() throws Exception {
prepareTestUsingScript("org/apache/james/transport/mailets/delivery/addressAllBcc.script");
FakeMail mail = createMailWithSubjectAndHeaders("Default", new Header("Bcc", "source2@domain.com"));
@@ -422,7 +422,7 @@ public class SieveIntegrationTest {
}
@Test
- public void addressBccAllShouldNotMatchOtherDomain() throws Exception {
+ void addressBccAllShouldNotMatchOtherDomain() throws Exception {
prepareTestUsingScript("org/apache/james/transport/mailets/delivery/addressAllBcc.script");
FakeMail mail = createMailWithSubjectAndHeaders("Default", new Header("Bcc", "source@domain.org"));
@@ -432,7 +432,7 @@ public class SieveIntegrationTest {
}
@Test
- public void redirectShouldWork() throws Exception {
+ void redirectShouldWork() throws Exception {
prepareTestUsingScript("org/apache/james/transport/mailets/delivery/redirect.script");
FakeMail mail = createMail();
@@ -449,7 +449,7 @@ public class SieveIntegrationTest {
}
@Test
- public void addressCcAllShouldNotMatchOtherHeaders() throws Exception {
+ void addressCcAllShouldNotMatchOtherHeaders() throws Exception {
prepareTestUsingScript("org/apache/james/transport/mailets/delivery/addressAllCc.script");
FakeMail mail = createMailWithSubjectAndHeaders("Default", new Header("Resend-From", "source@domain.com"));
@@ -459,7 +459,7 @@ public class SieveIntegrationTest {
}
@Test
- public void addressCcAllShouldMatchSpecifiedAddress() throws Exception {
+ void addressCcAllShouldMatchSpecifiedAddress() throws Exception {
prepareTestUsingScript("org/apache/james/transport/mailets/delivery/addressAllCc.script");
FakeMail mail = createMailWithSubjectAndHeaders("Default", new Header("Cc", "source@domain.com"));
@@ -469,7 +469,7 @@ public class SieveIntegrationTest {
}
@Test
- public void addressCcAllShouldNotMatchOtherAddress() throws Exception {
+ void addressCcAllShouldNotMatchOtherAddress() throws Exception {
prepareTestUsingScript("org/apache/james/transport/mailets/delivery/addressAllCc.script");
FakeMail mail = createMailWithSubjectAndHeaders("Default", new Header("Cc", "source2@domain.com"));
@@ -479,7 +479,7 @@ public class SieveIntegrationTest {
}
@Test
- public void addressCcAllShouldNotMatchOtherDomain() throws Exception {
+ void addressCcAllShouldNotMatchOtherDomain() throws Exception {
prepareTestUsingScript("org/apache/james/transport/mailets/delivery/addressAllCc.script");
FakeMail mail = createMailWithSubjectAndHeaders("Default", new Header("Cc", "source@domain.org"));
@@ -489,7 +489,7 @@ public class SieveIntegrationTest {
}
@Test
- public void addressFromAllShouldNotMatchOtherHeaders() throws Exception {
+ void addressFromAllShouldNotMatchOtherHeaders() throws Exception {
prepareTestUsingScript("org/apache/james/transport/mailets/delivery/addressAllFrom.script");
FakeMail mail = createMailWithSubjectAndHeaders("Default", new Header("Cc", "source@domain.com"));
@@ -499,7 +499,7 @@ public class SieveIntegrationTest {
}
@Test
- public void addressFromAllShouldMatchSpecifiedAddress() throws Exception {
+ void addressFromAllShouldMatchSpecifiedAddress() throws Exception {
prepareTestUsingScript("org/apache/james/transport/mailets/delivery/addressAllFrom.script");
FakeMail mail = createMailWithSubjectAndHeaders("Default", new Header("From", "source@domain.com"));
@@ -509,7 +509,7 @@ public class SieveIntegrationTest {
}
@Test
- public void addressFromAllShouldNotMatchOtherAddress() throws Exception {
+ void addressFromAllShouldNotMatchOtherAddress() throws Exception {
prepareTestUsingScript("org/apache/james/transport/mailets/delivery/addressAllFrom.script");
FakeMail mail = createMailWithSubjectAndHeaders("Default", new Header("From", "source2@domain.com"));
@@ -519,7 +519,7 @@ public class SieveIntegrationTest {
}
@Test
- public void addressFromAllShouldNotMatchOtherDomain() throws Exception {
+ void addressFromAllShouldNotMatchOtherDomain() throws Exception {
prepareTestUsingScript("org/apache/james/transport/mailets/delivery/addressAllFrom.script");
FakeMail mail = createMailWithSubjectAndHeaders("Default", new Header("From", "source@domain.org"));
@@ -529,7 +529,7 @@ public class SieveIntegrationTest {
}
@Test
- public void addressToAllShouldNotMatchOtherHeaders() throws Exception {
+ void addressToAllShouldNotMatchOtherHeaders() throws Exception {
prepareTestUsingScript("org/apache/james/transport/mailets/delivery/addressAllTo.script");
FakeMail mail = createMailWithSubjectAndHeaders("Default", new Header("Resent-To", "source@domain.com"));
@@ -539,7 +539,7 @@ public class SieveIntegrationTest {
}
@Test
- public void addressToAllShouldMatchSpecifiedAddress() throws Exception {
+ void addressToAllShouldMatchSpecifiedAddress() throws Exception {
prepareTestUsingScript("org/apache/james/transport/mailets/delivery/addressAllTo.script");
FakeMail mail = createMailWithSubjectAndHeaders("Default", new Header("To", "source@domain.com"));
@@ -549,7 +549,7 @@ public class SieveIntegrationTest {
}
@Test
- public void addressToAllShouldNotMatchOtherAddress() throws Exception {
+ void addressToAllShouldNotMatchOtherAddress() throws Exception {
prepareTestUsingScript("org/apache/james/transport/mailets/delivery/addressAllTo.script");
FakeMail mail = createMailWithSubjectAndHeaders("Default", new Header("To", "source2@domain.com"));
@@ -559,7 +559,7 @@ public class SieveIntegrationTest {
}
@Test
- public void addressToAllShouldNotMatchOtherDomain() throws Exception {
+ void addressToAllShouldNotMatchOtherDomain() throws Exception {
prepareTestUsingScript("org/apache/james/transport/mailets/delivery/addressAllTo.script");
FakeMail mail = createMailWithSubjectAndHeaders("Default", new Header("To", "source@domain.org"));
@@ -569,7 +569,7 @@ public class SieveIntegrationTest {
}
@Test
- public void addressSenderAllShouldNotMatchOtherHeaders() throws Exception {
+ void addressSenderAllShouldNotMatchOtherHeaders() throws Exception {
prepareTestUsingScript("org/apache/james/transport/mailets/delivery/addressAllSender.script");
FakeMail mail = createMailWithSubjectAndHeaders("Default", new Header("To", "source@domain.com"));
@@ -579,7 +579,7 @@ public class SieveIntegrationTest {
}
@Test
- public void addressSenderAllShouldMatchSpecifiedAddress() throws Exception {
+ void addressSenderAllShouldMatchSpecifiedAddress() throws Exception {
prepareTestUsingScript("org/apache/james/transport/mailets/delivery/addressAllSender.script");
FakeMail mail = createMailWithSubjectAndHeaders("Default", new Header("Sender", "source@domain.com"));
@@ -589,7 +589,7 @@ public class SieveIntegrationTest {
}
@Test
- public void addressSenderAllShouldNotMatchOtherAddress() throws Exception {
+ void addressSenderAllShouldNotMatchOtherAddress() throws Exception {
prepareTestUsingScript("org/apache/james/transport/mailets/delivery/addressAllSender.script");
FakeMail mail = createMailWithSubjectAndHeaders("Default", new Header("Sender", "source2@domain.com"));
@@ -599,7 +599,7 @@ public class SieveIntegrationTest {
}
@Test
- public void addressSenderAllShouldNotMatchOtherDomain() throws Exception {
+ void addressSenderAllShouldNotMatchOtherDomain() throws Exception {
prepareTestUsingScript("org/apache/james/transport/mailets/delivery/addressAllSender.script");
FakeMail mail = createMailWithSubjectAndHeaders("Default", new Header("Sender", "source@domain.org"));
@@ -609,7 +609,7 @@ public class SieveIntegrationTest {
}
@Test
- public void addressResent_FromAllShouldNotMatchOtherHeaders() throws Exception {
+ void addressResent_FromAllShouldNotMatchOtherHeaders() throws Exception {
prepareTestUsingScript("org/apache/james/transport/mailets/delivery/addressAllResend-From.script");
FakeMail mail = createMailWithSubjectAndHeaders("Default", new Header("From", "source@domain.com"));
@@ -619,7 +619,7 @@ public class SieveIntegrationTest {
}
@Test
- public void addressResent_FromAllShouldMatchSpecifiedAddress() throws Exception {
+ void addressResent_FromAllShouldMatchSpecifiedAddress() throws Exception {
prepareTestUsingScript("org/apache/james/transport/mailets/delivery/addressAllResend-From.script");
FakeMail mail = createMailWithSubjectAndHeaders("Default", new Header("Resend-From", "source@domain.com"));
@@ -629,7 +629,7 @@ public class SieveIntegrationTest {
}
@Test
- public void addressResent_FromAllShouldNotMatchOtherAddress() throws Exception {
+ void addressResent_FromAllShouldNotMatchOtherAddress() throws Exception {
prepareTestUsingScript("org/apache/james/transport/mailets/delivery/addressAllResend-From.script");
FakeMail mail = createMailWithSubjectAndHeaders("Default", new Header("Resend-From", "source2@domain.com"));
@@ -639,7 +639,7 @@ public class SieveIntegrationTest {
}
@Test
- public void addressResent_FromAllShouldNotMatchOtherDomain() throws Exception {
+ void addressResent_FromAllShouldNotMatchOtherDomain() throws Exception {
prepareTestUsingScript("org/apache/james/transport/mailets/delivery/addressAllResend-From.script");
FakeMail mail = createMailWithSubjectAndHeaders("Default", new Header("Resend-From", "source@domain.org"));
@@ -649,7 +649,7 @@ public class SieveIntegrationTest {
}
@Test
- public void addressResent_ToAllShouldNotMatchOtherHeaders() throws Exception {
+ void addressResent_ToAllShouldNotMatchOtherHeaders() throws Exception {
prepareTestUsingScript("org/apache/james/transport/mailets/delivery/addressAllResend-To.script");
FakeMail mail = createMailWithSubjectAndHeaders("Default", new Header("To", "source@domain.com"));
@@ -659,7 +659,7 @@ public class SieveIntegrationTest {
}
@Test
- public void addressResent_ToAllShouldMatchSpecifiedAddress() throws Exception {
+ void addressResent_ToAllShouldMatchSpecifiedAddress() throws Exception {
prepareTestUsingScript("org/apache/james/transport/mailets/delivery/addressAllResend-To.script");
FakeMail mail = createMailWithSubjectAndHeaders("Default", new Header("Resend-To", "source@domain.com"));
@@ -669,7 +669,7 @@ public class SieveIntegrationTest {
}
@Test
- public void addressResent_ToAllShouldNotMatchOtherAddress() throws Exception {
+ void addressResent_ToAllShouldNotMatchOtherAddress() throws Exception {
prepareTestUsingScript("org/apache/james/transport/mailets/delivery/addressAllResend-To.script");
FakeMail mail = createMailWithSubjectAndHeaders("Default", new Header("Resend-To", "source2@domain.com"));
@@ -679,7 +679,7 @@ public class SieveIntegrationTest {
}
@Test
- public void addressResent_ToAllShouldNotMatchOtherDomain() throws Exception {
+ void addressResent_ToAllShouldNotMatchOtherDomain() throws Exception {
prepareTestUsingScript("org/apache/james/transport/mailets/delivery/addressAllResend-To.script");
FakeMail mail = createMailWithSubjectAndHeaders("Default", new Header("Resend-To", "source@domain.org"));
@@ -689,7 +689,7 @@ public class SieveIntegrationTest {
}
@Test
- public void envelopeFromShouldWork() throws Exception {
+ void envelopeFromShouldWork() throws Exception {
prepareTestUsingScript("org/apache/james/transport/mailets/delivery/envelopeFrom.script");
FakeMail mail = createMailWithSubjectAndHeaders("Default", new Header("From", "source@domain.com"));
@@ -699,7 +699,7 @@ public class SieveIntegrationTest {
}
@Test
- public void envelopeFromShouldNotMatchOtherAddress() throws Exception {
+ void envelopeFromShouldNotMatchOtherAddress() throws Exception {
prepareTestUsingScript("org/apache/james/transport/mailets/delivery/envelopeFromOtherSender.script");
FakeMail mail = createMail();
@@ -709,7 +709,7 @@ public class SieveIntegrationTest {
}
@Test
- public void envelopeToShouldWork() throws Exception {
+ void envelopeToShouldWork() throws Exception {
prepareTestUsingScript("org/apache/james/transport/mailets/delivery/envelopeTo.script");
FakeMail mail = createMail();
@@ -719,7 +719,7 @@ public class SieveIntegrationTest {
}
@Test
- public void envelopeToShouldNotMatchOtherAddress() throws Exception {
+ void envelopeToShouldNotMatchOtherAddress() throws Exception {
prepareTestUsingScript("org/apache/james/transport/mailets/delivery/envelopeToOtherReceiver.script");
FakeMail mail = createMail();
@@ -729,7 +729,7 @@ public class SieveIntegrationTest {
}
@Test
- public void bodyRawShouldNotMatchNotContainedData() throws Exception {
+ void bodyRawShouldNotMatchNotContainedData() throws Exception {
prepareTestUsingScript("org/apache/james/transport/mailets/delivery/bodyRawInvalid.script");
FakeMail mail = createMail();
@@ -739,7 +739,7 @@ public class SieveIntegrationTest {
}
@Test
- public void bodyRawShouldMatchContent() throws Exception {
+ void bodyRawShouldMatchContent() throws Exception {
prepareTestUsingScript("org/apache/james/transport/mailets/delivery/bodyRawMatch.script");
FakeMail mail = createMail();
@@ -749,7 +749,7 @@ public class SieveIntegrationTest {
}
@Test
- public void bodyContentShouldMatchContent() throws Exception {
+ void bodyContentShouldMatchContent() throws Exception {
prepareTestUsingScript("org/apache/james/transport/mailets/delivery/bodyContentMatch.script");
FakeMail mail = createMail();
@@ -759,7 +759,7 @@ public class SieveIntegrationTest {
}
@Test
- public void bodyContentShouldNotMatchNotContainedData() throws Exception {
+ void bodyContentShouldNotMatchNotContainedData() throws Exception {
prepareTestUsingScript("org/apache/james/transport/mailets/delivery/bodyContentInvalid.script");
FakeMail mail = createMail();
@@ -769,7 +769,7 @@ public class SieveIntegrationTest {
}
@Test
- public void bodyContentShouldNotMatchWhenWrongContentType() throws Exception {
+ void bodyContentShouldNotMatchWhenWrongContentType() throws Exception {
prepareTestUsingScript("org/apache/james/transport/mailets/delivery/bodyContentWrongContentType.script");
FakeMail mail = createMail();
@@ -779,7 +779,7 @@ public class SieveIntegrationTest {
}
@Test
- public void bodyTextShouldNotMatchNotContainedData() throws Exception {
+ void bodyTextShouldNotMatchNotContainedData() throws Exception {
prepareTestUsingScript("org/apache/james/transport/mailets/delivery/bodyTextInvalid.script");
FakeMail mail = createMail();
@@ -789,7 +789,7 @@ public class SieveIntegrationTest {
}
@Test
- public void bodyTextShouldMatchContent() throws Exception {
+ void bodyTextShouldMatchContent() throws Exception {
prepareTestUsingScript("org/apache/james/transport/mailets/delivery/bodyTextMatch.script");
FakeMail mail = createMail();
@@ -799,7 +799,7 @@ public class SieveIntegrationTest {
}
@Test
- public void doubleVacationShouldNotBeExecutedAndReceiverShouldHaveANotificationAboutSieveError() throws Exception {
+ void doubleVacationShouldNotBeExecutedAndReceiverShouldHaveANotificationAboutSieveError() throws Exception {
prepareTestUsingScript("org/apache/james/transport/mailets/delivery/doubleVacation.script");
FakeMail mail = createMail();
@@ -817,7 +817,7 @@ public class SieveIntegrationTest {
}
@Test
- public void vacationShouldWork() throws Exception {
+ void vacationShouldWork() throws Exception {
prepareTestUsingScript("org/apache/james/transport/mailets/delivery/vacationReason.script");
FakeMail mail = createMail();
@@ -834,7 +834,7 @@ public class SieveIntegrationTest {
}
@Test
- public void vacationShouldNotSendNotificationToMailingLists() throws Exception {
+ void vacationShouldNotSendNotificationToMailingLists() throws Exception {
prepareTestUsingScript("org/apache/james/transport/mailets/delivery/vacationReason.script");
Mail mail = createMail();
mail.getMessage().addHeader("List-Id", "0123456789");
@@ -846,7 +846,7 @@ public class SieveIntegrationTest {
}
@Test
- public void vacationShouldNotGenerateNotificationIfTooOld() throws Exception {
+ void vacationShouldNotGenerateNotificationIfTooOld() throws Exception {
prepareTestUsingScriptAndDates("org/apache/james/transport/mailets/delivery/vacationReason.script", DATE_OLD, DATE_NEW);
FakeMail mail = createMail();
@@ -857,7 +857,7 @@ public class SieveIntegrationTest {
}
@Test
- public void vacationShouldNotCancelFileIntoActionIfNotExecuted() throws Exception {
+ void vacationShouldNotCancelFileIntoActionIfNotExecuted() throws Exception {
prepareTestUsingScriptAndDates("org/apache/james/transport/mailets/delivery/vacationReasonAndFileInto.script", DATE_OLD, DATE_NEW);
FakeMail mail = createMail();
@@ -868,7 +868,7 @@ public class SieveIntegrationTest {
}
@Test
- public void vacationDaysParameterShouldFilterTooOldDates() throws Exception {
+ void vacationDaysParameterShouldFilterTooOldDates() throws Exception {
prepareTestUsingScriptAndDates("org/apache/james/transport/mailets/delivery/vacationDaysReason.script", DATE_DEFAULT, DATE_NEW);
FakeMail mail = createMail();
@@ -879,7 +879,7 @@ public class SieveIntegrationTest {
}
@Test
- public void vacationDaysParameterShouldKeepDatesInRange() throws Exception {
+ void vacationDaysParameterShouldKeepDatesInRange() throws Exception {
prepareTestUsingScriptAndDates("org/apache/james/transport/mailets/delivery/vacationDaysReason.script", DATE_CLOSE, DATE_NEW);
FakeMail mail = createMail();
@@ -895,7 +895,7 @@ public class SieveIntegrationTest {
}
@Test
- public void vacationShouldNotCancelFileIntoActionIfExecuted() throws Exception {
+ void vacationShouldNotCancelFileIntoActionIfExecuted() throws Exception {
prepareTestUsingScriptAndDates("org/apache/james/transport/mailets/delivery/vacationReasonAndFileInto.script", DATE_DEFAULT, DATE_NEW);
FakeMail mail = createMail();
@@ -911,7 +911,7 @@ public class SieveIntegrationTest {
}
@Test
- public void vacationFromSubjectShouldWork() throws Exception {
+ void vacationFromSubjectShouldWork() throws Exception {
prepareTestUsingScriptAndDates("org/apache/james/transport/mailets/delivery/vacationSubjectFromReason.script", DATE_DEFAULT, DATE_NEW);
FakeMail mail = createMail();
@@ -927,7 +927,7 @@ public class SieveIntegrationTest {
}
@Test
- public void vacationDaysAddressesShouldWork() throws Exception {
+ void vacationDaysAddressesShouldWork() throws Exception {
prepareTestUsingScriptAndDates("org/apache/james/transport/mailets/delivery/vacationDaysAddressesReason.script", DATE_CLOSE, DATE_NEW);
FakeMail mail = createMail();
@@ -943,7 +943,7 @@ public class SieveIntegrationTest {
}
@Test
- public void sieveErrorNotificationEmailsShouldNotBeProcessed() throws Exception {
+ void sieveErrorNotificationEmailsShouldNotBeProcessed() throws Exception {
prepareTestUsingScript("org/apache/james/transport/mailets/delivery/keep.script");
FakeMail mail = createMail();
@@ -974,7 +974,7 @@ public class SieveIntegrationTest {
return createMailWithSubjectAndHeaders(subject);
}
- private FakeMail createMailWithSubjectAndHeaders(String subject, MimeMessageBuilder.Header... headers) throws MessagingException, IOException {
+ private FakeMail createMailWithSubjectAndHeaders(String subject, MimeMessageBuilder.Header... headers) throws MessagingException {
return FakeMail.builder()
.name("name")
.mimeMessage(
diff --git a/server/mailet/mailets/src/test/java/org/apache/james/transport/mailets/delivery/SimpleMailStoreTest.java b/server/mailet/mailets/src/test/java/org/apache/james/transport/mailets/delivery/SimpleMailStoreTest.java
index 3155b6e..d6d707c 100644
--- a/server/mailet/mailets/src/test/java/org/apache/james/transport/mailets/delivery/SimpleMailStoreTest.java
+++ b/server/mailet/mailets/src/test/java/org/apache/james/transport/mailets/delivery/SimpleMailStoreTest.java
@@ -35,19 +35,18 @@ import org.apache.james.user.api.UsersRepository;
import org.apache.james.user.api.UsersRepositoryException;
import org.apache.mailet.base.MailAddressFixture;
import org.apache.mailet.base.test.FakeMail;
-import org.junit.Before;
-import org.junit.Test;
-
-public class SimpleMailStoreTest {
+import org.junit.jupiter.api.BeforeEach;
+import org.junit.jupiter.api.Test;
+class SimpleMailStoreTest {
public static final String FOLDER = "FOLDER";
private SimpleMailStore testee;
private MailboxAppender mailboxAppender;
private UsersRepository usersRepository;
private MimeMessage mimeMessage;
- @Before
- public void setUp() throws Exception {
+ @BeforeEach
+ void setUp() throws Exception {
mailboxAppender = mock(MailboxAppender.class);
usersRepository = mock(UsersRepository.class);
testee = SimpleMailStore.builder()
@@ -65,7 +64,7 @@ public class SimpleMailStoreTest {
}
@Test
- public void storeMailShouldUseFullMailAddressWhenSupportsVirtualHosting() throws Exception {
+ void storeMailShouldUseFullMailAddressWhenSupportsVirtualHosting() throws Exception {
MailAddress recipient = MailAddressFixture.OTHER_AT_JAMES;
when(usersRepository.getUsername(recipient)).thenReturn(Username.of(recipient.asString()));
FakeMail mail = FakeMail.builder()
@@ -78,7 +77,7 @@ public class SimpleMailStoreTest {
}
@Test
- public void storeMailShouldUseLocalPartWhenSupportsVirtualHosting() throws Exception {
+ void storeMailShouldUseLocalPartWhenSupportsVirtualHosting() throws Exception {
MailAddress recipient = MailAddressFixture.OTHER_AT_JAMES;
when(usersRepository.getUsername(recipient)).thenReturn(Username.of(recipient.getLocalPart()));
FakeMail mail = FakeMail.builder()
@@ -91,7 +90,7 @@ public class SimpleMailStoreTest {
}
@Test
- public void storeMailShouldUseFullMailAddressWhenErrorReadingUsersRepository() throws Exception {
+ void storeMailShouldUseFullMailAddressWhenErrorReadingUsersRepository() throws Exception {
MailAddress recipient = MailAddressFixture.OTHER_AT_JAMES;
when(usersRepository.getUsername(recipient)).thenThrow(new UsersRepositoryException("Any message"));
FakeMail mail = FakeMail.builder()
diff --git a/server/mailet/mailets/src/test/java/org/apache/james/transport/mailets/jsieve/DiscardActionTest.java b/server/mailet/mailets/src/test/java/org/apache/james/transport/mailets/jsieve/DiscardActionTest.java
index e09c118..add99ae 100644
--- a/server/mailet/mailets/src/test/java/org/apache/james/transport/mailets/jsieve/DiscardActionTest.java
+++ b/server/mailet/mailets/src/test/java/org/apache/james/transport/mailets/jsieve/DiscardActionTest.java
@@ -26,12 +26,11 @@ import static org.mockito.Mockito.when;
import org.apache.mailet.base.MailAddressFixture;
import org.apache.mailet.base.test.FakeMail;
-import org.junit.Test;
-
-public class DiscardActionTest {
+import org.junit.jupiter.api.Test;
+class DiscardActionTest {
@Test
- public void removeRecipientShouldWorkWhenOnlyOneRecipient() throws Exception {
+ void removeRecipientShouldWorkWhenOnlyOneRecipient() throws Exception {
FakeMail mail = FakeMail.builder()
.name("name")
.recipients(MailAddressFixture.ANY_AT_JAMES)
@@ -45,7 +44,7 @@ public class DiscardActionTest {
}
@Test
- public void removeRecipientShouldNotThrowWhenRecipientIsAbsent() throws Exception {
+ void removeRecipientShouldNotThrowWhenRecipientIsAbsent() throws Exception {
FakeMail mail = FakeMail.builder()
.name("name")
.recipients(MailAddressFixture.ANY_AT_JAMES)
@@ -59,7 +58,7 @@ public class DiscardActionTest {
}
@Test
- public void removeRecipientShouldNotThrowWhenRecipientIsNull() throws Exception {
+ void removeRecipientShouldNotThrowWhenRecipientIsNull() throws Exception {
FakeMail mail = FakeMail.builder()
.name("name")
.recipients(MailAddressFixture.ANY_AT_JAMES)
@@ -73,7 +72,7 @@ public class DiscardActionTest {
}
@Test
- public void removeRecipientShouldRemoveOnlyTheConcernedRecipient() throws Exception {
+ void removeRecipientShouldRemoveOnlyTheConcernedRecipient() throws Exception {
FakeMail mail = FakeMail.builder()
.name("name")
.recipients(MailAddressFixture.ANY_AT_JAMES, MailAddressFixture.OTHER_AT_JAMES)
diff --git a/server/mailet/mailets/src/test/java/org/apache/james/transport/mailets/managesieve/ManageSieveMailetTestCase.java b/server/mailet/mailets/src/test/java/org/apache/james/transport/mailets/managesieve/ManageSieveMailetTestCase.java
index 8b9f721..dc1fd8d 100644
--- a/server/mailet/mailets/src/test/java/org/apache/james/transport/mailets/managesieve/ManageSieveMailetTestCase.java
+++ b/server/mailet/mailets/src/test/java/org/apache/james/transport/mailets/managesieve/ManageSieveMailetTestCase.java
@@ -55,8 +55,8 @@ import org.apache.mailet.Mail;
import org.apache.mailet.base.test.FakeMail;
import org.apache.mailet.base.test.FakeMailContext;
import org.apache.mailet.base.test.FakeMailetConfig;
-import org.junit.Before;
-import org.junit.Test;
+import org.junit.jupiter.api.BeforeEach;
+import org.junit.jupiter.api.Test;
import com.google.common.collect.Lists;
@@ -76,8 +76,8 @@ public class ManageSieveMailetTestCase {
private UsersRepository usersRepository;
private FakeMailContext fakeMailContext;
- @Before
- public void setUp() throws Exception {
+ @BeforeEach
+ void setUp() throws Exception {
sieveRepository = mock(SieveRepository.class);
sieveParser = mock(SieveParser.class);
usersRepository = mock(UsersRepository.class);
@@ -86,7 +86,7 @@ public class ManageSieveMailetTestCase {
}
@Test
- public final void testCapabilityUnauthorised() throws Exception {
+ void testCapabilityUnauthorised() throws Exception {
MimeMessage message = prepareMimeMessage("CAPABILITY");
Mail mail = createUnauthenticatedMail(message);
when(sieveParser.getExtensions()).thenReturn(Lists.newArrayList("a", "b", "c"));
@@ -101,7 +101,7 @@ public class ManageSieveMailetTestCase {
}
@Test
- public final void testCapability() throws Exception {
+ void testCapability() throws Exception {
MimeMessage message = prepareMimeMessage("CAPABILITY");
Mail mail = createUnauthenticatedMail(message);
when(sieveParser.getExtensions()).thenReturn(Lists.newArrayList("a", "b", "c"));
@@ -118,7 +118,7 @@ public class ManageSieveMailetTestCase {
}
@Test
- public final void testCapabilityExtraArguments() throws Exception {
+ void testCapabilityExtraArguments() throws Exception {
MimeMessage message = prepareMimeMessage("CAPABILITY");
Mail mail = createUnauthenticatedMail(message);
message.setSubject("CAPABILITY extra");
@@ -128,7 +128,7 @@ public class ManageSieveMailetTestCase {
}
@Test
- public final void testPutScriptinvalidLiteral() throws Exception {
+ void testPutScriptinvalidLiteral() throws Exception {
MimeMessage message = prepareMessageWithAttachment(SCRIPT_CONTENT, "PUTSCRIPT \"" + SCRIPT_NAME.getValue() + "\"");
Mail mail = createUnauthenticatedMail(message);
mailet.service(mail);
@@ -136,7 +136,7 @@ public class ManageSieveMailetTestCase {
}
@Test
- public final void testPutScript() throws Exception {
+ void testPutScript() throws Exception {
when(sieveParser.parse(anyString())).thenReturn(Lists.newArrayList("warning1", "warning2"));
MimeMessage message = prepareMessageWithAttachment(SCRIPT_CONTENT, "PUTSCRIPT \"" + SCRIPT_NAME.getValue() + "\" {100+}");
Mail mail = createAuthentificatedMail(message);
@@ -145,7 +145,7 @@ public class ManageSieveMailetTestCase {
}
@Test
- public final void testPutScriptInvalidLiteral() throws Exception {
+ void testPutScriptInvalidLiteral() throws Exception {
MimeMessage message = prepareMessageWithAttachment(SCRIPT_CONTENT, "PUTSCRIPT \"" + SCRIPT_NAME.getValue() + "\" extra");
Mail mail = createUnauthenticatedMail(message);
mailet.service(mail);
@@ -153,7 +153,7 @@ public class ManageSieveMailetTestCase {
}
@Test
- public final void testPutScriptExtraArgs() throws Exception {
+ void testPutScriptExtraArgs() throws Exception {
MimeMessage message = prepareMessageWithAttachment(SCRIPT_CONTENT, "PUTSCRIPT \"" + SCRIPT_NAME.getValue() + "\" {10+} extra");
Mail mail = createUnauthenticatedMail(message);
mailet.service(mail);
@@ -161,7 +161,7 @@ public class ManageSieveMailetTestCase {
}
@Test
- public final void testPutScriptSyntaxError() throws Exception {
+ void testPutScriptSyntaxError() throws Exception {
doThrow(new SyntaxException("error message")).when(sieveParser).parse(SYNTAX_EXCEPTION);
MimeMessage message = prepareMessageWithAttachment(SYNTAX_EXCEPTION, "PUTSCRIPT \"" + SCRIPT_NAME.getValue() + "\" {10+}");
Mail mail = createAuthentificatedMail(message);
@@ -170,7 +170,7 @@ public class ManageSieveMailetTestCase {
}
@Test
- public final void testPutScriptNoScript() throws Exception {
+ void testPutScriptNoScript() throws Exception {
MimeMessage message = prepareMimeMessage("PUTSCRIPT \"" + SCRIPT_NAME.getValue() + "\"");
Mail mail = createUnauthenticatedMail(message);
mailet.service(mail);
@@ -178,7 +178,7 @@ public class ManageSieveMailetTestCase {
}
@Test
- public final void testPutScriptNoScriptName() throws Exception {
+ void testPutScriptNoScriptName() throws Exception {
MimeMessage message = prepareMimeMessage("PUTSCRIPT");
Mail mail = createUnauthenticatedMail(message);
mailet.service(mail);
@@ -186,7 +186,7 @@ public class ManageSieveMailetTestCase {
}
@Test
- public final void testGetScriptNonAuthorized() throws Exception {
+ void testGetScriptNonAuthorized() throws Exception {
MimeMessage message = prepareMimeMessage("GETSCRIPT \"" + SCRIPT_NAME.getValue() + "\"");
Mail mail = createUnauthenticatedMail(message);
mailet.service(mail);
@@ -194,7 +194,7 @@ public class ManageSieveMailetTestCase {
}
@Test
- public final void testGetScript() throws Exception {
+ void testGetScript() throws Exception {
when(sieveRepository.getScript(USERNAME, SCRIPT_NAME)).thenReturn(new ByteArrayInputStream(SCRIPT_CONTENT.getValue().getBytes(StandardCharsets.UTF_8)));
MimeMessage message = prepareMimeMessage("GETSCRIPT \"" + SCRIPT_NAME.getValue() + "\"");
Mail mail = createUnauthenticatedMail(message);
@@ -204,7 +204,7 @@ public class ManageSieveMailetTestCase {
}
@Test
- public final void testGetScriptExtraArgs() throws Exception {
+ void testGetScriptExtraArgs() throws Exception {
MimeMessage message = prepareMimeMessage("GETSCRIPT \"" + SCRIPT_NAME.getValue() + "\" extra");
Mail mail = createUnauthenticatedMail(message);
mailet.service(mail);
@@ -212,7 +212,7 @@ public class ManageSieveMailetTestCase {
}
@Test
- public final void testGetScriptNoScript() throws Exception {
+ void testGetScriptNoScript() throws Exception {
doThrow(new ScriptNotFoundException()).when(sieveRepository).getScript(USERNAME, SCRIPT_NAME);
MimeMessage message = prepareMimeMessage("GETSCRIPT \"" + SCRIPT_NAME.getValue() + "\"");
Mail mail = createUnauthenticatedMail(message);
@@ -222,7 +222,7 @@ public class ManageSieveMailetTestCase {
}
@Test
- public final void testGetScriptNoScriptName() throws Exception {
+ void testGetScriptNoScriptName() throws Exception {
ScriptContent scriptContent = new ScriptContent("line1\r\nline2");
sieveRepository.putScript(USERNAME, SCRIPT_NAME, scriptContent);
MimeMessage message = prepareMimeMessage("GETSCRIPT");
@@ -234,7 +234,7 @@ public class ManageSieveMailetTestCase {
}
@Test
- public final void testCheckScriptUnauthorised() throws Exception {
+ void testCheckScriptUnauthorised() throws Exception {
MimeMessage message = prepareMessageWithAttachment(SCRIPT_CONTENT, "CHECKSCRIPT {10+}");
Mail mail = createUnauthenticatedMail(message);
mailet.service(mail);
@@ -242,7 +242,7 @@ public class ManageSieveMailetTestCase {
}
@Test
- public final void testCheckScript() throws Exception {
+ void testCheckScript() throws Exception {
when(sieveParser.parse(anyString())).thenReturn(Lists.newArrayList("warning1", "warning2"));
MimeMessage message = prepareMessageWithAttachment(SCRIPT_CONTENT, "CHECKSCRIPT {100+}");
Mail mail = createAuthentificatedMail(message);
@@ -251,7 +251,7 @@ public class ManageSieveMailetTestCase {
}
@Test
- public final void testCheckScriptExtraArgs() throws Exception {
+ void testCheckScriptExtraArgs() throws Exception {
MimeMessage message = prepareMessageWithAttachment(SCRIPT_CONTENT, "CHECKSCRIPT {10+} extra");
Mail mail = createAuthentificatedMail(message);
mailet.service(mail);
@@ -259,7 +259,7 @@ public class ManageSieveMailetTestCase {
}
@Test
- public final void testCheckScriptSyntaxError() throws Exception {
+ void testCheckScriptSyntaxError() throws Exception {
doThrow(new SyntaxException("error message")).when(sieveParser).parse(SYNTAX_EXCEPTION);
MimeMessage message = prepareMessageWithAttachment(SYNTAX_EXCEPTION, "CHECKSCRIPT {10+}");
Mail mail = createAuthentificatedMail(message);
@@ -268,7 +268,7 @@ public class ManageSieveMailetTestCase {
}
@Test
- public final void testCheckScriptNoSize() throws Exception {
+ void testCheckScriptNoSize() throws Exception {
MimeMessage message = prepareMimeMessage("CHECKSCRIPT");
Mail mail = createAuthentificatedMail(message);
mailet.service(mail);
@@ -276,7 +276,7 @@ public class ManageSieveMailetTestCase {
}
@Test
- public final void testCheckScriptNoScript() throws Exception {
+ void testCheckScriptNoScript() throws Exception {
MimeMessage message = prepareMimeMessage("CHECKSCRIPT {10+}");
Mail mail = createAuthentificatedMail(message);
mailet.service(mail);
@@ -284,7 +284,7 @@ public class ManageSieveMailetTestCase {
}
@Test
- public final void testDeleteScriptUnauthenticated() throws Exception {
+ void testDeleteScriptUnauthenticated() throws Exception {
MimeMessage message = prepareMimeMessage("DELETESCRIPT \"" + SCRIPT_NAME.getValue() + "\"");
Mail mail = createUnauthenticatedMail(message);
mailet.service(mail);
@@ -292,7 +292,7 @@ public class ManageSieveMailetTestCase {
}
@Test
- public final void testDeleteScript() throws Exception {
+ void testDeleteScript() throws Exception {
MimeMessage message = prepareMimeMessage("DELETESCRIPT \"" + SCRIPT_NAME.getValue() + "\"");
Mail mail = createAuthentificatedMail(message);
mailet.service(mail);
@@ -300,7 +300,7 @@ public class ManageSieveMailetTestCase {
}
@Test
- public final void testDeleteScriptExtraArgs() throws Exception {
+ void testDeleteScriptExtraArgs() throws Exception {
MimeMessage message = prepareMimeMessage("DELETESCRIPT \"" + SCRIPT_NAME.getValue() + "\" extra");
Mail mail = createUnauthenticatedMail(message);
mailet.service(mail);
@@ -308,7 +308,7 @@ public class ManageSieveMailetTestCase {
}
@Test
- public final void testDeleteScriptNoScriptName() throws Exception {
+ void testDeleteScriptNoScriptName() throws Exception {
MimeMessage message = prepareMimeMessage("DELETESCRIPT");
Mail mail = createUnauthenticatedMail(message);
mailet.service(mail);
@@ -316,7 +316,7 @@ public class ManageSieveMailetTestCase {
}
@Test
- public final void testHaveSpaceUnauthenticated() throws Exception {
+ void testHaveSpaceUnauthenticated() throws Exception {
MimeMessage message = prepareMimeMessage("HAVESPACE \"" + SCRIPT_NAME.getValue() + "\" 1");
Mail mail = createUnauthenticatedMail(message);
mailet.service(mail);
@@ -324,7 +324,7 @@ public class ManageSieveMailetTestCase {
}
@Test
- public final void testHaveSpace() throws Exception {
+ void testHaveSpace() throws Exception {
MimeMessage message = prepareMimeMessage("HAVESPACE \"" + SCRIPT_NAME.getValue() + "\" 1");
Mail mail = createAuthentificatedMail(message);
mailet.service(mail);
@@ -332,7 +332,7 @@ public class ManageSieveMailetTestCase {
}
@Test
- public final void testHaveSpaceExtraArgs() throws Exception {
+ void testHaveSpaceExtraArgs() throws Exception {
MimeMessage message = prepareMimeMessage("HAVESPACE \"" + SCRIPT_NAME.getValue() + "\" 1 extra");
Mail mail = createUnauthenticatedMail(message);
mailet.service(mail);
@@ -340,7 +340,7 @@ public class ManageSieveMailetTestCase {
}
@Test
- public final void testHaveSpaceNoScriptName() throws Exception {
+ void testHaveSpaceNoScriptName() throws Exception {
MimeMessage message = prepareMimeMessage("HAVESPACE");
Mail mail = createUnauthenticatedMail(message);
mailet.service(mail);
@@ -348,7 +348,7 @@ public class ManageSieveMailetTestCase {
}
@Test
- public final void testHaveSpaceNoScriptSize() throws Exception {
+ void testHaveSpaceNoScriptSize() throws Exception {
MimeMessage message = prepareMimeMessage("HAVESPACE \"" + SCRIPT_NAME.getValue() + "\"");
Mail mail = createUnauthenticatedMail(message);
mailet.service(mail);
@@ -356,7 +356,7 @@ public class ManageSieveMailetTestCase {
}
@Test
- public final void testHaveSpaceInvalidScriptSize() throws Exception {
+ void testHaveSpaceInvalidScriptSize() throws Exception {
MimeMessage message = prepareMimeMessage("HAVESPACE \"" + SCRIPT_NAME.getValue() + "\" X");
Mail mail = createUnauthenticatedMail(message);
mailet.service(mail);
@@ -364,7 +364,7 @@ public class ManageSieveMailetTestCase {
}
@Test
- public final void testListScriptsUnauthorised() throws Exception {
+ void testListScriptsUnauthorised() throws Exception {
MimeMessage message = prepareMimeMessage("LISTSCRIPTS");
Mail mail = createUnauthenticatedMail(message);
mailet.service(mail);
@@ -372,7 +372,7 @@ public class ManageSieveMailetTestCase {
}
@Test
- public final void testListScripts() throws Exception {
+ void testListScripts() throws Exception {
when(sieveRepository.listScripts(USERNAME)).thenReturn(Lists.newArrayList(new ScriptSummary(new ScriptName("scriptName2"), true), new ScriptSummary(new ScriptName("scriptName1"), false)));
MimeMessage message = prepareMimeMessage("LISTSCRIPTS");
Mail mail = createAuthentificatedMail(message);
@@ -381,7 +381,7 @@ public class ManageSieveMailetTestCase {
}
@Test
- public final void testListScriptsExtraArgs() throws Exception {
+ void testListScriptsExtraArgs() throws Exception {
MimeMessage message = prepareMimeMessage("LISTSCRIPTS extra");
Mail mail = createAuthentificatedMail(message);
mailet.service(mail);
@@ -389,7 +389,7 @@ public class ManageSieveMailetTestCase {
}
@Test
- public final void testRenameScriptsUnauthorised() throws Exception {
+ void testRenameScriptsUnauthorised() throws Exception {
sieveRepository.putScript(USERNAME, OLD_SCRIPT_NAME, SCRIPT_CONTENT);
MimeMessage message = prepareMimeMessage("RENAMESCRIPT \"" + OLD_SCRIPT_NAME + "\" \"" + NEW_SCRIPT_NAME + "\"");
Mail mail = createUnauthenticatedMail(message);
@@ -398,7 +398,7 @@ public class ManageSieveMailetTestCase {
}
@Test
- public final void testRenameScripts() throws Exception {
+ void testRenameScripts() throws Exception {
sieveRepository.putScript(USERNAME, OLD_SCRIPT_NAME, SCRIPT_CONTENT);
MimeMessage message = prepareMimeMessage("RENAMESCRIPT \"" + OLD_SCRIPT_NAME + "\" \"" + NEW_SCRIPT_NAME + "\"");
Mail mail = createAuthentificatedMail(message);
@@ -407,7 +407,7 @@ public class ManageSieveMailetTestCase {
}
@Test
- public final void testRenameScriptsExtraArgs() throws Exception {
+ void testRenameScriptsExtraArgs() throws Exception {
sieveRepository.putScript(USERNAME, OLD_SCRIPT_NAME, SCRIPT_CONTENT);
MimeMessage message = prepareMimeMessage("RENAMESCRIPT \"" + OLD_SCRIPT_NAME + "\" \"" + NEW_SCRIPT_NAME + "\" extra");
Mail mail = createUnauthenticatedMail(message);
@@ -416,7 +416,7 @@ public class ManageSieveMailetTestCase {
}
@Test
- public final void testRenameScriptsNoScriptName() throws Exception {
+ void testRenameScriptsNoScriptName() throws Exception {
sieveRepository.putScript(USERNAME, OLD_SCRIPT_NAME, SCRIPT_CONTENT);
MimeMessage message = prepareMimeMessage("RENAMESCRIPT");
Mail mail = createUnauthenticatedMail(message);
@@ -425,7 +425,7 @@ public class ManageSieveMailetTestCase {
}
@Test
- public final void testRenameScriptsNoNewScriptName() throws Exception {
+ void testRenameScriptsNoNewScriptName() throws Exception {
sieveRepository.putScript(USERNAME, OLD_SCRIPT_NAME, SCRIPT_CONTENT);
MimeMessage message = prepareMimeMessage("RENAMESCRIPT \"" + OLD_SCRIPT_NAME + "\"");
Mail mail = createUnauthenticatedMail(message);
@@ -434,7 +434,7 @@ public class ManageSieveMailetTestCase {
}
@Test
- public final void testSetActiveUnauthorised() throws Exception {
+ void testSetActiveUnauthorised() throws Exception {
MimeMessage message = prepareMimeMessage("SETACTIVE \"" + SCRIPT_NAME.getValue() + "\"");
Mail mail = createUnauthenticatedMail(message);
mailet.service(mail);
@@ -442,7 +442,7 @@ public class ManageSieveMailetTestCase {
}
@Test
- public final void testSetActive() throws Exception {
+ void testSetActive() throws Exception {
MimeMessage message = prepareMimeMessage("SETACTIVE \"" + SCRIPT_NAME.getValue() + "\"");
Mail mail = createAuthentificatedMail(message);
mailet.service(mail);
@@ -450,7 +450,7 @@ public class ManageSieveMailetTestCase {
}
@Test
- public final void testSetActiveExtraArgs() throws Exception {
+ void testSetActiveExtraArgs() throws Exception {
MimeMessage message = prepareMimeMessage("SETACTIVE \"" + SCRIPT_NAME.getValue() + "\" extra");
Mail mail = createUnauthenticatedMail(message);
mailet.service(mail);
@@ -458,7 +458,7 @@ public class ManageSieveMailetTestCase {
}
@Test
- public final void testSetActiveNoScriptName() throws Exception {
+ void testSetActiveNoScriptName() throws Exception {
MimeMessage message = prepareMimeMessage("SETACTIVE");
Mail mail = createUnauthenticatedMail(message);
mailet.service(mail);
@@ -466,7 +466,7 @@ public class ManageSieveMailetTestCase {
}
@Test
- public final void manageSieveMailetShouldIgnoreNullSender() throws Exception {
+ void manageSieveMailetShouldIgnoreNullSender() throws Exception {
MimeMessage message = prepareMimeMessage("SETACTIVE");
Mail mail = FakeMail.builder()
.name("name")
@@ -481,7 +481,7 @@ public class ManageSieveMailetTestCase {
}
@Test
- public final void manageSieveMailetShouldIgnoreMailWhenNoSender() throws Exception {
+ void manageSieveMailetShouldIgnoreMailWhenNoSender() throws Exception {
MimeMessage message = prepareMimeMessage("SETACTIVE");
Mail mail = FakeMail.builder()
.name("name")
diff --git a/server/mailet/mailets/src/test/java/org/apache/james/transport/mailets/redirect/LoadedOnceInitParametersTest.java b/server/mailet/mailets/src/test/java/org/apache/james/transport/mailets/redirect/LoadedOnceInitParametersTest.java
index c989a5e..b1c4f1e 100644
--- a/server/mailet/mailets/src/test/java/org/apache/james/transport/mailets/redirect/LoadedOnceInitParametersTest.java
+++ b/server/mailet/mailets/src/test/java/org/apache/james/transport/mailets/redirect/LoadedOnceInitParametersTest.java
@@ -23,12 +23,11 @@ import static org.assertj.core.api.Assertions.assertThat;
import java.util.Optional;
-import org.junit.Test;
-
-public class LoadedOnceInitParametersTest {
+import org.junit.jupiter.api.Test;
+class LoadedOnceInitParametersTest {
@Test
- public void fromShouldTakeValueFromInitParameters() {
+ void fromShouldTakeValueFromInitParameters() {
InitParameters expectedParameters = new MyInitParameters();
InitParameters parameters = LoadedOnceInitParameters.from(expectedParameters);
diff --git a/server/mailet/mailets/src/test/java/org/apache/james/transport/mailets/redirect/NotifyMailetInitParametersTest.java b/server/mailet/mailets/src/test/java/org/apache/james/transport/mailets/redirect/NotifyMailetInitParametersTest.java
index a0dfb17..055100a 100644
--- a/server/mailet/mailets/src/test/java/org/apache/james/transport/mailets/redirect/NotifyMailetInitParametersTest.java
+++ b/server/mailet/mailets/src/test/java/org/apache/james/transport/mailets/redirect/NotifyMailetInitParametersTest.java
@@ -23,30 +23,27 @@ import static org.assertj.core.api.Assertions.assertThat;
import java.util.Optional;
-import javax.mail.MessagingException;
-
import org.apache.mailet.Mail;
import org.apache.mailet.base.GenericMailet;
import org.apache.mailet.base.test.FakeMailetConfig;
-import org.junit.Before;
-import org.junit.Test;
-
-public class NotifyMailetInitParametersTest {
+import org.junit.jupiter.api.BeforeEach;
+import org.junit.jupiter.api.Test;
+class NotifyMailetInitParametersTest {
private GenericMailet mailet;
- @Before
- public void setup() {
+ @BeforeEach
+ void setup() {
mailet = new GenericMailet() {
@Override
- public void service(Mail mail) throws MessagingException {
+ public void service(Mail mail) {
}
};
}
@Test
- public void getPassThroughShouldReturnTrueWhenSetToTrue() throws Exception {
+ void getPassThroughShouldReturnTrueWhenSetToTrue() throws Exception {
FakeMailetConfig mailetConfig = FakeMailetConfig.builder()
.mailetName("mailet")
.setProperty("passThrough", "true")
@@ -59,7 +56,7 @@ public class NotifyMailetInitParametersTest {
}
@Test
- public void getPassThroughShouldReturnFalseWhenSetToFalse() throws Exception {
+ void getPassThroughShouldReturnFalseWhenSetToFalse() throws Exception {
FakeMailetConfig mailetConfig = FakeMailetConfig.builder()
.mailetName("mailet")
.setProperty("passThrough", "false")
@@ -72,7 +69,7 @@ public class NotifyMailetInitParametersTest {
}
@Test
- public void getPassThroughShouldReturnTrueWhenNotSet() throws Exception {
+ void getPassThroughShouldReturnTrueWhenNotSet() throws Exception {
FakeMailetConfig mailetConfig = FakeMailetConfig.builder()
.mailetName("mailet")
.build();
@@ -84,7 +81,7 @@ public class NotifyMailetInitParametersTest {
}
@Test
- public void getFakeDomainCheckShouldReturnTrueWhenSetToTrue() throws Exception {
+ void getFakeDomainCheckShouldReturnTrueWhenSetToTrue() throws Exception {
FakeMailetConfig mailetConfig = FakeMailetConfig.builder()
.mailetName("mailet")
.setProperty("fakeDomainCheck", "true")
@@ -97,7 +94,7 @@ public class NotifyMailetInitParametersTest {
}
@Test
- public void getFakeDomainCheckShouldReturnFalseWhenSetToFalse() throws Exception {
+ void getFakeDomainCheckShouldReturnFalseWhenSetToFalse() throws Exception {
FakeMailetConfig mailetConfig = FakeMailetConfig.builder()
.mailetName("mailet")
.setProperty("fakeDomainCheck", "false")
@@ -110,7 +107,7 @@ public class NotifyMailetInitParametersTest {
}
@Test
- public void getFakeDomainCheckShouldReturnFalseWhenNotSet() throws Exception {
+ void getFakeDomainCheckShouldReturnFalseWhenNotSet() throws Exception {
FakeMailetConfig mailetConfig = FakeMailetConfig.builder()
.mailetName("mailet")
.build();
@@ -122,7 +119,7 @@ public class NotifyMailetInitParametersTest {
}
@Test
- public void getInLineTypeShouldReturnValueWhenSet() throws Exception {
+ void getInLineTypeShouldReturnValueWhenSet() throws Exception {
FakeMailetConfig mailetConfig = FakeMailetConfig.builder()
.mailetName("mailet")
.setProperty("inline", "unaltered")
@@ -135,7 +132,7 @@ public class NotifyMailetInitParametersTest {
}
@Test
- public void getInLineTypeShouldReturnNoneWhenNotSet() throws Exception {
+ void getInLineTypeShouldReturnNoneWhenNotSet() throws Exception {
FakeMailetConfig mailetConfig = FakeMailetConfig.builder()
.mailetName("mailet")
.build();
@@ -147,7 +144,7 @@ public class NotifyMailetInitParametersTest {
}
@Test
- public void getAttachmentTypeShouldReturnValueWhenSet() throws Exception {
+ void getAttachmentTypeShouldReturnValueWhenSet() throws Exception {
FakeMailetConfig mailetConfig = FakeMailetConfig.builder()
.mailetName("mailet")
.setProperty("attachment", "unaltered")
@@ -160,7 +157,7 @@ public class NotifyMailetInitParametersTest {
}
@Test
- public void getAttachmentTypeShouldReturnMessageWhenNotSet() throws Exception {
+ void getAttachmentTypeShouldReturnMessageWhenNotSet() throws Exception {
FakeMailetConfig mailetConfig = FakeMailetConfig.builder()
.mailetName("mailet")
.build();
@@ -172,7 +169,7 @@ public class NotifyMailetInitParametersTest {
}
@Test
- public void getMessageShouldReturnNoticeValueWhenSet() throws Exception {
+ void getMessageShouldReturnNoticeValueWhenSet() throws Exception {
FakeMailetConfig mailetConfig = FakeMailetConfig.builder()
.mailetName("mailet")
.setProperty("notice", "my notice")
@@ -185,7 +182,7 @@ public class NotifyMailetInitParametersTest {
}
@Test
- public void getMessageShouldReturnMessageValueWhenSet() throws Exception {
+ void getMessageShouldReturnMessageValueWhenSet() throws Exception {
FakeMailetConfig mailetConfig = FakeMailetConfig.builder()
.mailetName("mailet")
.setProperty("message", "my message")
@@ -198,7 +195,7 @@ public class NotifyMailetInitParametersTest {
}
@Test
- public void getMessageShouldReturnDefaultMessageWhenNoticeAndMessageNotSet() throws Exception {
+ void getMessageShouldReturnDefaultMessageWhenNoticeAndMessageNotSet() throws Exception {
FakeMailetConfig mailetConfig = FakeMailetConfig.builder()
.mailetName("mailet")
.build();
@@ -210,7 +207,7 @@ public class NotifyMailetInitParametersTest {
}
@Test
- public void getSubjectShouldReturnNull() throws Exception {
+ void getSubjectShouldReturnNull() throws Exception {
FakeMailetConfig mailetConfig = FakeMailetConfig.builder()
.mailetName("mailet")
.build();
@@ -222,7 +219,7 @@ public class NotifyMailetInitParametersTest {
}
@Test
- public void getSubjectPrefixShouldReturnValueWhenSet() throws Exception {
+ void getSubjectPrefixShouldReturnValueWhenSet() throws Exception {
FakeMailetConfig mailetConfig = FakeMailetConfig.builder()
.mailetName("mailet")
.setProperty("prefix", "my prefix")
@@ -235,7 +232,7 @@ public class NotifyMailetInitParametersTest {
}
@Test
- public void getSubjectPrefixShouldReturnDefaultValueWhenNotSet() throws Exception {
+ void getSubjectPrefixShouldReturnDefaultValueWhenNotSet() throws Exception {
FakeMailetConfig mailetConfig = FakeMailetConfig.builder()
.mailetName("mailet")
.build();
@@ -247,7 +244,7 @@ public class NotifyMailetInitParametersTest {
}
@Test
- public void isAttachErrorShouldReturnTrueWhenSetToTrue() throws Exception {
+ void isAttachErrorShouldReturnTrueWhenSetToTrue() throws Exception {
FakeMailetConfig mailetConfig = FakeMailetConfig.builder()
.mailetName("mailet")
.setProperty("attachError", "true")
@@ -260,7 +257,7 @@ public class NotifyMailetInitParametersTest {
}
@Test
- public void isAttachErrorShouldReturnFalseWhenSetToFalse() throws Exception {
+ void isAttachErrorShouldReturnFalseWhenSetToFalse() throws Exception {
FakeMailetConfig mailetConfig = FakeMailetConfig.builder()
.mailetName("mailet")
.setProperty("attachError", "false")
@@ -273,7 +270,7 @@ public class NotifyMailetInitParametersTest {
}
@Test
- public void isAttachErrorShouldReturnFalseWhenNotSet() throws Exception {
+ void isAttachErrorShouldReturnFalseWhenNotSet() throws Exception {
FakeMailetConfig mailetConfig = FakeMailetConfig.builder()
.mailetName("mailet")
.build();
@@ -285,7 +282,7 @@ public class NotifyMailetInitParametersTest {
}
@Test
- public void isReplyShouldReturnTrue() throws Exception {
+ void isReplyShouldReturnTrue() throws Exception {
FakeMailetConfig mailetConfig = FakeMailetConfig.builder()
.mailetName("mailet")
.build();
@@ -297,7 +294,7 @@ public class NotifyMailetInitParametersTest {
}
@Test
- public void getRecipientsShouldReturnValueWhenSet() throws Exception {
+ void getRecipientsShouldReturnValueWhenSet() throws Exception {
FakeMailetConfig mailetConfig = FakeMailetConfig.builder()
.mailetName("mailet")
.setProperty("recipients", "user@james.org, user2@james.org")
@@ -310,7 +307,7 @@ public class NotifyMailetInitParametersTest {
}
@Test
- public void getRecipientsShouldReturnAbsentWhenEmpty() throws Exception {
+ void getRecipientsShouldReturnAbsentWhenEmpty() throws Exception {
FakeMailetConfig mailetConfig = FakeMailetConfig.builder()
.mailetName("mailet")
.setProperty("recipients", "")
@@ -323,7 +320,7 @@ public class NotifyMailetInitParametersTest {
}
@Test
- public void getRecipientsShouldReturnAbsentWhenNotSet() throws Exception {
+ void getRecipientsShouldReturnAbsentWhenNotSet() throws Exception {
FakeMailetConfig mailetConfig = FakeMailetConfig.builder()
.mailetName("mailet")
.build();
@@ -335,7 +332,7 @@ public class NotifyMailetInitParametersTest {
}
@Test
- public void getToShouldReturnValueWhenSet() throws Exception {
+ void getToShouldReturnValueWhenSet() throws Exception {
FakeMailetConfig mailetConfig = FakeMailetConfig.builder()
.mailetName("mailet")
.setProperty("to", "user@james.org, user2@james.org")
@@ -348,7 +345,7 @@ public class NotifyMailetInitParametersTest {
}
@Test
- public void getToShouldReturnAbsentWhenEmpty() throws Exception {
+ void getToShouldReturnAbsentWhenEmpty() throws Exception {
FakeMailetConfig mailetConfig = FakeMailetConfig.builder()
.mailetName("mailet")
.setProperty("to", "")
@@ -361,7 +358,7 @@ public class NotifyMailetInitParametersTest {
}
@Test
- public void getToShouldReturnAbsentWhenNotSet() throws Exception {
+ void getToShouldReturnAbsentWhenNotSet() throws Exception {
FakeMailetConfig mailetConfig = FakeMailetConfig.builder()
.mailetName("mailet")
.build();
@@ -373,7 +370,7 @@ public class NotifyMailetInitParametersTest {
}
@Test
- public void getReversePathShouldReturnValueWhenSet() throws Exception {
+ void getReversePathShouldReturnValueWhenSet() throws Exception {
FakeMailetConfig mailetConfig = FakeMailetConfig.builder()
.mailetName("mailet")
.setProperty("reversePath", "user@james.org, user2@james.org")
@@ -386,7 +383,7 @@ public class NotifyMailetInitParametersTest {
}
@Test
- public void getReversePathShouldReturnAbsentWhenEmpty() throws Exception {
+ void getReversePathShouldReturnAbsentWhenEmpty() throws Exception {
FakeMailetConfig mailetConfig = FakeMailetConfig.builder()
.mailetName("mailet")
.setProperty("reversePath", "")
@@ -399,7 +396,7 @@ public class NotifyMailetInitParametersTest {
}
@Test
- public void getReversePathShouldReturnAbsentWhenNotSet() throws Exception {
+ void getReversePathShouldReturnAbsentWhenNotSet() throws Exception {
FakeMailetConfig mailetConfig = FakeMailetConfig.builder()
.mailetName("mailet")
.build();
@@ -411,7 +408,7 @@ public class NotifyMailetInitParametersTest {
}
@Test
- public void getSenderShouldReturnValueWhenSet() throws Exception {
+ void getSenderShouldReturnValueWhenSet() throws Exception {
FakeMailetConfig mailetConfig = FakeMailetConfig.builder()
.mailetName("mailet")
.setProperty("sender", "user@james.org, user2@james.org")
@@ -424,7 +421,7 @@ public class NotifyMailetInitParametersTest {
}
@Test
- public void getSenderShouldReturnAbsentWhenEmpty() throws Exception {
+ void getSenderShouldReturnAbsentWhenEmpty() throws Exception {
FakeMailetConfig mailetConfig = FakeMailetConfig.builder()
.mailetName("mailet")
.setProperty("sender", "")
@@ -437,7 +434,7 @@ public class NotifyMailetInitParametersTest {
}
@Test
- public void getSenderShouldReturnAbsentWhenNotSet() throws Exception {
+ void getSenderShouldReturnAbsentWhenNotSet() throws Exception {
FakeMailetConfig mailetConfig = FakeMailetConfig.builder()
.mailetName("mailet")
.build();
@@ -449,7 +446,7 @@ public class NotifyMailetInitParametersTest {
}
@Test
- public void getReplyToShouldReturnValueWhenSet() throws Exception {
+ void getReplyToShouldReturnValueWhenSet() throws Exception {
FakeMailetConfig mailetConfig = FakeMailetConfig.builder()
.mailetName("mailet")
.setProperty("replyTo", "user@james.org, user2@james.org")
@@ -462,7 +459,7 @@ public class NotifyMailetInitParametersTest {
}
@Test
- public void getReplyToShouldReturnreplytoValueWhenSet() throws Exception {
+ void getReplyToShouldReturnreplytoValueWhenSet() throws Exception {
FakeMailetConfig mailetConfig = FakeMailetConfig.builder()
.mailetName("mailet")
.setProperty("replyto", "user@james.org, user2@james.org")
@@ -475,7 +472,7 @@ public class NotifyMailetInitParametersTest {
}
@Test
- public void getReplyToShouldReturnAbsentWhenEmpty() throws Exception {
+ void getReplyToShouldReturnAbsentWhenEmpty() throws Exception {
FakeMailetConfig mailetConfig = FakeMailetConfig.builder()
.mailetName("mailet")
.setProperty("replyTo", "")
@@ -488,7 +485,7 @@ public class NotifyMailetInitParametersTest {
}
@Test
- public void getReplyToShouldReturnAbsentWhenNotSet() throws Exception {
+ void getReplyToShouldReturnAbsentWhenNotSet() throws Exception {
FakeMailetConfig mailetConfig = FakeMailetConfig.builder()
.mailetName("mailet")
.build();
@@ -500,7 +497,7 @@ public class NotifyMailetInitParametersTest {
}
@Test
- public void isDebugShouldReturnTrueWhenSetToTrue() throws Exception {
+ void isDebugShouldReturnTrueWhenSetToTrue() throws Exception {
FakeMailetConfig mailetConfig = FakeMailetConfig.builder()
.mailetName("mailet")
.setProperty("debug", "true")
@@ -513,7 +510,7 @@ public class NotifyMailetInitParametersTest {
}
@Test
- public void isDebugShouldReturnFalseWhenSetToFalse() throws Exception {
+ void isDebugShouldReturnFalseWhenSetToFalse() throws Exception {
FakeMailetConfig mailetConfig = FakeMailetConfig.builder()
.mailetName("mailet")
.setProperty("debug", "false")
@@ -526,7 +523,7 @@ public class NotifyMailetInitParametersTest {
}
@Test
- public void isDebugShouldReturnFalseWhenNotSet() throws Exception {
+ void isDebugShouldReturnFalseWhenNotSet() throws Exception {
FakeMailetConfig mailetConfig = FakeMailetConfig.builder()
.mailetName("mailet")
.build();
@@ -538,7 +535,7 @@ public class NotifyMailetInitParametersTest {
}
@Test
- public void isStaticShouldReturnTrueWhenSetToTrue() throws Exception {
+ void isStaticShouldReturnTrueWhenSetToTrue() throws Exception {
FakeMailetConfig mailetConfig = FakeMailetConfig.builder()
.mailetName("mailet")
.setProperty("static", "true")
@@ -551,7 +548,7 @@ public class NotifyMailetInitParametersTest {
}
@Test
- public void isStaticShouldReturnFalseWhenSetToFalse() throws Exception {
+ void isStaticShouldReturnFalseWhenSetToFalse() throws Exception {
FakeMailetConfig mailetConfig = FakeMailetConfig.builder()
.mailetName("mailet")
.setProperty("static", "false")
@@ -564,7 +561,7 @@ public class NotifyMailetInitParametersTest {
}
@Test
- public void isStaticShouldReturnFalseWhenNotSet() throws Exception {
+ void isStaticShouldReturnFalseWhenNotSet() throws Exception {
FakeMailetConfig mailetConfig = FakeMailetConfig.builder()
.mailetName("mailet")
.build();
diff --git a/server/mailet/mailets/src/test/java/org/apache/james/transport/mailets/redirect/NotifyMailetsMessageTest.java b/server/mailet/mailets/src/test/java/org/apache/james/transport/mailets/redirect/NotifyMailetsMessageTest.java
index f8d99ac..c295bfc 100644
--- a/server/mailet/mailets/src/test/java/org/apache/james/transport/mailets/redirect/NotifyMailetsMessageTest.java
+++ b/server/mailet/mailets/src/test/java/org/apache/james/transport/mailets/redirect/NotifyMailetsMessageTest.java
@@ -36,27 +36,26 @@ import org.apache.james.core.builder.MimeMessageBuilder;
import org.apache.james.util.MimeMessageUtil;
import org.apache.mailet.Mail;
import org.apache.mailet.base.test.FakeMail;
-import org.junit.After;
-import org.junit.Before;
-import org.junit.Test;
-
-public class NotifyMailetsMessageTest {
+import org.junit.jupiter.api.AfterEach;
+import org.junit.jupiter.api.BeforeEach;
+import org.junit.jupiter.api.Test;
+class NotifyMailetsMessageTest {
private TimeZone timeZone;
- @Before
- public void setUp() throws Exception {
+ @BeforeEach
+ void setUp() {
timeZone = TimeZone.getDefault();
TimeZone.setDefault(TimeZone.getTimeZone("UTC"));
}
- @After
- public void tearDown() {
+ @AfterEach
+ void tearDown() {
TimeZone.setDefault(timeZone);
}
@Test
- public void generateMessageShouldReturnTheMessageWhenSimpleMimeMessage() throws Exception {
+ void generateMessageShouldReturnTheMessageWhenSimpleMimeMessage() throws Exception {
FakeMail mail = FakeMail.builder()
.name("name")
.mimeMessage(MimeMessageBuilder.mimeMessageBuilder())
@@ -71,7 +70,7 @@ public class NotifyMailetsMessageTest {
}
@Test
- public void generateMessageShouldAddErrorMessageWhenMimeMessageAsSome() throws Exception {
+ void generateMessageShouldAddErrorMessageWhenMimeMessageAsSome() throws Exception {
FakeMail mail = FakeMail.from(MimeMessageBuilder.mimeMessageBuilder());
String myErrorMessage = "my error message";
mail.setErrorMessage(myErrorMessage);
@@ -84,7 +83,7 @@ public class NotifyMailetsMessageTest {
}
@Test
- public void generateMessageShouldAddSubjectWhenMimeMessageAsSome() throws Exception {
+ void generateMessageShouldAddSubjectWhenMimeMessageAsSome() throws Exception {
FakeMail mail = FakeMail.from(MimeMessageBuilder.mimeMessageBuilder()
.setSubject("my subject"));
@@ -94,7 +93,7 @@ public class NotifyMailetsMessageTest {
}
@Test
- public void generateMessageShouldAddSentDateWhenMimeMessageAsSome() throws Exception {
+ void generateMessageShouldAddSentDateWhenMimeMessageAsSome() throws Exception {
MimeMessage message = MimeMessageUtil.defaultMimeMessage();
message.setSentDate(Date.from(Instant.parse("2016-09-08T14:25:52.000Z")));
FakeMail mail = FakeMail.from(message);
@@ -105,7 +104,7 @@ public class NotifyMailetsMessageTest {
}
@Test
- public void generateMessageShouldAddRecipientsWhenMimeMessageAsSome() throws Exception {
+ void generateMessageShouldAddRecipientsWhenMimeMessageAsSome() throws Exception {
FakeMail mail = FakeMail.builder()
.name("name")
.mimeMessage(MimeMessageBuilder.mimeMessageBuilder())
@@ -119,7 +118,7 @@ public class NotifyMailetsMessageTest {
}
@Test
- public void generateMessageShouldAddFromWhenMimeMessageAsSome() throws Exception {
+ void generateMessageShouldAddFromWhenMimeMessageAsSome() throws Exception {
FakeMail mail = FakeMail.from(MimeMessageBuilder.mimeMessageBuilder()
.addFrom("user@james.org"));
@@ -130,7 +129,7 @@ public class NotifyMailetsMessageTest {
}
@Test
- public void generateMessageShouldAddToWhenMimeMessageAsSome() throws Exception {
+ void generateMessageShouldAddToWhenMimeMessageAsSome() throws Exception {
FakeMail mail = FakeMail.from(MimeMessageBuilder.mimeMessageBuilder()
.addToRecipient("user@james.org", "user2@james.org"));
@@ -142,7 +141,7 @@ public class NotifyMailetsMessageTest {
}
@Test
- public void generateMessageShouldAddCCWhenMimeMessageAsSome() throws Exception {
+ void generateMessageShouldAddCCWhenMimeMessageAsSome() throws Exception {
FakeMail mail = FakeMail.from(MimeMessageBuilder.mimeMessageBuilder()
.addCcRecipient("user@james.org", "user2@james.org"));
@@ -154,7 +153,7 @@ public class NotifyMailetsMessageTest {
}
@Test
- public void generateMessageShouldAddSizeWhenPossible() throws Exception {
+ void generateMessageShouldAddSizeWhenPossible() throws Exception {
FakeMail mail = FakeMail.from(MimeMessageBuilder.mimeMessageBuilder());
mail.setMessageSize(6);
@@ -164,7 +163,7 @@ public class NotifyMailetsMessageTest {
}
@Test
- public void generateMessageShouldSpecifySizeInAReadableWay() throws Exception {
+ void generateMessageShouldSpecifySizeInAReadableWay() throws Exception {
String content = "MIME-Version: 1.0\r\n" +
"Content-Type: text/plain; charset=utf-8\r\n" +
"\r\n" +
@@ -180,7 +179,7 @@ public class NotifyMailetsMessageTest {
}
@Test
- public void getMessageInternalSizeShouldTransformMessagingErrorIntoEmpty() throws MessagingException {
+ void getMessageInternalSizeShouldTransformMessagingErrorIntoEmpty() throws MessagingException {
Mail mail = mock(Mail.class);
when(mail.getMessageSize()).thenThrow(new MessagingException());
@@ -189,7 +188,7 @@ public class NotifyMailetsMessageTest {
}
@Test
- public void getMessageInternalSizeShouldTransformZeroSizeIntoEmpty() throws MessagingException {
+ void getMessageInternalSizeShouldTransformZeroSizeIntoEmpty() throws MessagingException {
Mail mail = mock(Mail.class);
when(mail.getMessageSize()).thenReturn(0L);
@@ -198,7 +197,7 @@ public class NotifyMailetsMessageTest {
}
@Test
- public void getMessageInternalSizeShouldTransformNegativeIntoEmpty() throws MessagingException {
+ void getMessageInternalSizeShouldTransformNegativeIntoEmpty() throws MessagingException {
Mail mail = mock(Mail.class);
when(mail.getMessageSize()).thenReturn(-1L);
@@ -207,7 +206,7 @@ public class NotifyMailetsMessageTest {
}
@Test
- public void getMessageInternalSizeShouldReturnSizeWhenAvailable() throws MessagingException {
+ void getMessageInternalSizeShouldReturnSizeWhenAvailable() throws MessagingException {
long size = 42L;
Mail mail = mock(Mail.class);
@@ -218,7 +217,7 @@ public class NotifyMailetsMessageTest {
}
@Test
- public void generateMessageShouldDecodeEncodedSubject() throws Exception {
+ void generateMessageShouldDecodeEncodedSubject() throws Exception {
String content = "MIME-Version: 1.0\r\n" +
"Subject: =?UTF-8?Q?Cl=c3=b4ture_&_Paie_du_mois?=\r\n" +
"Content-Type: text/plain; charset=utf-8\r\n" +
@@ -233,7 +232,7 @@ public class NotifyMailetsMessageTest {
}
@Test
- public void generateMessageShouldDecodeEncodedFrom() throws Exception {
+ void generateMessageShouldDecodeEncodedFrom() throws Exception {
String content = "MIME-Version: 1.0\r\n" +
"From: =?UTF-8?Q?=F0=9F=90=83@linagora.com?=\r\n" +
"Content-Type: text/plain; charset=utf-8\r\n" +
@@ -249,7 +248,7 @@ public class NotifyMailetsMessageTest {
}
@Test
- public void generateMessageShouldDecodeEncodedTo() throws Exception {
+ void generateMessageShouldDecodeEncodedTo() throws Exception {
String content = "MIME-Version: 1.0\r\n" +
"To: =?UTF-8?Q?=F0=9F=9A=BE@linagora.com?=\r\n" +
"Content-Type: text/plain; charset=utf-8\r\n" +
@@ -265,7 +264,7 @@ public class NotifyMailetsMessageTest {
}
@Test
- public void generateMessageShouldDecodeEncodedCc() throws Exception {
+ void generateMessageShouldDecodeEncodedCc() throws Exception {
String content = "MIME-Version: 1.0\r\n" +
"Cc: =?UTF-8?Q?=F0=9F=9A=B2@linagora.com?=\r\n" +
"Content-Type: text/plain; charset=utf-8\r\n" +
@@ -281,7 +280,7 @@ public class NotifyMailetsMessageTest {
}
@Test
- public void safelyDecodeShouldReturnTextNotEncodedUnmodified() throws Exception {
+ void safelyDecodeShouldReturnTextNotEncodedUnmodified() {
String text = "Why not unicode for Llama";
assertThat(NotifyMailetsMessage.safelyDecode(text))
@@ -289,13 +288,13 @@ public class NotifyMailetsMessageTest {
}
@Test
- public void safelyDecodeShouldCorrectlyDecodeQuotedPrintable() throws Exception {
+ void safelyDecodeShouldCorrectlyDecodeQuotedPrintable() {
assertThat(NotifyMailetsMessage.safelyDecode("=?UTF-8?Q?=E2=99=A5=F0=9F=9A=B2?="))
.isEqualTo("♥🚲");
}
@Test
- public void safelyDecodeShouldReturnInvalidEncodedTextUnmodified() throws Exception {
+ void safelyDecodeShouldReturnInvalidEncodedTextUnmodified() {
String invalidEncodedText = "=?UTF-8?Q?=E2=99=A5=FX=9F=9A=B2?=";
assertThat(NotifyMailetsMessage.safelyDecode(invalidEncodedText))
@@ -303,7 +302,7 @@ public class NotifyMailetsMessageTest {
}
@Test
- public void safelyDecodeShouldReturnEncodedTextUnmodifiedWhenUnknownCharset() throws Exception {
+ void safelyDecodeShouldReturnEncodedTextUnmodifiedWhenUnknownCharset() {
String encodedTextWithUnknownCharset = "=?UTF-9?Q?=E2=99=A5=F0=9F=9A=B2?=";
assertThat(NotifyMailetsMessage.safelyDecode(encodedTextWithUnknownCharset))
diff --git a/server/mailet/mailets/src/test/java/org/apache/james/transport/mailets/redirect/RedirectMailetInitParametersTest.java b/server/mailet/mailets/src/test/java/org/apache/james/transport/mailets/redirect/RedirectMailetInitParametersTest.java
index 208bd35..5f3b11c 100644
--- a/server/mailet/mailets/src/test/java/org/apache/james/transport/mailets/redirect/RedirectMailetInitParametersTest.java
+++ b/server/mailet/mailets/src/test/java/org/apache/james/transport/mailets/redirect/RedirectMailetInitParametersTest.java
@@ -23,24 +23,21 @@ import static org.assertj.core.api.Assertions.assertThat;
import java.util.Optional;
-import javax.mail.MessagingException;
-
import org.apache.mailet.Mail;
import org.apache.mailet.base.GenericMailet;
import org.apache.mailet.base.test.FakeMailetConfig;
-import org.junit.Before;
-import org.junit.Test;
-
-public class RedirectMailetInitParametersTest {
+import org.junit.jupiter.api.BeforeEach;
+import org.junit.jupiter.api.Test;
+class RedirectMailetInitParametersTest {
private GenericMailet mailet;
- @Before
- public void setup() {
+ @BeforeEach
+ void setup() {
mailet = new GenericMailet() {
@Override
- public void service(Mail mail) throws MessagingException {
+ public void service(Mail mail) {
}
};
}
diff --git a/server/mailet/mailets/src/test/java/org/apache/james/transport/mailets/redirect/SpecialAddressTest.java b/server/mailet/mailets/src/test/java/org/apache/james/transport/mailets/redirect/SpecialAddressTest.java
index 6a4bf2c..ed6e81c 100644
--- a/server/mailet/mailets/src/test/java/org/apache/james/transport/mailets/redirect/SpecialAddressTest.java
+++ b/server/mailet/mailets/src/test/java/org/apache/james/transport/mailets/redirect/SpecialAddressTest.java
@@ -22,62 +22,61 @@ package org.apache.james.transport.mailets.redirect;
import static org.assertj.core.api.Assertions.assertThat;
import org.apache.james.core.MailAddress;
-import org.junit.Test;
-
-public class SpecialAddressTest {
+import org.junit.jupiter.api.Test;
+class SpecialAddressTest {
@Test
- public void senderSpecialAddressShouldMatchExpectedValue() {
+ void senderSpecialAddressShouldMatchExpectedValue() {
assertThat(SpecialAddress.AddressMarker.SENDER).isEqualTo("sender@address.marker");
}
@Test
- public void reverserPathSpecialAddressShouldMatchExpectedValue() {
+ void reverserPathSpecialAddressShouldMatchExpectedValue() {
assertThat(SpecialAddress.AddressMarker.REVERSE_PATH).isEqualTo("reverse.path@address.marker");
}
@Test
- public void fromSpecialAddressShouldMatchExpectedValue() {
+ void fromSpecialAddressShouldMatchExpectedValue() {
assertThat(SpecialAddress.AddressMarker.FROM).isEqualTo("from@address.marker");
}
@Test
- public void replyToSpecialAddressShouldMatchExpectedValue() {
+ void replyToSpecialAddressShouldMatchExpectedValue() {
assertThat(SpecialAddress.AddressMarker.REPLY_TO).isEqualTo("reply.to@address.marker");
}
@Test
- public void toSpecialAddressShouldMatchExpectedValue() {
+ void toSpecialAddressShouldMatchExpectedValue() {
assertThat(SpecialAddress.AddressMarker.TO).isEqualTo("to@address.marker");
}
@Test
- public void recipientsSpecialAddressShouldMatchExpectedValue() {
+ void recipientsSpecialAddressShouldMatchExpectedValue() {
assertThat(SpecialAddress.AddressMarker.RECIPIENTS).isEqualTo("recipients@address.marker");
}
@Test
- public void deleteSpecialAddressShouldMatchExpectedValue() {
+ void deleteSpecialAddressShouldMatchExpectedValue() {
assertThat(SpecialAddress.AddressMarker.DELETE).isEqualTo("delete@address.marker");
}
@Test
- public void unalteredSpecialAddressShouldMatchExpectedValue() {
+ void unalteredSpecialAddressShouldMatchExpectedValue() {
assertThat(SpecialAddress.AddressMarker.UNALTERED).isEqualTo("unaltered@address.marker");
}
@Test
- public void nullSpecialAddressShouldMatchExpectedValue() {
+ void nullSpecialAddressShouldMatchExpectedValue() {
assertThat(SpecialAddress.AddressMarker.NULL).isEqualTo("null@address.marker");
}
@Test
- public void isSpecialAddressShouldReturnTrueWhenMatchingSpecialDomain() throws Exception {
+ void isSpecialAddressShouldReturnTrueWhenMatchingSpecialDomain() throws Exception {
assertThat(SpecialAddress.isSpecialAddress(new MailAddress("user", "address.marker"))).isTrue();
}
@Test
- public void isSpecialAddressShouldReturnFalseWhenNotMatchingSpecialDomain() throws Exception {
+ void isSpecialAddressShouldReturnFalseWhenNotMatchingSpecialDomain() throws Exception {
assertThat(SpecialAddress.isSpecialAddress(new MailAddress("user", "james.org"))).isFalse();
}
}
diff --git a/server/mailet/mailets/src/test/java/org/apache/james/transport/mailets/remote/delivery/AddressesArrayToMailAddressListConverterTest.java b/server/mailet/mailets/src/test/java/org/apache/james/transport/mailets/remote/delivery/AddressesArrayToMailAddressListConverterTest.java
index b54f940..319be48 100644
--- a/server/mailet/mailets/src/test/java/org/apache/james/transport/mailets/remote/delivery/AddressesArrayToMailAddressListConverterTest.java
+++ b/server/mailet/mailets/src/test/java/org/apache/james/transport/mailets/remote/delivery/AddressesArrayToMailAddressListConverterTest.java
@@ -24,33 +24,31 @@ import static org.assertj.core.api.Assertions.assertThat;
import javax.mail.Address;
import javax.mail.internet.InternetAddress;
-import org.apache.james.transport.mailets.remote.delivery.AddressesArrayToMailAddressListConverter;
import org.apache.mailet.base.MailAddressFixture;
-import org.junit.Test;
+import org.junit.jupiter.api.Test;
public class AddressesArrayToMailAddressListConverterTest {
-
private static final String WRONG_INTERNET_ADDRESS = "!!";
@Test
- public void getAddressesAsMailAddressShouldReturnEmptyOnNull() {
+ void getAddressesAsMailAddressShouldReturnEmptyOnNull() {
assertThat(AddressesArrayToMailAddressListConverter.getAddressesAsMailAddress(null)).isEmpty();
}
@Test
- public void getAddressesAsMailAddressShouldReturnEmptyOnEmpty() {
+ void getAddressesAsMailAddressShouldReturnEmptyOnEmpty() {
assertThat(AddressesArrayToMailAddressListConverter.getAddressesAsMailAddress(new Address[]{})).isEmpty();
}
@Test
- public void getAddressesAsMailAddressShouldWorkWithSingleValue() throws Exception {
+ void getAddressesAsMailAddressShouldWorkWithSingleValue() throws Exception {
assertThat(AddressesArrayToMailAddressListConverter.getAddressesAsMailAddress(new Address[]{
new InternetAddress(MailAddressFixture.ANY_AT_JAMES.toString())}))
.containsOnly(MailAddressFixture.ANY_AT_JAMES);
}
@Test
- public void getAddressesAsMailAddressShouldWorkWithTwoValues() throws Exception {
+ void getAddressesAsMailAddressShouldWorkWithTwoValues() throws Exception {
assertThat(AddressesArrayToMailAddressListConverter.getAddressesAsMailAddress(new Address[]{
new InternetAddress(MailAddressFixture.ANY_AT_JAMES.toString()),
new InternetAddress(MailAddressFixture.OTHER_AT_JAMES.toString())}))
@@ -58,7 +56,7 @@ public class AddressesArrayToMailAddressListConverterTest {
}
@Test
- public void getAddressesAsMailAddressShouldFilterErrorMailAddress() throws Exception {
+ void getAddressesAsMailAddressShouldFilterErrorMailAddress() throws Exception {
assertThat(AddressesArrayToMailAddressListConverter.getAddressesAsMailAddress(new Address[]{
new InternetAddress(MailAddressFixture.ANY_AT_JAMES.toString()),
new InternetAddress(WRONG_INTERNET_ADDRESS)}))
diff --git a/server/mailet/mailets/src/test/java/org/apache/james/transport/mailets/remote/delivery/BouncerTest.java b/server/mailet/mailets/src/test/java/org/apache/james/transport/mailets/remote/delivery/BouncerTest.java
index c759b9d..86b7e9c 100644
--- a/server/mailet/mailets/src/test/java/org/apache/james/transport/mailets/remote/delivery/BouncerTest.java
+++ b/server/mailet/mailets/src/test/java/org/apache/james/transport/mailets/remote/delivery/BouncerTest.java
@@ -41,12 +41,12 @@ import org.apache.mailet.base.MailAddressFixture;
import org.apache.mailet.base.test.FakeMail;
import org.apache.mailet.base.test.FakeMailContext;
import org.apache.mailet.base.test.FakeMailetConfig;
-import org.junit.Before;
-import org.junit.Test;
+import org.junit.jupiter.api.BeforeEach;
+import org.junit.jupiter.api.Test;
import com.sun.mail.smtp.SMTPSendFailedException;
-public class BouncerTest {
+class BouncerTest {
private static final String HELLO_NAME = "hello_name";
private static final FakeMailetConfig DEFAULT_REMOTE_DELIVERY_CONFIG = FakeMailetConfig.builder()
.setProperty(RemoteDeliveryConfiguration.HELO_NAME, HELLO_NAME)
@@ -56,13 +56,13 @@ public class BouncerTest {
private FakeMailContext mailetContext;
- @Before
- public void setUp() {
+ @BeforeEach
+ void setUp() {
mailetContext = FakeMailContext.defaultContext();
}
@Test
- public void bounceShouldCallMailetContextBounceByDefault() throws Exception {
+ void bounceShouldCallMailetContextBounceByDefault() throws Exception {
RemoteDeliveryConfiguration configuration = new RemoteDeliveryConfiguration(
DEFAULT_REMOTE_DELIVERY_CONFIG,
mock(DomainList.class));
@@ -85,7 +85,7 @@ public class BouncerTest {
}
@Test
- public void bounceShouldIncludeMessagingExceptionMessageByDefault() throws Exception {
+ void bounceShouldIncludeMessagingExceptionMessageByDefault() throws Exception {
RemoteDeliveryConfiguration configuration = new RemoteDeliveryConfiguration(
DEFAULT_REMOTE_DELIVERY_CONFIG,
mock(DomainList.class));
@@ -111,7 +111,7 @@ public class BouncerTest {
}
@Test
- public void bounceShouldCustomizeSendFailedExceptionByDefault() throws Exception {
+ void bounceShouldCustomizeSendFailedExceptionByDefault() throws Exception {
RemoteDeliveryConfiguration configuration = new RemoteDeliveryConfiguration(
DEFAULT_REMOTE_DELIVERY_CONFIG,
mock(DomainList.class));
@@ -137,7 +137,7 @@ public class BouncerTest {
}
@Test
- public void bounceShouldCustomizeUnknownHostExceptionByDefault() throws Exception {
+ void bounceShouldCustomizeUnknownHostExceptionByDefault() throws Exception {
RemoteDeliveryConfiguration configuration = new RemoteDeliveryConfiguration(
DEFAULT_REMOTE_DELIVERY_CONFIG,
mock(DomainList.class));
@@ -164,7 +164,7 @@ public class BouncerTest {
}
@Test
- public void bounceShouldCustomizeConnectionExceptionByDefault() throws Exception {
+ void bounceShouldCustomizeConnectionExceptionByDefault() throws Exception {
RemoteDeliveryConfiguration configuration = new RemoteDeliveryConfiguration(
DEFAULT_REMOTE_DELIVERY_CONFIG,
mock(DomainList.class));
@@ -190,7 +190,7 @@ public class BouncerTest {
}
@Test
- public void bounceShouldCustomizeSocketExceptionByDefault() throws Exception {
+ void bounceShouldCustomizeSocketExceptionByDefault() throws Exception {
RemoteDeliveryConfiguration configuration = new RemoteDeliveryConfiguration(
DEFAULT_REMOTE_DELIVERY_CONFIG,
mock(DomainList.class));
@@ -216,7 +216,7 @@ public class BouncerTest {
}
@Test
- public void bounceShouldCustomizeNestedMessagingExceptionByDefault() throws Exception {
+ void bounceShouldCustomizeNestedMessagingExceptionByDefault() throws Exception {
RemoteDeliveryConfiguration configuration = new RemoteDeliveryConfiguration(
DEFAULT_REMOTE_DELIVERY_CONFIG,
mock(DomainList.class));
@@ -242,7 +242,7 @@ public class BouncerTest {
}
@Test
- public void bounceShouldNotBounceWithNoSenderByDefault() throws Exception {
+ void bounceShouldNotBounceWithNoSenderByDefault() throws Exception {
RemoteDeliveryConfiguration configuration = new RemoteDeliveryConfiguration(
DEFAULT_REMOTE_DELIVERY_CONFIG,
mock(DomainList.class));
@@ -258,7 +258,7 @@ public class BouncerTest {
}
@Test
- public void bounceShouldSupportExceptionWithoutMessagesByDefault() throws Exception {
+ void bounceShouldSupportExceptionWithoutMessagesByDefault() throws Exception {
RemoteDeliveryConfiguration configuration = new RemoteDeliveryConfiguration(
DEFAULT_REMOTE_DELIVERY_CONFIG,
mock(DomainList.class));
@@ -281,7 +281,7 @@ public class BouncerTest {
}
@Test
- public void bounceShouldNotSupportMessagingExceptionWithoutMessagesByDefault() throws Exception {
+ void bounceShouldNotSupportMessagingExceptionWithoutMessagesByDefault() throws Exception {
RemoteDeliveryConfiguration configuration = new RemoteDeliveryConfiguration(
DEFAULT_REMOTE_DELIVERY_CONFIG,
mock(DomainList.class));
@@ -304,7 +304,7 @@ public class BouncerTest {
}
@Test
- public void bounceShouldWorkWhenProcessorSpecified() throws Exception {
+ void bounceShouldWorkWhenProcessorSpecified() throws Exception {
RemoteDeliveryConfiguration configuration = new RemoteDeliveryConfiguration(
FakeMailetConfig.builder()
.setProperty(RemoteDeliveryConfiguration.HELO_NAME, HELLO_NAME)
@@ -330,7 +330,7 @@ public class BouncerTest {
}
@Test
- public void bounceShouldNotBounceWhenNoSenderWhenProcessorSpecified() throws Exception {
+ void bounceShouldNotBounceWhenNoSenderWhenProcessorSpecified() throws Exception {
RemoteDeliveryConfiguration configuration = new RemoteDeliveryConfiguration(
FakeMailetConfig.builder()
.setProperty(RemoteDeliveryConfiguration.HELO_NAME, HELLO_NAME)
@@ -348,7 +348,7 @@ public class BouncerTest {
}
@Test
- public void bounceShouldDisplayAddressByDefault() throws Exception {
+ void bounceShouldDisplayAddressByDefault() throws Exception {
RemoteDeliveryConfiguration configuration = new RemoteDeliveryConfiguration(
DEFAULT_REMOTE_DELIVERY_CONFIG,
mock(DomainList.class));
@@ -373,7 +373,7 @@ public class BouncerTest {
}
@Test
- public void bounceShouldDisplayAddressesByDefault() throws Exception {
+ void bounceShouldDisplayAddressesByDefault() throws Exception {
RemoteDeliveryConfiguration configuration = new RemoteDeliveryConfiguration(
DEFAULT_REMOTE_DELIVERY_CONFIG,
mock(DomainList.class));
@@ -399,7 +399,7 @@ public class BouncerTest {
}
@Test
- public void bounceShouldWorkWhenProcessorSpecifiedAndNoExceptionMessage() throws Exception {
+ void bounceShouldWorkWhenProcessorSpecifiedAndNoExceptionMessage() throws Exception {
RemoteDeliveryConfiguration configuration = new RemoteDeliveryConfiguration(
FakeMailetConfig.builder()
.setProperty(RemoteDeliveryConfiguration.HELO_NAME, HELLO_NAME)
@@ -424,7 +424,7 @@ public class BouncerTest {
}
@Test
- public void bounceShouldAttachErrorCodeWhenSmtpError() throws Exception {
+ void bounceShouldAttachErrorCodeWhenSmtpError() throws Exception {
RemoteDeliveryConfiguration configuration = new RemoteDeliveryConfiguration(
FakeMailetConfig.builder()
.setProperty(RemoteDeliveryConfiguration.HELO_NAME, HELLO_NAME)
@@ -454,7 +454,7 @@ public class BouncerTest {
}
@Test
- public void bounceShouldNotAttachErrorCodeWhenNotMessagingException() throws Exception {
+ void bounceShouldNotAttachErrorCodeWhenNotMessagingException() throws Exception {
RemoteDeliveryConfiguration configuration = new RemoteDeliveryConfiguration(
FakeMailetConfig.builder()
.setProperty(RemoteDeliveryConfiguration.HELO_NAME, HELLO_NAME)
@@ -480,7 +480,7 @@ public class BouncerTest {
}
@Test
- public void bounceShouldNotAttachErrorCodeWhenNotSmtpError() throws Exception {
+ void bounceShouldNotAttachErrorCodeWhenNotSmtpError() throws Exception {
RemoteDeliveryConfiguration configuration = new RemoteDeliveryConfiguration(
FakeMailetConfig.builder()
.setProperty(RemoteDeliveryConfiguration.HELO_NAME, HELLO_NAME)
@@ -506,7 +506,7 @@ public class BouncerTest {
}
@Test
- public void bounceShouldAttachNullErrorMessageWhenNoException() throws Exception {
+ void bounceShouldAttachNullErrorMessageWhenNoException() throws Exception {
RemoteDeliveryConfiguration configuration = new RemoteDeliveryConfiguration(
FakeMailetConfig.builder()
.setProperty(RemoteDeliveryConfiguration.HELO_NAME, HELLO_NAME)
diff --git a/server/mailet/mailets/src/test/java/org/apache/james/transport/mailets/remote/delivery/DeliveryRetryHelperTest.java b/server/mailet/mailets/src/test/java/org/apache/james/transport/mailets/remote/delivery/DeliveryRetryHelperTest.java
index 545f77d..30c8ce0 100644
--- a/server/mailet/mailets/src/test/java/org/apache/james/transport/mailets/remote/delivery/DeliveryRetryHelperTest.java
+++ b/server/mailet/mailets/src/test/java/org/apache/james/transport/mailets/remote/delivery/DeliveryRetryHelperTest.java
@@ -21,24 +21,22 @@ package org.apache.james.transport.mailets.remote.delivery;
import static org.assertj.core.api.Assertions.assertThat;
-import org.apache.james.transport.mailets.remote.delivery.DeliveryRetriesHelper;
import org.apache.mailet.Attribute;
import org.apache.mailet.AttributeValue;
import org.apache.mailet.base.test.FakeMail;
-import org.junit.Test;
-
-public class DeliveryRetryHelperTest {
+import org.junit.jupiter.api.Test;
+class DeliveryRetryHelperTest {
private static final Attribute INVALID_ATTRIBUTE = new Attribute(DeliveryRetriesHelper.DELIVERY_RETRY_COUNT, AttributeValue.of("invalid"));
@Test
- public void retrieveRetriesShouldBeZeroByDefault() throws Exception {
+ void retrieveRetriesShouldBeZeroByDefault() throws Exception {
assertThat(DeliveryRetriesHelper.retrieveRetries(FakeMail.defaultFakeMail()))
.isEqualTo(0);
}
@Test
- public void retrieveRetriesShouldBeZeroAfterInit() throws Exception {
+ void retrieveRetriesShouldBeZeroAfterInit() throws Exception {
FakeMail mail = FakeMail.defaultFakeMail();
DeliveryRetriesHelper.initRetries(mail);
@@ -48,7 +46,7 @@ public class DeliveryRetryHelperTest {
}
@Test
- public void retrieveRetriesShouldBeOneAfterIncrement() throws Exception {
+ void retrieveRetriesShouldBeOneAfterIncrement() throws Exception {
FakeMail mail = FakeMail.defaultFakeMail();
DeliveryRetriesHelper.initRetries(mail);
@@ -59,7 +57,7 @@ public class DeliveryRetryHelperTest {
}
@Test
- public void incrementRetriesShouldWorkOnNonInitializedMails() throws Exception {
+ void incrementRetriesShouldWorkOnNonInitializedMails() throws Exception {
FakeMail mail = FakeMail.defaultFakeMail();
DeliveryRetriesHelper.incrementRetries(mail);
@@ -69,7 +67,7 @@ public class DeliveryRetryHelperTest {
}
@Test
- public void retrieveRetriesShouldBeZeroOnInvalidValue() throws Exception {
+ void retrieveRetriesShouldBeZeroOnInvalidValue() throws Exception {
FakeMail mail = FakeMail.builder().name("name").attribute(INVALID_ATTRIBUTE).build();
assertThat(DeliveryRetriesHelper.retrieveRetries(mail))
@@ -77,7 +75,7 @@ public class DeliveryRetryHelperTest {
}
@Test
- public void incrementRetriesShouldWorkOnInvalidMails() throws Exception {
+ void incrementRetriesShouldWorkOnInvalidMails() throws Exception {
FakeMail mail = FakeMail.builder().name("name").attribute(INVALID_ATTRIBUTE).build();
DeliveryRetriesHelper.incrementRetries(mail);
diff --git a/server/mailet/mailets/src/test/java/org/apache/james/transport/mailets/remote/delivery/MailDelivrerTest.java b/server/mailet/mailets/src/test/java/org/apache/james/transport/mailets/remote/delivery/MailDelivrerTest.java
index 4f76eca..8b9da07 100644
--- a/server/mailet/mailets/src/test/java/org/apache/james/transport/mailets/remote/delivery/MailDelivrerTest.java
+++ b/server/mailet/mailets/src/test/java/org/apache/james/transport/mailets/remote/delivery/MailDelivrerTest.java
@@ -43,15 +43,15 @@ import org.apache.mailet.Mail;
import org.apache.mailet.base.MailAddressFixture;
import org.apache.mailet.base.test.FakeMail;
import org.apache.mailet.base.test.FakeMailetConfig;
-import org.junit.Before;
-import org.junit.Test;
+import org.junit.jupiter.api.BeforeEach;
+import org.junit.jupiter.api.Test;
import com.google.common.collect.ImmutableList;
import com.google.common.collect.UnmodifiableIterator;
import com.sun.mail.smtp.SMTPSenderFailedException;
@SuppressWarnings("deprecation")
-public class MailDelivrerTest {
+class MailDelivrerTest {
public static final String MX1_HOSTNAME = "mx1." + MailAddressFixture.JAMES2_APACHE_ORG;
public static final String MX2_HOSTNAME = "mx2." + MailAddressFixture.JAMES2_APACHE_ORG;
public static final String SMTP_URI2 = "protocol://userid:password@host:119/file1";
@@ -64,7 +64,7 @@ public class MailDelivrerTest {
private DnsHelper dnsHelper;
private MailDelivrerToHost mailDelivrerToHost;
- @Before
+ @BeforeEach
public void setUp() {
bouncer = mock(Bouncer.class);
dnsHelper = mock(DnsHelper.class);
@@ -78,7 +78,7 @@ public class MailDelivrerTest {
}
@Test
- public void handleSenderFailedExceptionShouldReturnTemporaryFailureByDefault() throws Exception {
+ void handleSenderFailedExceptionShouldReturnTemporaryFailureByDefault() throws Exception {
Mail mail = FakeMail.builder().name("name").recipients(MailAddressFixture.ANY_AT_JAMES, MailAddressFixture.OTHER_AT_JAMES).build();
SendFailedException sfe = new SendFailedException();
@@ -88,7 +88,7 @@ public class MailDelivrerTest {
}
@Test
- public void handleSenderFailedExceptionShouldReturnTemporaryFailureWhenNotServerException() throws Exception {
+ void handleSenderFailedExceptionShouldReturnTemporaryFailureWhenNotServerException() throws Exception {
Mail mail = FakeMail.builder().name("name").recipients(MailAddressFixture.ANY_AT_JAMES, MailAddressFixture.OTHER_AT_JAMES).build();
SendFailedException sfe = new SMTPSenderFailedException(new InternetAddress(MailAddressFixture.OTHER_AT_JAMES.asString()), "Comand", 400, "An temporary error");
@@ -98,7 +98,7 @@ public class MailDelivrerTest {
}
@Test
- public void handleSenderFailedExceptionShouldReturnPermanentFailureWhenServerException() throws Exception {
+ void handleSenderFailedExceptionShouldReturnPermanentFailureWhenServerException() throws Exception {
Mail mail = FakeMail.builder().name("name").recipients(MailAddressFixture.ANY_AT_JAMES, MailAddressFixture.OTHER_AT_JAMES).build();
SendFailedException sfe = new SMTPSenderFailedException(new InternetAddress(MailAddressFixture.OTHER_AT_JAMES.asString()), "Comand", 505, "An temporary error");
@@ -108,7 +108,7 @@ public class MailDelivrerTest {
}
@Test
- public void handleSenderFailedExceptionShouldReturnPermanentFailureWhenInvalidAndNotValidUnsent() throws Exception {
+ void handleSenderFailedExceptionShouldReturnPermanentFailureWhenInvalidAndNotValidUnsent() throws Exception {
Mail mail = FakeMail.builder().name("name").recipients(MailAddressFixture.ANY_AT_JAMES, MailAddressFixture.OTHER_AT_JAMES).build();
Address[] validSent = {};
@@ -125,7 +125,7 @@ public class MailDelivrerTest {
}
@Test
- public void handleSenderFailedExceptionShouldReturnTemporaryFailureWhenValidUnsent() throws Exception {
+ void handleSenderFailedExceptionShouldReturnTemporaryFailureWhenValidUnsent() throws Exception {
Mail mail = FakeMail.builder().name("name").recipients(MailAddressFixture.ANY_AT_JAMES, MailAddressFixture.OTHER_AT_JAMES).build();
Address[] validSent = {};
@@ -142,7 +142,7 @@ public class MailDelivrerTest {
}
@Test
- public void handleSenderFailedExceptionShouldReturnTemporaryFailureWhenInvalidAndValidUnsent() throws Exception {
+ void handleSenderFailedExceptionShouldReturnTemporaryFailureWhenInvalidAndValidUnsent() throws Exception {
Mail mail = FakeMail.builder().name("name").recipients(MailAddressFixture.ANY_AT_JAMES, MailAddressFixture.OTHER_AT_JAMES).build();
Address[] validSent = {};
@@ -159,7 +159,7 @@ public class MailDelivrerTest {
}
@Test
- public void handleSenderFailedExceptionShouldSetRecipientToInvalidWhenOnlyInvalid() throws Exception {
+ void handleSenderFailedExceptionShouldSetRecipientToInvalidWhenOnlyInvalid() throws Exception {
Mail mail = FakeMail.builder().name("name").recipients(MailAddressFixture.ANY_AT_JAMES, MailAddressFixture.OTHER_AT_JAMES).build();
Address[] validSent = {};
@@ -176,7 +176,7 @@ public class MailDelivrerTest {
}
@Test
- public void handleSenderFailedExceptionShouldSetRecipientToValidUnsentWhenOnlyValidUnsent() throws Exception {
+ void handleSenderFailedExceptionShouldSetRecipientToValidUnsentWhenOnlyValidUnsent() throws Exception {
Mail mail = FakeMail.builder().name("name").recipients(MailAddressFixture.ANY_AT_JAMES, MailAddressFixture.OTHER_AT_JAMES).build();
Address[] validSent = {};
@@ -193,7 +193,7 @@ public class MailDelivrerTest {
}
@Test
- public void handleSenderFailedExceptionShouldSetRecipientToValidUnsentWhenValidUnsentAndInvalid() throws Exception {
+ void handleSenderFailedExceptionShouldSetRecipientToValidUnsentWhenValidUnsentAndInvalid() throws Exception {
Mail mail = FakeMail.builder().name("name").recipients(MailAddressFixture.ANY_AT_JAMES, MailAddressFixture.OTHER_AT_JAMES).build();
Address[] validSent = {};
@@ -210,7 +210,7 @@ public class MailDelivrerTest {
}
@Test
- public void handleSenderFailedExceptionShouldBounceInvalidAddressesOnBothInvalidAndValidUnsent() throws Exception {
+ void handleSenderFailedExceptionShouldBounceInvalidAddressesOnBothInvalidAndValidUnsent() throws Exception {
Mail mail = FakeMail.builder().name("name").recipients(MailAddressFixture.ANY_AT_JAMES, MailAddressFixture.OTHER_AT_JAMES).build();
Address[] validSent = {};
@@ -228,7 +228,7 @@ public class MailDelivrerTest {
}
@Test
- public void deliverShouldReturnTemporaryFailureOnTemporaryResolutionException() throws Exception {
+ void deliverShouldReturnTemporaryFailureOnTemporaryResolutionException() throws Exception {
Mail mail = FakeMail.builder().name("name").recipients(MailAddressFixture.ANY_AT_JAMES, MailAddressFixture.OTHER_AT_JAMES).build();
when(dnsHelper.retrieveHostAddressIterator(MailAddressFixture.JAMES_APACHE_ORG)).thenThrow(new TemporaryResolutionException());
@@ -239,7 +239,7 @@ public class MailDelivrerTest {
}
@Test
- public void deliverShouldReturnTemporaryErrorWhenFirstDNSProblem() throws Exception {
+ void deliverShouldReturnTemporaryErrorWhenFirstDNSProblem() throws Exception {
Mail mail = FakeMail.builder().name("name").recipients(MailAddressFixture.ANY_AT_JAMES, MailAddressFixture.OTHER_AT_JAMES).build();
UnmodifiableIterator<HostAddress> empty = ImmutableList.<HostAddress>of().iterator();
@@ -251,7 +251,7 @@ public class MailDelivrerTest {
}
@Test
- public void deliverShouldReturnTemporaryErrorWhenToleratedDNSProblem() throws Exception {
+ void deliverShouldReturnTemporaryErrorWhenToleratedDNSProblem() throws Exception {
Mail mail = FakeMail.builder().name("name").recipients(MailAddressFixture.ANY_AT_JAMES, MailAddressFixture.OTHER_AT_JAMES).build();
DeliveryRetriesHelper.incrementRetries(mail);
@@ -264,7 +264,7 @@ public class MailDelivrerTest {
}
@Test
- public void deliverShouldReturnPermanentErrorWhenLimitDNSProblemReached() throws Exception {
+ void deliverShouldReturnPermanentErrorWhenLimitDNSProblemReached() throws Exception {
Mail mail = FakeMail.builder().name("name").recipients(MailAddressFixture.ANY_AT_JAMES, MailAddressFixture.OTHER_AT_JAMES).build();
DeliveryRetriesHelper.incrementRetries(mail);
DeliveryRetriesHelper.incrementRetries(mail);
@@ -279,7 +279,7 @@ public class MailDelivrerTest {
}
@Test
- public void deliverShouldReturnPermanentErrorWhenLimitDNSProblemExceeded() throws Exception {
+ void deliverShouldReturnPermanentErrorWhenLimitDNSProblemExceeded() throws Exception {
Mail mail = FakeMail.builder().name("name").recipients(MailAddressFixture.ANY_AT_JAMES, MailAddressFixture.OTHER_AT_JAMES).build();
DeliveryRetriesHelper.incrementRetries(mail);
@@ -296,7 +296,7 @@ public class MailDelivrerTest {
}
@Test
- public void deliverShouldWork() throws Exception {
+ void deliverShouldWork() throws Exception {
Mail mail = FakeMail.builder().name("name").recipients(MailAddressFixture.ANY_AT_JAMES, MailAddressFixture.OTHER_AT_JAMES).build();
UnmodifiableIterator<HostAddress> dnsEntries = ImmutableList.of(
@@ -312,7 +312,7 @@ public class MailDelivrerTest {
}
@Test
- public void deliverShouldAbortWhenServerError() throws Exception {
+ void deliverShouldAbortWhenServerError() throws Exception {
Mail mail = FakeMail.builder().name("name").recipients(MailAddressFixture.ANY_AT_JAMES, MailAddressFixture.OTHER_AT_JAMES).build();
UnmodifiableIterator<HostAddress> dnsEntries = ImmutableList.of(
@@ -328,7 +328,7 @@ public class MailDelivrerTest {
}
@Test
- public void deliverShouldAbortWithTemporaryWhenMessagingExceptionCauseUnknown() throws Exception {
+ void deliverShouldAbortWithTemporaryWhenMessagingExceptionCauseUnknown() throws Exception {
Mail mail = FakeMail.builder().name("name").recipients(MailAddressFixture.ANY_AT_JAMES, MailAddressFixture.OTHER_AT_JAMES).build();
UnmodifiableIterator<HostAddress> dnsEntries = ImmutableList.of(
@@ -344,7 +344,7 @@ public class MailDelivrerTest {
}
@Test
- public void deliverShouldTryTwiceOnIOException() throws Exception {
+ void deliverShouldTryTwiceOnIOException() throws Exception {
Mail mail = FakeMail.builder().name("name").recipients(MailAddressFixture.ANY_AT_JAMES, MailAddressFixture.OTHER_AT_JAMES).build();
UnmodifiableIterator<HostAddress> dnsEntries = ImmutableList.of(
@@ -362,7 +362,7 @@ public class MailDelivrerTest {
}
@Test
- public void deliverShouldAbortWhenServerErrorSFE() throws Exception {
+ void deliverShouldAbortWhenServerErrorSFE() throws Exception {
Mail mail = FakeMail.builder().name("name").recipients(MailAddressFixture.ANY_AT_JAMES, MailAddressFixture.OTHER_AT_JAMES).build();
UnmodifiableIterator<HostAddress> dnsEntries = ImmutableList.of(
@@ -378,7 +378,7 @@ public class MailDelivrerTest {
}
@Test
- public void deliverShouldAttemptDeliveryOnlyOnceIfNoMoreValidUnsent() throws Exception {
+ void deliverShouldAttemptDeliveryOnlyOnceIfNoMoreValidUnsent() throws Exception {
Mail mail = FakeMail.builder().name("name").recipients(MailAddressFixture.ANY_AT_JAMES, MailAddressFixture.OTHER_AT_JAMES).build();
UnmodifiableIterator<HostAddress> dnsEntries = ImmutableList.of(
@@ -394,7 +394,7 @@ public class MailDelivrerTest {
}
@Test
- public void deliverShouldAttemptDeliveryOnBothMXIfStillRecipients() throws Exception {
+ void deliverShouldAttemptDeliveryOnBothMXIfStillRecipients() throws Exception {
Mail mail = FakeMail.builder().name("name").recipients(MailAddressFixture.ANY_AT_JAMES, MailAddressFixture.OTHER_AT_JAMES).build();
Address[] validSent = {};
Address[] validUnsent = {new InternetAddress(MailAddressFixture.OTHER_AT_JAMES.asString())};
@@ -418,7 +418,7 @@ public class MailDelivrerTest {
}
@Test
- public void deliverShouldWorkIfOnlyMX2Valid() throws Exception {
+ void deliverShouldWorkIfOnlyMX2Valid() throws Exception {
Mail mail = FakeMail.builder().name("name").recipients(MailAddressFixture.ANY_AT_JAMES, MailAddressFixture.OTHER_AT_JAMES).build();
Address[] validSent = {};
Address[] validUnsent = {new InternetAddress(MailAddressFixture.OTHER_AT_JAMES.asString())};
diff --git a/server/mailet/mailets/src/test/java/org/apache/james/transport/mailets/remote/delivery/RemoteDeliveryRunningTest.java b/server/mailet/mailets/src/test/java/org/apache/james/transport/mailets/remote/delivery/RemoteDeliveryRunningTest.java
index b059efa..cb39c37 100644
--- a/server/mailet/mailets/src/test/java/org/apache/james/transport/mailets/remote/delivery/RemoteDeliveryRunningTest.java
+++ b/server/mailet/mailets/src/test/java/org/apache/james/transport/mailets/remote/delivery/RemoteDeliveryRunningTest.java
@@ -34,22 +34,22 @@ import org.apache.james.queue.api.MailQueueFactory;
import org.apache.james.queue.api.MailQueueName;
import org.apache.james.transport.mailets.RemoteDelivery;
import org.apache.mailet.base.test.FakeMailetConfig;
-import org.junit.After;
-import org.junit.Before;
-import org.junit.Test;
+import org.junit.jupiter.api.AfterEach;
+import org.junit.jupiter.api.BeforeEach;
+import org.junit.jupiter.api.Test;
import reactor.core.publisher.Flux;
-public class RemoteDeliveryRunningTest {
+class RemoteDeliveryRunningTest {
private static final MailQueueName QUEUE_NAME = MailQueueName.of("queueName");
private RemoteDelivery remoteDelivery;
private MailQueue mailQueue;
private CountDownLatch countDownLatch;
- @Before
+ @BeforeEach
@SuppressWarnings("unchecked")
- public void setUp() throws Exception {
+ void setUp() throws Exception {
countDownLatch = new CountDownLatch(1);
MailQueueFactory<MailQueue> mailQueueFactory = mock(MailQueueFactory.class);
remoteDelivery = new RemoteDelivery(mock(DNSService.class), mock(DomainList.class), mailQueueFactory,
@@ -60,7 +60,7 @@ public class RemoteDeliveryRunningTest {
}
@Test
- public void remoteDeliveryShouldStart() throws Exception {
+ void remoteDeliveryShouldStart() throws Exception {
when(mailQueue.deQueue()).thenAnswer(invocation -> {
countDownLatch.countDown();
Thread.sleep(TimeUnit.SECONDS.toMillis(2));
@@ -75,9 +75,8 @@ public class RemoteDeliveryRunningTest {
verify(mailQueue).deQueue();
}
- @After
- public void tearDown() {
+ @AfterEach
+ void tearDown() {
remoteDelivery.destroy();
}
-
}
diff --git a/server/mailet/mailets/src/test/java/org/apache/james/transport/mailets/remote/delivery/RemoteDeliveryTest.java b/server/mailet/mailets/src/test/java/org/apache/james/transport/mailets/remote/delivery/RemoteDeliveryTest.java
index cfcc648..947e052 100644
--- a/server/mailet/mailets/src/test/java/org/apache/james/transport/mailets/remote/delivery/RemoteDeliveryTest.java
+++ b/server/mailet/mailets/src/test/java/org/apache/james/transport/mailets/remote/delivery/RemoteDeliveryTest.java
@@ -47,8 +47,8 @@ import org.apache.mailet.Mail;
import org.apache.mailet.base.MailAddressFixture;
import org.apache.mailet.base.test.FakeMail;
import org.apache.mailet.base.test.FakeMailetConfig;
-import org.junit.Before;
-import org.junit.Test;
+import org.junit.jupiter.api.BeforeEach;
+import org.junit.jupiter.api.Test;
import com.google.common.collect.ImmutableList;
import com.google.common.collect.ImmutableMap;
@@ -97,7 +97,7 @@ public class RemoteDeliveryTest {
private RemoteDelivery remoteDelivery;
private ManageableMailQueue mailQueue;
- @Before
+ @BeforeEach
public void setUp() throws ConfigurationException {
MailQueueFactory<? extends ManageableMailQueue> queueFactory = new MemoryMailQueueFactory(new RawMailQueueItemDecoratorFactory());
mailQueue = queueFactory.createQueue(RemoteDeliveryConfiguration.DEFAULT_OUTGOING_QUEUE_NAME);
@@ -109,7 +109,7 @@ public class RemoteDeliveryTest {
}
@Test
- public void remoteDeliveryShouldAddEmailToSpool() throws Exception {
+ void remoteDeliveryShouldAddEmailToSpool() throws Exception {
remoteDelivery.init(FakeMailetConfig.builder()
.build());
@@ -128,7 +128,7 @@ public class RemoteDeliveryTest {
}
@Test
- public void remoteDeliveryShouldSplitMailsByServerWhenNoGateway() throws Exception {
+ void remoteDeliveryShouldSplitMailsByServerWhenNoGateway() throws Exception {
remoteDelivery.init(FakeMailetConfig.builder()
.build());
@@ -154,7 +154,7 @@ public class RemoteDeliveryTest {
}
@Test
- public void remoteDeliveryShouldNotSplitMailsByServerWhenGateway() throws Exception {
+ void remoteDeliveryShouldNotSplitMailsByServerWhenGateway() throws Exception {
remoteDelivery.init(FakeMailetConfig.builder()
.setProperty(RemoteDeliveryConfiguration.GATEWAY, MailAddressFixture.JAMES_LOCAL)
.build());
@@ -177,7 +177,7 @@ public class RemoteDeliveryTest {
}
@Test
- public void remoteDeliveryShouldGhostMails() throws Exception {
+ void remoteDeliveryShouldGhostMails() throws Exception {
remoteDelivery.init(FakeMailetConfig.builder()
.build());
@@ -188,7 +188,7 @@ public class RemoteDeliveryTest {
}
@Test
- public void remoteDeliveryShouldAddPriorityIfSpecified() throws Exception {
+ void remoteDeliveryShouldAddPriorityIfSpecified() throws Exception {
remoteDelivery.init(FakeMailetConfig.builder()
.setProperty(RemoteDeliveryConfiguration.USE_PRIORITY, "true")
.build());
@@ -208,7 +208,7 @@ public class RemoteDeliveryTest {
}
@Test
- public void remoteDeliveryShouldNotForwardMailsWithNoRecipients() throws Exception {
+ void remoteDeliveryShouldNotForwardMailsWithNoRecipients() throws Exception {
remoteDelivery.init(FakeMailetConfig.builder()
.build());
@@ -220,7 +220,7 @@ public class RemoteDeliveryTest {
}
@Test
- public void remoteDeliveryShouldNotForwardMailsWithNoRecipientsWithGateway() throws Exception {
+ void remoteDeliveryShouldNotForwardMailsWithNoRecipientsWithGateway() throws Exception {
remoteDelivery.init(FakeMailetConfig.builder()
.setProperty(RemoteDeliveryConfiguration.GATEWAY, MailAddressFixture.JAMES_LOCAL)
.build());
diff --git a/server/mailet/mailets/src/test/java/org/apache/james/transport/matchers/AtLeastPriorityTest.java b/server/mailet/mailets/src/test/java/org/apache/james/transport/matchers/AtLeastPriorityTest.java
index ff7960d..9b71246 100644
--- a/server/mailet/mailets/src/test/java/org/apache/james/transport/matchers/AtLeastPriorityTest.java
+++ b/server/mailet/mailets/src/test/java/org/apache/james/transport/matchers/AtLeastPriorityTest.java
@@ -30,10 +30,10 @@ import org.apache.mailet.Attribute;
import org.apache.mailet.AttributeValue;
import org.apache.mailet.base.test.FakeMail;
import org.apache.mailet.base.test.FakeMatcherConfig;
-import org.junit.Before;
-import org.junit.Test;
+import org.junit.jupiter.api.BeforeEach;
+import org.junit.jupiter.api.Test;
-public class AtLeastPriorityTest {
+class AtLeastPriorityTest {
protected AtLeastPriority matcher;
protected MailAddress testRecipient;
private final String condition = "5";
@@ -46,8 +46,8 @@ public class AtLeastPriorityTest {
return fakeMail;
}
- @Before
- public void setup() throws MessagingException {
+ @BeforeEach
+ void setup() throws MessagingException {
this.matcher = new AtLeastPriority();
FakeMatcherConfig matcherConfig = FakeMatcherConfig.builder()
.matcherName(matcher.getPriorityMatcherName())
@@ -59,7 +59,7 @@ public class AtLeastPriorityTest {
}
@Test
- public void shouldNotMatchWhenPriorityDoesNotMatch() throws MessagingException {
+ void shouldNotMatchWhenPriorityDoesNotMatch() throws MessagingException {
FakeMail fakeMail = createFakeMail(3);
Collection<MailAddress> actual = matcher.match(fakeMail);
@@ -68,7 +68,7 @@ public class AtLeastPriorityTest {
}
@Test
- public void shouldMatchWhenPriorityMatch() throws MessagingException {
+ void shouldMatchWhenPriorityMatch() throws MessagingException {
FakeMail fakeMail = createFakeMail(5);
Collection<MailAddress> actual = matcher.match(fakeMail);
@@ -77,7 +77,7 @@ public class AtLeastPriorityTest {
}
@Test
- public void shouldMatchWhenMailHasHigherPriority() throws MessagingException {
+ void shouldMatchWhenMailHasHigherPriority() throws MessagingException {
FakeMail fakeMail = createFakeMail(7);
Collection<MailAddress> actual = matcher.match(fakeMail);
diff --git a/server/mailet/mailets/src/test/java/org/apache/james/transport/matchers/AtMostPriorityTest.java b/server/mailet/mailets/src/test/java/org/apache/james/transport/matchers/AtMostPriorityTest.java
index ef508e0..447d970 100644
--- a/server/mailet/mailets/src/test/java/org/apache/james/transport/matchers/AtMostPriorityTest.java
+++ b/server/mailet/mailets/src/test/java/org/apache/james/transport/matchers/AtMostPriorityTest.java
@@ -30,10 +30,10 @@ import org.apache.mailet.Attribute;
import org.apache.mailet.AttributeValue;
import org.apache.mailet.base.test.FakeMail;
import org.apache.mailet.base.test.FakeMatcherConfig;
-import org.junit.Before;
-import org.junit.Test;
+import org.junit.jupiter.api.BeforeEach;
+import org.junit.jupiter.api.Test;
-public class AtMostPriorityTest {
+class AtMostPriorityTest {
protected AtMostPriority matcher;
protected MailAddress testRecipient;
private final String condition = "5";
@@ -46,8 +46,8 @@ public class AtMostPriorityTest {
return fakeMail;
}
- @Before
- public void setup() throws MessagingException {
+ @BeforeEach
+ void setup() throws MessagingException {
this.matcher = new AtMostPriority();
FakeMatcherConfig matcherConfig = FakeMatcherConfig.builder()
.matcherName(matcher.getPriorityMatcherName())
@@ -59,7 +59,7 @@ public class AtMostPriorityTest {
}
@Test
- public void shouldMatchWhenMailHasLowerPriority() throws MessagingException {
+ void shouldMatchWhenMailHasLowerPriority() throws MessagingException {
FakeMail fakeMail = this.createFakeMail(3);
Collection<MailAddress> actual = matcher.match(fakeMail);
@@ -68,7 +68,7 @@ public class AtMostPriorityTest {
}
@Test
- public void shouldMatchWhenPriorityMatch() throws MessagingException {
+ void shouldMatchWhenPriorityMatch() throws MessagingException {
FakeMail fakeMail = this.createFakeMail(5);
Collection<MailAddress> actual = matcher.match(fakeMail);
@@ -77,7 +77,7 @@ public class AtMostPriorityTest {
}
@Test
- public void shouldNotMatchWhenPriorityDoesNotMatch() throws MessagingException {
+ void shouldNotMatchWhenPriorityDoesNotMatch() throws MessagingException {
FakeMail fakeMail = this.createFakeMail(7);
Collection<MailAddress> actual = matcher.match(fakeMail);
diff --git a/server/mailet/mailets/src/test/java/org/apache/james/transport/matchers/HasPriorityTest.java b/server/mailet/mailets/src/test/java/org/apache/james/transport/matchers/HasPriorityTest.java
index 92ec67a..ec9bcf1 100644
--- a/server/mailet/mailets/src/test/java/org/apache/james/transport/matchers/HasPriorityTest.java
+++ b/server/mailet/mailets/src/test/java/org/apache/james/transport/matchers/HasPriorityTest.java
@@ -30,8 +30,8 @@ import org.apache.mailet.Attribute;
import org.apache.mailet.AttributeValue;
import org.apache.mailet.base.test.FakeMail;
import org.apache.mailet.base.test.FakeMatcherConfig;
-import org.junit.Before;
-import org.junit.Test;
+import org.junit.jupiter.api.BeforeEach;
+import org.junit.jupiter.api.Test;
public class HasPriorityTest {
protected HasPriority matcher;
@@ -46,8 +46,8 @@ public class HasPriorityTest {
return fakeMail;
}
- @Before
- public void setup() throws MessagingException {
+ @BeforeEach
+ void setup() throws MessagingException {
this.matcher = new HasPriority();
FakeMatcherConfig matcherConfig = FakeMatcherConfig.builder()
.matcherName(matcher.getPriorityMatcherName())
@@ -59,7 +59,7 @@ public class HasPriorityTest {
}
@Test
- public void shouldMatchWhenPriorityMatch() throws MessagingException {
+ void shouldMatchWhenPriorityMatch() throws MessagingException {
FakeMail fakeMail = this.createFakeMail(5);
Collection<MailAddress> actual = matcher.match(fakeMail);
@@ -68,7 +68,7 @@ public class HasPriorityTest {
}
@Test
- public void shouldNotMatchWhenPriorityDoesNotMatch() throws MessagingException {
+ void shouldNotMatchWhenPriorityDoesNotMatch() throws MessagingException {
FakeMail fakeMail = this.createFakeMail(7);
Collection<MailAddress> actual = matcher.match(fakeMail);
diff --git a/server/mailet/mailets/src/test/java/org/apache/james/transport/matchers/InSpammerBlacklistTest.java b/server/mailet/mailets/src/test/java/org/apache/james/transport/matchers/InSpammerBlacklistTest.java
index 1382669..5f4948b 100644
--- a/server/mailet/mailets/src/test/java/org/apache/james/transport/matchers/InSpammerBlacklistTest.java
+++ b/server/mailet/mailets/src/test/java/org/apache/james/transport/matchers/InSpammerBlacklistTest.java
@@ -32,14 +32,14 @@ import org.apache.james.dnsservice.api.mock.MockDNSService;
import org.apache.mailet.Mail;
import org.apache.mailet.base.test.FakeMail;
import org.apache.mailet.base.test.FakeMatcherConfig;
-import org.junit.Test;
+import org.junit.jupiter.api.Test;
-public class InSpammerBlacklistTest {
-
- private InSpammerBlacklist matcher;
+class InSpammerBlacklistTest {
private static final String BLACKLIST = "my.black.list.";
private static final StringBuffer LISTED_HOST = new StringBuffer("111.222.111.222");
+ private InSpammerBlacklist matcher;
+
private DNSService setUpDNSServer() {
return new MockDNSService() {
@@ -75,7 +75,7 @@ public class InSpammerBlacklistTest {
}
@Test
- public void testInBlackList() throws MessagingException {
+ void testInBlackList() throws MessagingException {
Mail mail = createMail(LISTED_HOST.toString());
setupMatcher(BLACKLIST);
@@ -86,7 +86,7 @@ public class InSpammerBlacklistTest {
}
@Test
- public void testNotInBlackList() throws MessagingException {
+ void testNotInBlackList() throws MessagingException {
Mail mail = createMail("212.12.14.1");
setupMatcher(BLACKLIST);
diff --git a/server/mailet/mailets/src/test/java/org/apache/james/transport/matchers/IsMarkedAsSpamTest.java b/server/mailet/mailets/src/test/java/org/apache/james/transport/matchers/IsMarkedAsSpamTest.java
index 4d3210d..7eaf2b4 100644
--- a/server/mailet/mailets/src/test/java/org/apache/james/transport/matchers/IsMarkedAsSpamTest.java
+++ b/server/mailet/mailets/src/test/java/org/apache/james/transport/matchers/IsMarkedAsSpamTest.java
@@ -26,20 +26,19 @@ import org.apache.james.core.MailAddress;
import org.apache.mailet.Attribute;
import org.apache.mailet.PerRecipientHeaders;
import org.apache.mailet.base.test.FakeMail;
-import org.junit.Before;
-import org.junit.Test;
+import org.junit.jupiter.api.BeforeEach;
+import org.junit.jupiter.api.Test;
public class IsMarkedAsSpamTest {
-
private IsMarkedAsSpam matcher;
- @Before
- public void setup() {
+ @BeforeEach
+ void setup() {
matcher = new IsMarkedAsSpam();
}
@Test
- public void isMarkedAsSpamShouldNotMatchWhenNoHeader() throws Exception {
+ void isMarkedAsSpamShouldNotMatchWhenNoHeader() throws Exception {
FakeMail mail = FakeMail.builder()
.name("name")
.sender("sender@james.org")
@@ -51,7 +50,7 @@ public class IsMarkedAsSpamTest {
}
@Test
- public void isMarkedAsSpamShouldNotMatchWhenHeaderButEmptyValue() throws Exception {
+ void isMarkedAsSpamShouldNotMatchWhenHeaderButEmptyValue() throws Exception {
FakeMail mail = FakeMail.builder()
.name("name")
.sender("sender@james.org")
@@ -68,7 +67,7 @@ public class IsMarkedAsSpamTest {
}
@Test
- public void isMarkedAsSpamShouldNotMatchWhenHeaderButOtherValue() throws Exception {
+ void isMarkedAsSpamShouldNotMatchWhenHeaderButOtherValue() throws Exception {
FakeMail mail = FakeMail.builder()
.name("name")
.sender("sender@james.org")
@@ -85,7 +84,7 @@ public class IsMarkedAsSpamTest {
}
@Test
- public void isMarkedAsSpamShouldNotMatchWhenHeaderButNoValue() throws Exception {
+ void isMarkedAsSpamShouldNotMatchWhenHeaderButNoValue() throws Exception {
FakeMail mail = FakeMail.builder()
.name("name")
.sender("sender@james.org")
@@ -102,7 +101,7 @@ public class IsMarkedAsSpamTest {
}
@Test
- public void isMarkedAsSpamShouldMatchWhenHeaderAndYesValue() throws Exception {
+ void isMarkedAsSpamShouldMatchWhenHeaderAndYesValue() throws Exception {
FakeMail mail = FakeMail.builder()
.name("name")
.sender("sender@james.org")
@@ -120,7 +119,7 @@ public class IsMarkedAsSpamTest {
}
@Test
- public void isMarkedAsSpamShouldMatchOnlyRecipientsWithHeaderAndYesValue() throws Exception {
+ void isMarkedAsSpamShouldMatchOnlyRecipientsWithHeaderAndYesValue() throws Exception {
FakeMail mail = FakeMail.builder()
.name("name")
.sender("sender@james.org")
@@ -137,7 +136,7 @@ public class IsMarkedAsSpamTest {
}
@Test
- public void isMarkedAsSpamShouldMatchWhenHeaderAndYesValueInOtherCase() throws Exception {
+ void isMarkedAsSpamShouldMatchWhenHeaderAndYesValueInOtherCase() throws Exception {
FakeMail mail = FakeMail.builder()
.name("name")
.sender("sender@james.org")
diff --git a/server/mailet/mailets/src/test/java/org/apache/james/transport/matchers/IsOverQuotaTest.java b/server/mailet/mailets/src/test/java/org/apache/james/transport/matchers/IsOverQuotaTest.java
index 34b39b0..b9528fb 100644
--- a/server/mailet/mailets/src/test/java/org/apache/james/transport/matchers/IsOverQuotaTest.java
+++ b/server/mailet/mailets/src/test/java/org/apache/james/transport/matchers/IsOverQuotaTest.java
@@ -38,8 +38,8 @@ import org.apache.james.user.api.UsersRepository;
import org.apache.mailet.base.MailAddressFixture;
import org.apache.mailet.base.test.FakeMail;
import org.apache.mailet.base.test.FakeMatcherConfig;
-import org.junit.Before;
-import org.junit.Test;
+import org.junit.jupiter.api.BeforeEach;
+import org.junit.jupiter.api.Test;
public class IsOverQuotaTest {
private IsOverQuota testee;
@@ -47,7 +47,7 @@ public class IsOverQuotaTest {
private DefaultUserQuotaRootResolver quotaRootResolver;
private UsersRepository usersRepository;
- @Before
+ @BeforeEach
public void setUp() throws Exception {
InMemoryIntegrationResources resources = InMemoryIntegrationResources.defaultResources();
@@ -64,7 +64,7 @@ public class IsOverQuotaTest {
}
@Test
- public void matchShouldAcceptMailWhenNoQuota() throws Exception {
+ void matchShouldAcceptMailWhenNoQuota() throws Exception {
FakeMail mail = FakeMail.builder()
.name("name")
.recipient(MailAddressFixture.ANY_AT_JAMES)
@@ -76,7 +76,7 @@ public class IsOverQuotaTest {
}
@Test
- public void matchShouldKeepAddressesWithTooBigSize() throws Exception {
+ void matchShouldKeepAddressesWithTooBigSize() throws Exception {
maxQuotaManager.setGlobalMaxStorage(QuotaSizeLimit.size(100));
FakeMail fakeMail = FakeMail.builder()
@@ -90,7 +90,7 @@ public class IsOverQuotaTest {
}
@Test
- public void matchShouldReturnEmptyAtSizeQuotaLimit() throws Exception {
+ void matchShouldReturnEmptyAtSizeQuotaLimit() throws Exception {
maxQuotaManager.setGlobalMaxStorage(QuotaSizeLimit.size(1000));
FakeMail fakeMail = FakeMail.builder()
@@ -104,7 +104,7 @@ public class IsOverQuotaTest {
}
@Test
- public void matchShouldKeepAddressesWithTooMuchMessages() throws Exception {
+ void matchShouldKeepAddressesWithTooMuchMessages() throws Exception {
maxQuotaManager.setGlobalMaxMessage(QuotaCountLimit.count(0));
FakeMail fakeMail = FakeMail.builder()
@@ -117,7 +117,7 @@ public class IsOverQuotaTest {
}
@Test
- public void matchShouldReturnEmptyOnMessageLimit() throws Exception {
+ void matchShouldReturnEmptyOnMessageLimit() throws Exception {
maxQuotaManager.setGlobalMaxMessage(QuotaCountLimit.count(1));
FakeMail fakeMail = FakeMail.builder()
@@ -130,7 +130,7 @@ public class IsOverQuotaTest {
}
@Test
- public void matchShouldNotIncludeRecipientNotOverQuota() throws Exception {
+ void matchShouldNotIncludeRecipientNotOverQuota() throws Exception {
Username username = Username.of(MailAddressFixture.ANY_AT_JAMES.getLocalPart());
QuotaRoot quotaRoot = quotaRootResolver.getQuotaRoot(MailboxPath.inbox(username));
maxQuotaManager.setMaxStorage(quotaRoot, QuotaSizeLimit.size(100));
@@ -147,7 +147,7 @@ public class IsOverQuotaTest {
}
@Test
- public void matchShouldSupportVirtualHosting() throws Exception {
+ void matchShouldSupportVirtualHosting() throws Exception {
when(usersRepository.getUsername(MailAddressFixture.ANY_AT_JAMES)).thenReturn(Username.of(MailAddressFixture.ANY_AT_JAMES.asString()));
when(usersRepository.getUsername(MailAddressFixture.OTHER_AT_JAMES)).thenReturn(Username.of(MailAddressFixture.OTHER_AT_JAMES.asString()));
Username username = Username.of(MailAddressFixture.ANY_AT_JAMES.asString());
diff --git a/server/mailet/mailets/src/test/java/org/apache/james/transport/matchers/IsSenderInRRTLoopTest.java b/server/mailet/mailets/src/test/java/org/apache/james/transport/matchers/IsSenderInRRTLoopTest.java
index f0ca51d..775be5f 100644
--- a/server/mailet/mailets/src/test/java/org/apache/james/transport/matchers/IsSenderInRRTLoopTest.java
+++ b/server/mailet/mailets/src/test/java/org/apache/james/transport/matchers/IsSenderInRRTLoopTest.java
@@ -35,17 +35,17 @@ import org.apache.james.rrt.api.RecipientRewriteTableConfiguration;
import org.apache.james.rrt.lib.MappingSource;
import org.apache.james.rrt.memory.MemoryRecipientRewriteTable;
import org.apache.mailet.base.test.FakeMail;
-import org.junit.Before;
-import org.junit.Test;
-
-public class IsSenderInRRTLoopTest {
+import org.junit.jupiter.api.BeforeEach;
+import org.junit.jupiter.api.Test;
+class IsSenderInRRTLoopTest {
public static final Domain DOMAIN = Domain.of("domain.tld");
+
private RecipientRewriteTable recipientRewriteTable;
private IsSenderInRRTLoop testee;
- @Before
- public void setUp() throws Exception {
+ @BeforeEach
+ void setUp() throws Exception {
recipientRewriteTable = new MemoryRecipientRewriteTable();
SimpleDomainList domainList = new SimpleDomainList();
domainList.addDomain(DOMAIN);
@@ -56,7 +56,7 @@ public class IsSenderInRRTLoopTest {
}
@Test
- public void matchShouldReturnEmptyWhenSenderHasNoRRT() throws Exception {
+ void matchShouldReturnEmptyWhenSenderHasNoRRT() throws Exception {
Collection<MailAddress> result = testee.match(FakeMail.builder()
.name("name")
.sender(SENDER)
@@ -67,7 +67,7 @@ public class IsSenderInRRTLoopTest {
}
@Test
- public void matchShouldNotFailWhenNoSender() throws Exception {
+ void matchShouldNotFailWhenNoSender() throws Exception {
Collection<MailAddress> result = testee.match(FakeMail.builder()
.name("name")
.recipient(RECIPIENT1)
@@ -77,7 +77,7 @@ public class IsSenderInRRTLoopTest {
}
@Test
- public void matchShouldReturnEmptyWhenNoRRTLoop() throws Exception {
+ void matchShouldReturnEmptyWhenNoRRTLoop() throws Exception {
recipientRewriteTable.addAddressMapping(MappingSource.fromUser(SENDER.getLocalPart(), SENDER.getDomain()), RECIPIENT1.asString());
Collection<MailAddress> result = testee.match(FakeMail.builder()
@@ -90,7 +90,7 @@ public class IsSenderInRRTLoopTest {
}
@Test
- public void matchShouldReturnRecipientsWhenLoop() throws Exception {
+ void matchShouldReturnRecipientsWhenLoop() throws Exception {
recipientRewriteTable.addAddressMapping(MappingSource.fromUser(SENDER.getLocalPart(), SENDER.getDomain()),"recipient1@domain.tld");
recipientRewriteTable.addAddressMapping(MappingSource.fromUser(RECIPIENT1.getLocalPart(), RECIPIENT1.getDomain()), SENDER.asString());
// required overwise the loop is detected upon insertion
@@ -106,7 +106,7 @@ public class IsSenderInRRTLoopTest {
}
@Test
- public void matchShouldReturnEmptyWhenLoopButNoRecipient() throws Exception {
+ void matchShouldReturnEmptyWhenLoopButNoRecipient() throws Exception {
recipientRewriteTable.addAddressMapping(MappingSource.fromUser(SENDER.getLocalPart(), SENDER.getDomain()),"recipient1@domain.tld");
recipientRewriteTable.addAddressMapping(MappingSource.fromUser(RECIPIENT1.getLocalPart(), RECIPIENT1.getDomain()), SENDER.asString());
// required overwise the loop is detected upon insertion
diff --git a/server/mailet/mailets/src/test/java/org/apache/james/transport/matchers/RemoteAddrInNetworkTest.java b/server/mailet/mailets/src/test/java/org/apache/james/transport/matchers/RemoteAddrInNetworkTest.java
index 68007e9..8503be4 100644
--- a/server/mailet/mailets/src/test/java/org/apache/james/transport/matchers/RemoteAddrInNetworkTest.java
+++ b/server/mailet/mailets/src/test/java/org/apache/james/transport/matchers/RemoteAddrInNetworkTest.java
@@ -29,15 +29,15 @@ import org.apache.james.dnsservice.api.DNSService;
import org.apache.james.dnsservice.api.InMemoryDNSService;
import org.apache.mailet.base.test.FakeMail;
import org.apache.mailet.base.test.FakeMatcherConfig;
-import org.junit.Before;
-import org.junit.Test;
+import org.junit.jupiter.api.BeforeEach;
+import org.junit.jupiter.api.Test;
public class RemoteAddrInNetworkTest {
private RemoteAddrInNetwork matcher;
private FakeMail fakeMail;
private MailAddress testRecipient;
- @Before
+ @BeforeEach
public void setup() throws Exception {
DNSService dnsServer = new InMemoryDNSService()
.registerMxRecord("192.168.0.1", "192.168.0.1")
@@ -56,7 +56,7 @@ public class RemoteAddrInNetworkTest {
}
@Test
- public void shouldMatchWhenOnSameNetwork() throws MessagingException {
+ void shouldMatchWhenOnSameNetwork() throws MessagingException {
fakeMail = FakeMail.builder()
.name("name")
.recipient(testRecipient)
@@ -69,7 +69,7 @@ public class RemoteAddrInNetworkTest {
}
@Test
- public void shouldNotMatchWhenOnDifferentNetwork() throws MessagingException {
+ void shouldNotMatchWhenOnDifferentNetwork() throws MessagingException {
fakeMail = FakeMail.builder()
.name("name")
.recipient(testRecipient)
@@ -82,7 +82,7 @@ public class RemoteAddrInNetworkTest {
}
@Test
- public void shouldNotMatchWhenNoCondition() throws MessagingException {
+ void shouldNotMatchWhenNoCondition() throws MessagingException {
FakeMatcherConfig matcherConfig = FakeMatcherConfig.builder()
.matcherName("")
.build();
@@ -101,7 +101,7 @@ public class RemoteAddrInNetworkTest {
}
@Test
- public void shouldNotMatchWhenInvalidAddress() throws MessagingException {
+ void shouldNotMatchWhenInvalidAddress() throws MessagingException {
fakeMail = FakeMail.builder()
.name("name")
.recipient(testRecipient)
diff --git a/server/mailet/mailets/src/test/java/org/apache/james/transport/matchers/RemoteAddrNotInNetworkTest.java b/server/mailet/mailets/src/test/java/org/apache/james/transport/matchers/RemoteAddrNotInNetworkTest.java
index 26db723..34ffd1c 100644
--- a/server/mailet/mailets/src/test/java/org/apache/james/transport/matchers/RemoteAddrNotInNetworkTest.java
+++ b/server/mailet/mailets/src/test/java/org/apache/james/transport/matchers/RemoteAddrNotInNetworkTest.java
@@ -29,17 +29,17 @@ import org.apache.james.dnsservice.api.DNSService;
import org.apache.james.dnsservice.api.InMemoryDNSService;
import org.apache.mailet.base.test.FakeMail;
import org.apache.mailet.base.test.FakeMatcherConfig;
-import org.junit.Before;
-import org.junit.Test;
+import org.junit.jupiter.api.BeforeEach;
+import org.junit.jupiter.api.Test;
-public class RemoteAddrNotInNetworkTest {
+class RemoteAddrNotInNetworkTest {
private RemoteAddrNotInNetwork matcher;
private FakeMail fakeMail;
private MailAddress testRecipient;
private FakeMatcherConfig matcherConfig;
- @Before
- public void setup() throws Exception {
+ @BeforeEach
+ void setup() throws Exception {
DNSService dnsServer = new InMemoryDNSService()
.registerMxRecord("192.168.0.1", "192.168.0.1")
.registerMxRecord("192.168.200.1", "192.168.200.1")
@@ -57,7 +57,7 @@ public class RemoteAddrNotInNetworkTest {
}
@Test
- public void shouldMatchWhenOnDifferentNetwork() throws MessagingException {
+ void shouldMatchWhenOnDifferentNetwork() throws MessagingException {
fakeMail = FakeMail.builder()
.name("name")
.recipient(testRecipient)
@@ -70,7 +70,7 @@ public class RemoteAddrNotInNetworkTest {
}
@Test
- public void shouldNotMatchWhenOnSameNetwork() throws MessagingException {
+ void shouldNotMatchWhenOnSameNetwork() throws MessagingException {
fakeMail = FakeMail.builder()
.name("name")
.recipient(testRecipient)
@@ -83,7 +83,7 @@ public class RemoteAddrNotInNetworkTest {
}
@Test
- public void shouldMatchWhenNoCondition() throws MessagingException {
+ void shouldMatchWhenNoCondition() throws MessagingException {
matcherConfig = FakeMatcherConfig.builder()
.matcherName("")
.build();
@@ -102,7 +102,7 @@ public class RemoteAddrNotInNetworkTest {
}
@Test
- public void shouldMatchWhenInvalidAddress() throws MessagingException {
+ void shouldMatchWhenInvalidAddress() throws MessagingException {
fakeMail = FakeMail.builder()
.name("name")
.recipient(testRecipient)
diff --git a/server/mailet/mailets/src/test/java/org/apache/james/transport/util/RecipientsUtilsTest.java b/server/mailet/mailets/src/test/java/org/apache/james/transport/util/RecipientsUtilsTest.java
index 82a5e5c..384547c 100644
--- a/server/mailet/mailets/src/test/java/org/apache/james/transport/util/RecipientsUtilsTest.java
+++ b/server/mailet/mailets/src/test/java/org/apache/james/transport/util/RecipientsUtilsTest.java
@@ -29,24 +29,23 @@ import org.apache.james.core.builder.MimeMessageBuilder;
import org.apache.james.transport.mailets.redirect.RedirectNotify;
import org.apache.james.transport.mailets.redirect.SpecialAddress;
import org.apache.mailet.base.test.FakeMail;
-import org.junit.Before;
-import org.junit.Test;
+import org.junit.jupiter.api.BeforeEach;
+import org.junit.jupiter.api.Test;
import com.google.common.collect.ImmutableList;
-public class RecipientsUtilsTest {
-
+class RecipientsUtilsTest {
private RedirectNotify mailet;
private RecipientsUtils testee;
- @Before
- public void setup() {
+ @BeforeEach
+ void setup() {
mailet = mock(RedirectNotify.class);
testee = RecipientsUtils.from(mailet);
}
@Test
- public void getRecipientsShouldReturnEmptyWhenMailetRecipientsIsEmpty() throws Exception {
+ void getRecipientsShouldReturnEmptyWhenMailetRecipientsIsEmpty() throws Exception {
when(mailet.getRecipients())
.thenReturn(ImmutableList.<MailAddress>of());
@@ -58,7 +57,7 @@ public class RecipientsUtilsTest {
}
@Test
- public void getRecipientsShouldReturnEmptyWhenMailetRecipientsContainsOnlyUnaltered() throws Exception {
+ void getRecipientsShouldReturnEmptyWhenMailetRecipientsContainsOnlyUnaltered() throws Exception {
when(mailet.getRecipients())
.thenReturn(ImmutableList.of(SpecialAddress.UNALTERED));
@@ -70,7 +69,7 @@ public class RecipientsUtilsTest {
}
@Test
- public void getRecipientsShouldReturnEmptyWhenMailetRecipientsContainsOnlyRecipients() throws Exception {
+ void getRecipientsShouldReturnEmptyWhenMailetRecipientsContainsOnlyRecipients() throws Exception {
when(mailet.getRecipients())
.thenReturn(ImmutableList.of(SpecialAddress.RECIPIENTS));
@@ -82,7 +81,7 @@ public class RecipientsUtilsTest {
}
@Test
- public void getRecipientsShouldReturnRecipientsWhenMailetRecipientsAreCommon() throws Exception {
+ void getRecipientsShouldReturnRecipientsWhenMailetRecipientsAreCommon() throws Exception {
ImmutableList<MailAddress> expectedRecipients = ImmutableList.of(new MailAddress("test", "james.org"), new MailAddress("test2", "james.org"));
when(mailet.getRecipients())
.thenReturn(expectedRecipients);
@@ -95,7 +94,7 @@ public class RecipientsUtilsTest {
}
@Test
- public void getRecipientsShouldReturnAddressesFromOriginalMailWhenMailetRecipientsAreSpecialAddresses() throws Exception {
+ void getRecipientsShouldReturnAddressesFromOriginalMailWhenMailetRecipientsAreSpecialAddresses() throws Exception {
when(mailet.getRecipients())
.thenReturn(ImmutableList.of(SpecialAddress.FROM, SpecialAddress.TO));
diff --git a/server/mailet/mailets/src/test/java/org/apache/james/transport/util/ReplyToUtilsTest.java b/server/mailet/mailets/src/test/java/org/apache/james/transport/util/ReplyToUtilsTest.java
index 7527521..e769849 100644
--- a/server/mailet/mailets/src/test/java/org/apache/james/transport/util/ReplyToUtilsTest.java
+++ b/server/mailet/mailets/src/test/java/org/apache/james/transport/util/ReplyToUtilsTest.java
@@ -25,12 +25,11 @@ import java.util.Optional;
import org.apache.james.core.MailAddress;
import org.apache.james.transport.mailets.redirect.SpecialAddress;
import org.apache.mailet.base.test.FakeMail;
-import org.junit.Test;
-
-public class ReplyToUtilsTest {
+import org.junit.jupiter.api.Test;
+class ReplyToUtilsTest {
@Test
- public void getReplyToShouldReturnAbsentWhenReplyToIsNull() throws Exception {
+ void getReplyToShouldReturnAbsentWhenReplyToIsNull() throws Exception {
ReplyToUtils testee = ReplyToUtils.from((MailAddress) null);
FakeMail fakeMail = FakeMail.defaultFakeMail();
@@ -41,7 +40,7 @@ public class ReplyToUtilsTest {
}
@Test
- public void getReplyToShouldReturnNullWhenReplyToEqualsToUnaltered() throws Exception {
+ void getReplyToShouldReturnNullWhenReplyToEqualsToUnaltered() throws Exception {
ReplyToUtils testee = ReplyToUtils.from(SpecialAddress.UNALTERED);
FakeMail fakeMail = FakeMail.defaultFakeMail();
@@ -52,7 +51,7 @@ public class ReplyToUtilsTest {
}
@Test
- public void getReplyToShouldReturnSenderWhenReplyToIsCommon() throws Exception {
+ void getReplyToShouldReturnSenderWhenReplyToIsCommon() throws Exception {
MailAddress mailAddress = new MailAddress("test", "james.org");
ReplyToUtils testee = ReplyToUtils.from(mailAddress);
diff --git a/server/mailet/mailets/src/test/java/org/apache/james/transport/util/SenderUtilsTest.java b/server/mailet/mailets/src/test/java/org/apache/james/transport/util/SenderUtilsTest.java
index cde6b4e..c0f2dc5 100644
--- a/server/mailet/mailets/src/test/java/org/apache/james/transport/util/SenderUtilsTest.java
+++ b/server/mailet/mailets/src/test/java/org/apache/james/transport/util/SenderUtilsTest.java
@@ -25,12 +25,11 @@ import java.util.Optional;
import org.apache.james.core.MailAddress;
import org.apache.james.transport.mailets.redirect.SpecialAddress;
import org.apache.mailet.base.test.FakeMail;
-import org.junit.Test;
-
-public class SenderUtilsTest {
+import org.junit.jupiter.api.Test;
+class SenderUtilsTest {
@Test
- public void getSenderShouldReturnAbsentWhenSenderIsAbsent() throws Exception {
+ void getSenderShouldReturnAbsentWhenSenderIsAbsent() throws Exception {
SenderUtils testee = SenderUtils.from(Optional.empty());
FakeMail fakeMail = FakeMail.defaultFakeMail();
@@ -41,7 +40,7 @@ public class SenderUtilsTest {
}
@Test
- public void getSenderShouldReturnAbsentWhenSenderEqualsToUnaltered() throws Exception {
+ void getSenderShouldReturnAbsentWhenSenderEqualsToUnaltered() throws Exception {
SenderUtils testee = SenderUtils.from(Optional.of(SpecialAddress.UNALTERED));
FakeMail fakeMail = FakeMail.defaultFakeMail();
@@ -52,7 +51,7 @@ public class SenderUtilsTest {
}
@Test
- public void getSenderShouldReturnAbsentWhenSenderEqualsToSender() throws Exception {
+ void getSenderShouldReturnAbsentWhenSenderEqualsToSender() throws Exception {
SenderUtils testee = SenderUtils.from(Optional.of(SpecialAddress.SENDER));
FakeMail fakeMail = FakeMail.defaultFakeMail();
@@ -63,7 +62,7 @@ public class SenderUtilsTest {
}
@Test
- public void getSenderShouldReturnSenderWhenSenderIsCommon() throws Exception {
+ void getSenderShouldReturnSenderWhenSenderIsCommon() throws Exception {
MailAddress expectedMailAddress = new MailAddress("sender", "james.org");
SenderUtils testee = SenderUtils.from(Optional.of(expectedMailAddress));
diff --git a/server/mailet/mailets/src/test/java/org/apache/james/transport/util/SizeUtilsTest.java b/server/mailet/mailets/src/test/java/org/apache/james/transport/util/SizeUtilsTest.java
index 3ca8700..b6a3644 100644
--- a/server/mailet/mailets/src/test/java/org/apache/james/transport/util/SizeUtilsTest.java
+++ b/server/mailet/mailets/src/test/java/org/apache/james/transport/util/SizeUtilsTest.java
@@ -22,52 +22,51 @@ package org.apache.james.transport.util;
import static org.apache.james.transport.util.SizeUtils.humanReadableSize;
import static org.assertj.core.api.Assertions.assertThat;
-import org.junit.Test;
-
-public class SizeUtilsTest {
+import org.junit.jupiter.api.Test;
+class SizeUtilsTest {
@Test
- public void humanSizeShouldAddByteUnitForSmallSize() {
+ void humanSizeShouldAddByteUnitForSmallSize() {
assertThat(humanReadableSize(1000)).isEqualTo("1000 B");
}
@Test
- public void humanSizeShouldScaleToKilobyteWhenSizeIsBetweenKilobyteAndMegabyte() {
+ void humanSizeShouldScaleToKilobyteWhenSizeIsBetweenKilobyteAndMegabyte() {
assertThat(humanReadableSize(1024)).isEqualTo("1 KiB");
}
@Test
- public void humanSizeShouldWorkWithZero() {
+ void humanSizeShouldWorkWithZero() {
assertThat(humanReadableSize(0)).isEqualTo("0 B");
}
@Test
- public void humanSizeShouldWorkWithNegative() {
+ void humanSizeShouldWorkWithNegative() {
assertThat(humanReadableSize(-1)).isEqualTo("-1 B");
}
@Test
- public void humanSizeShouldScaleToMegabyteWhenSizeIsBetweenMegabyteAndGigabyte() {
+ void humanSizeShouldScaleToMegabyteWhenSizeIsBetweenMegabyteAndGigabyte() {
assertThat(humanReadableSize(1024 * 1024)).isEqualTo("1 MiB");
}
@Test
- public void humanSizeShouldScaleToGigabyteWhenSizeIsBiggerThanGigabyte() {
+ void humanSizeShouldScaleToGigabyteWhenSizeIsBiggerThanGigabyte() {
assertThat(humanReadableSize(1024 * 1024 * 1024)).isEqualTo("1 GiB");
}
@Test
- public void humanSizeShouldCorrectlyCountKilobyte() {
+ void humanSizeShouldCorrectlyCountKilobyte() {
assertThat(humanReadableSize(42 * 1024)).isEqualTo("42 KiB");
}
@Test
- public void humanSizeShouldNotUseMoreThanOneDigitAfterComma() {
+ void humanSizeShouldNotUseMoreThanOneDigitAfterComma() {
assertThat(humanReadableSize(1.42 * 1024)).isEqualTo("1.4 KiB");
}
@Test
- public void humanSizeShouldNotUseMoreThanOneDigitAfterCommaAndRoundUpCorrectly() {
+ void humanSizeShouldNotUseMoreThanOneDigitAfterCommaAndRoundUpCorrectly() {
assertThat(humanReadableSize(1.48 * 1024)).isEqualTo("1.5 KiB");
}
}
\ No newline at end of file
diff --git a/server/mailet/mailets/src/test/java/org/apache/james/transport/util/TosUtilsTest.java b/server/mailet/mailets/src/test/java/org/apache/james/transport/util/TosUtilsTest.java
index 66039c4..c1d3454 100644
--- a/server/mailet/mailets/src/test/java/org/apache/james/transport/util/TosUtilsTest.java
+++ b/server/mailet/mailets/src/test/java/org/apache/james/transport/util/TosUtilsTest.java
@@ -31,24 +31,23 @@ import org.apache.james.core.builder.MimeMessageBuilder;
import org.apache.james.transport.mailets.redirect.RedirectNotify;
import org.apache.james.transport.mailets.redirect.SpecialAddress;
import org.apache.mailet.base.test.FakeMail;
-import org.junit.Before;
-import org.junit.Test;
+import org.junit.jupiter.api.BeforeEach;
+import org.junit.jupiter.api.Test;
import com.google.common.collect.ImmutableList;
-public class TosUtilsTest {
-
+class TosUtilsTest {
private RedirectNotify mailet;
private TosUtils testee;
- @Before
- public void setup() {
+ @BeforeEach
+ void setup() {
mailet = mock(RedirectNotify.class);
testee = TosUtils.from(mailet);
}
@Test
- public void getToShouldReturnEmptyWhenMailetToIsEmpty() throws Exception {
+ void getToShouldReturnEmptyWhenMailetToIsEmpty() throws Exception {
when(mailet.getTo())
.thenReturn(ImmutableList.<InternetAddress>of());
@@ -60,7 +59,7 @@ public class TosUtilsTest {
}
@Test
- public void getToShouldReturnEmptyWhenMailetToContainsOnlyUnaltered() throws Exception {
+ void getToShouldReturnEmptyWhenMailetToContainsOnlyUnaltered() throws Exception {
when(mailet.getTo())
.thenReturn(ImmutableList.of(SpecialAddress.UNALTERED.toInternetAddress()));
@@ -72,7 +71,7 @@ public class TosUtilsTest {
}
@Test
- public void getToShouldReturnEmptyWhenMailetToContainsOnlyRecipients() throws Exception {
+ void getToShouldReturnEmptyWhenMailetToContainsOnlyRecipients() throws Exception {
when(mailet.getTo())
.thenReturn(ImmutableList.of(SpecialAddress.RECIPIENTS.toInternetAddress()));
@@ -84,7 +83,7 @@ public class TosUtilsTest {
}
@Test
- public void getToShouldReturnToWhenMailetToAreCommon() throws Exception {
+ void getToShouldReturnToWhenMailetToAreCommon() throws Exception {
MailAddress mailAddress = new MailAddress("test", "james.org");
MailAddress mailAddress2 = new MailAddress("test2", "james.org");
when(mailet.getTo())
@@ -99,7 +98,7 @@ public class TosUtilsTest {
}
@Test
- public void getToShouldReturnAddressesFromOriginalMailWhenMailetToAreSpecialAddresses() throws Exception {
+ void getToShouldReturnAddressesFromOriginalMailWhenMailetToAreSpecialAddresses() throws Exception {
when(mailet.getTo())
.thenReturn(ImmutableList.of(SpecialAddress.FROM.toInternetAddress(), SpecialAddress.TO.toInternetAddress()));
---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@james.apache.org
For additional commands, e-mail: notifications-help@james.apache.org