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 2020/12/07 03:57:32 UTC
[james-project] 02/13: JAMES-2543 upgrades SMTP protocol tests to
junit 5
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 9f1bf0c234d1a2449ab57eb37f5088561e38fb07
Author: Jean Helou <jh...@codamens.fr>
AuthorDate: Thu Dec 3 23:21:30 2020 +0100
JAMES-2543 upgrades SMTP protocol tests to junit 5
---
.../protocols/lmtp/AbstractLMTPServerTest.java | 16 ++++----
.../protocols/lmtp/netty/NettyLMTPSServerTest.java | 8 ++--
.../protocols/lmtp/netty/NettyLMTPServerTest.java | 8 ++--
.../protocols/smtp/AbstractSMTPServerTest.java | 48 +++++++++++-----------
.../protocols/smtp/SMTPStartTlsResponseTest.java | 5 ++-
.../smtp/core/fastfail/DNSRBLHandlerTest.java | 20 ++++-----
.../smtp/core/fastfail/MaxRcptHandlerTest.java | 6 +--
.../core/fastfail/MaxUnknownCmdHandlerTest.java | 4 +-
.../fastfail/ResolvableEhloHeloHandlerTest.java | 10 ++---
.../smtp/core/fastfail/SpamTrapHandlerTest.java | 4 +-
.../fastfail/ValidSenderDomainHandlerTest.java | 6 +--
.../james/protocols/smtp/hook/HookResultTest.java | 4 +-
.../protocols/smtp/netty/NettySMTPSServerTest.java | 12 +++---
.../protocols/smtp/netty/NettySMTPServerTest.java | 12 +++---
.../smtp/netty/NettyStartTlsSMTPServerTest.java | 32 +++++++--------
15 files changed, 98 insertions(+), 97 deletions(-)
diff --git a/protocols/lmtp/src/test/java/org/apache/james/protocols/lmtp/AbstractLMTPServerTest.java b/protocols/lmtp/src/test/java/org/apache/james/protocols/lmtp/AbstractLMTPServerTest.java
index f717fda..50820a1 100644
--- a/protocols/lmtp/src/test/java/org/apache/james/protocols/lmtp/AbstractLMTPServerTest.java
+++ b/protocols/lmtp/src/test/java/org/apache/james/protocols/lmtp/AbstractLMTPServerTest.java
@@ -45,7 +45,7 @@ import org.apache.james.protocols.smtp.hook.HookResult;
import org.apache.james.protocols.smtp.hook.MessageHook;
import org.apache.james.protocols.smtp.utils.TestMessageHook;
import org.junit.Ignore;
-import org.junit.Test;
+import org.junit.jupiter.api.Test;
public abstract class AbstractLMTPServerTest extends AbstractSMTPServerTest {
@@ -68,18 +68,18 @@ public abstract class AbstractLMTPServerTest extends AbstractSMTPServerTest {
@Ignore("LMTP can't handle the queue")
@Override
- public void testDeliveryWith4SimultaneousThreads() {
+ protected void testDeliveryWith4SimultaneousThreads() {
}
@Ignore("Disable")
@Override
- public void testInvalidNoBracketsEnformance() throws Exception {
+ protected void testInvalidNoBracketsEnformance() throws Exception {
}
@Ignore("Disable")
@Override
- public void testHeloEnforcement() throws Exception {
+ protected void testHeloEnforcement() throws Exception {
}
@@ -90,7 +90,7 @@ public abstract class AbstractLMTPServerTest extends AbstractSMTPServerTest {
@Override
- public void testMailWithoutBrackets() throws Exception {
+ protected void testMailWithoutBrackets() throws Exception {
TestMessageHook hook = new TestMessageHook();
ProtocolServer server = null;
try {
@@ -125,7 +125,7 @@ public abstract class AbstractLMTPServerTest extends AbstractSMTPServerTest {
@Override
- public void testRcptWithoutBrackets() throws Exception {
+ protected void testRcptWithoutBrackets() throws Exception {
TestMessageHook hook = new TestMessageHook();
ProtocolServer server = null;
try {
@@ -161,7 +161,7 @@ public abstract class AbstractLMTPServerTest extends AbstractSMTPServerTest {
@Test
- public void testEhloNotSupported() throws Exception {
+ protected void testEhloNotSupported() throws Exception {
TestMessageHook hook = new TestMessageHook();
ProtocolServer server = null;
try {
@@ -191,7 +191,7 @@ public abstract class AbstractLMTPServerTest extends AbstractSMTPServerTest {
}
@Test
- public void testDeliveryHook() throws Exception {
+ void testDeliveryHook() throws Exception {
TestDeliverHook deliverHook = new TestDeliverHook();
ProtocolServer server = null;
diff --git a/protocols/lmtp/src/test/java/org/apache/james/protocols/lmtp/netty/NettyLMTPSServerTest.java b/protocols/lmtp/src/test/java/org/apache/james/protocols/lmtp/netty/NettyLMTPSServerTest.java
index 5fbf322..95e58b3 100644
--- a/protocols/lmtp/src/test/java/org/apache/james/protocols/lmtp/netty/NettyLMTPSServerTest.java
+++ b/protocols/lmtp/src/test/java/org/apache/james/protocols/lmtp/netty/NettyLMTPSServerTest.java
@@ -9,8 +9,8 @@ import org.apache.james.protocols.api.utils.BogusSslContextFactory;
import org.apache.james.protocols.lmtp.AbstractLMTPSServerTest;
import org.apache.james.protocols.netty.NettyServer;
import org.jboss.netty.util.HashedWheelTimer;
-import org.junit.After;
-import org.junit.Before;
+import org.junit.jupiter.api.AfterEach;
+import org.junit.jupiter.api.BeforeEach;
public class NettyLMTPSServerTest extends AbstractLMTPSServerTest {
@@ -19,12 +19,12 @@ public class NettyLMTPSServerTest extends AbstractLMTPSServerTest {
private HashedWheelTimer hashedWheelTimer;
- @Before
+ @BeforeEach
public void setup() {
hashedWheelTimer = new HashedWheelTimer();
}
- @After
+ @AfterEach
public void teardown() {
hashedWheelTimer.stop();
}
diff --git a/protocols/lmtp/src/test/java/org/apache/james/protocols/lmtp/netty/NettyLMTPServerTest.java b/protocols/lmtp/src/test/java/org/apache/james/protocols/lmtp/netty/NettyLMTPServerTest.java
index 30e7716..8a75e71 100644
--- a/protocols/lmtp/src/test/java/org/apache/james/protocols/lmtp/netty/NettyLMTPServerTest.java
+++ b/protocols/lmtp/src/test/java/org/apache/james/protocols/lmtp/netty/NettyLMTPServerTest.java
@@ -25,8 +25,8 @@ import org.apache.james.protocols.api.ProtocolServer;
import org.apache.james.protocols.lmtp.AbstractLMTPServerTest;
import org.apache.james.protocols.netty.NettyServer;
import org.jboss.netty.util.HashedWheelTimer;
-import org.junit.After;
-import org.junit.Before;
+import org.junit.jupiter.api.AfterEach;
+import org.junit.jupiter.api.BeforeEach;
public class NettyLMTPServerTest extends AbstractLMTPServerTest {
@@ -35,12 +35,12 @@ public class NettyLMTPServerTest extends AbstractLMTPServerTest {
private HashedWheelTimer hashedWheelTimer;
- @Before
+ @BeforeEach
public void setup() {
hashedWheelTimer = new HashedWheelTimer();
}
- @After
+ @AfterEach
public void teardown() {
hashedWheelTimer.stop();
}
diff --git a/protocols/smtp/src/test/java/org/apache/james/protocols/smtp/AbstractSMTPServerTest.java b/protocols/smtp/src/test/java/org/apache/james/protocols/smtp/AbstractSMTPServerTest.java
index 97203ec..71d8979 100644
--- a/protocols/smtp/src/test/java/org/apache/james/protocols/smtp/AbstractSMTPServerTest.java
+++ b/protocols/smtp/src/test/java/org/apache/james/protocols/smtp/AbstractSMTPServerTest.java
@@ -51,7 +51,7 @@ import org.apache.james.protocols.smtp.hook.MessageHook;
import org.apache.james.protocols.smtp.hook.RcptHook;
import org.apache.james.protocols.smtp.utils.TestMessageHook;
import org.apache.james.util.concurrency.ConcurrentTestRunner;
-import org.junit.Test;
+import org.junit.jupiter.api.Test;
import com.google.common.io.CharStreams;
@@ -63,7 +63,7 @@ public abstract class AbstractSMTPServerTest {
protected static final String RCPT2 = "rpct2@domain";
@Test
- public void testSimpleDelivery() throws Exception {
+ void testSimpleDelivery() throws Exception {
TestMessageHook hook = new TestMessageHook();
ProtocolServer server = null;
try {
@@ -90,7 +90,7 @@ public abstract class AbstractSMTPServerTest {
}
@Test
- public void testDeliveryWith4SimultaneousThreads() throws Exception {
+ protected void testDeliveryWith4SimultaneousThreads() throws Exception {
TestMessageHook hook = new TestMessageHook();
ProtocolServer server = null;
try {
@@ -155,7 +155,7 @@ public abstract class AbstractSMTPServerTest {
}
@Test
- public void testStartTlsNotSupported() throws Exception {
+ void testStartTlsNotSupported() throws Exception {
TestMessageHook hook = new TestMessageHook();
ProtocolServer server = null;
@@ -187,7 +187,7 @@ public abstract class AbstractSMTPServerTest {
}
@Test
- public void testUnknownCommand() throws Exception {
+ void testUnknownCommand() throws Exception {
TestMessageHook hook = new TestMessageHook();
ProtocolServer server = null;
@@ -219,7 +219,7 @@ public abstract class AbstractSMTPServerTest {
}
@Test
- public void testNoop() throws Exception {
+ void testNoop() throws Exception {
TestMessageHook hook = new TestMessageHook();
ProtocolServer server = null;
@@ -252,7 +252,7 @@ public abstract class AbstractSMTPServerTest {
@Test
- public void testMailWithoutBrackets() throws Exception {
+ protected void testMailWithoutBrackets() throws Exception {
TestMessageHook hook = new TestMessageHook();
ProtocolServer server = null;
@@ -294,7 +294,7 @@ public abstract class AbstractSMTPServerTest {
@Test
- public void testInvalidHelo() throws Exception {
+ void testInvalidHelo() throws Exception {
TestMessageHook hook = new TestMessageHook();
ProtocolServer server = null;
@@ -327,7 +327,7 @@ public abstract class AbstractSMTPServerTest {
@Test
- public void testRcptWithoutBrackets() throws Exception {
+ protected void testRcptWithoutBrackets() throws Exception {
TestMessageHook hook = new TestMessageHook();
ProtocolServer server = null;
@@ -368,7 +368,7 @@ public abstract class AbstractSMTPServerTest {
@Test
- public void testInvalidNoBracketsEnformance() throws Exception {
+ protected void testInvalidNoBracketsEnformance() throws Exception {
TestMessageHook hook = new TestMessageHook();
ProtocolServer server = null;
@@ -411,7 +411,7 @@ public abstract class AbstractSMTPServerTest {
@Test
- public void testHeloEnforcement() throws Exception {
+ protected void testHeloEnforcement() throws Exception {
TestMessageHook hook = new TestMessageHook();
ProtocolServer server = null;
@@ -445,7 +445,7 @@ public abstract class AbstractSMTPServerTest {
}
@Test
- public void testHeloEnforcementDisabled() throws Exception {
+ protected void testHeloEnforcementDisabled() throws Exception {
TestMessageHook hook = new TestMessageHook();
ProtocolServer server = null;
@@ -482,7 +482,7 @@ public abstract class AbstractSMTPServerTest {
@Test
- public void testHeloHookPermanentError() throws Exception {
+ void testHeloHookPermanentError() throws Exception {
HeloHook hook = (session, helo) -> HookResult.DENY;
ProtocolServer server = null;
@@ -514,7 +514,7 @@ public abstract class AbstractSMTPServerTest {
@Test
- public void testHeloHookTempraryError() throws Exception {
+ void testHeloHookTempraryError() throws Exception {
HeloHook hook = (session, helo) -> HookResult.DENYSOFT;
ProtocolServer server = null;
@@ -545,7 +545,7 @@ public abstract class AbstractSMTPServerTest {
}
@Test
- public void testMailHookPermanentError() throws Exception {
+ void testMailHookPermanentError() throws Exception {
MailHook hook = new MailHook() {
@Override
public HookResult doMail(SMTPSession session, MaybeSender sender) {
@@ -584,7 +584,7 @@ public abstract class AbstractSMTPServerTest {
}
@Test
- public void testMailHookTemporaryError() throws Exception {
+ void testMailHookTemporaryError() throws Exception {
MailHook hook = new MailHook() {
@Override
public HookResult doMail(SMTPSession session, MaybeSender sender) {
@@ -624,7 +624,7 @@ public abstract class AbstractSMTPServerTest {
@Test
- public void testRcptHookPermanentError() throws Exception {
+ void testRcptHookPermanentError() throws Exception {
RcptHook hook = new RcptHook() {
@Override
public HookResult doRcpt(SMTPSession session, MaybeSender sender, MailAddress rcpt) {
@@ -677,7 +677,7 @@ public abstract class AbstractSMTPServerTest {
@Test
- public void testRcptHookTemporaryError() throws Exception {
+ void testRcptHookTemporaryError() throws Exception {
RcptHook hook = new RcptHook() {
@Override
public HookResult doRcpt(SMTPSession session, MaybeSender sender, MailAddress rcpt) {
@@ -728,7 +728,7 @@ public abstract class AbstractSMTPServerTest {
}
@Test
- public void testNullSender() throws Exception {
+ void testNullSender() throws Exception {
ProtocolServer server = null;
try {
server = createServer(createProtocol());
@@ -763,7 +763,7 @@ public abstract class AbstractSMTPServerTest {
}
@Test
- public void testMessageHookPermanentError() throws Exception {
+ void testMessageHookPermanentError() throws Exception {
TestMessageHook testHook = new TestMessageHook();
MessageHook hook = (session, mail) -> HookResult.DENY;
@@ -809,7 +809,7 @@ public abstract class AbstractSMTPServerTest {
@Test
- public void testMessageHookTemporaryError() throws Exception {
+ void testMessageHookTemporaryError() throws Exception {
TestMessageHook testHook = new TestMessageHook();
MessageHook hook = (session, mail) -> HookResult.DENYSOFT;
@@ -856,7 +856,7 @@ public abstract class AbstractSMTPServerTest {
@Test
- public void testConnectHandlerPermananet() throws Exception {
+ void testConnectHandlerPermananet() throws Exception {
ConnectHandler<SMTPSession> connectHandler = session -> new SMTPResponse("554", "Bye Bye");
ProtocolServer server = null;
@@ -883,7 +883,7 @@ public abstract class AbstractSMTPServerTest {
@Test
- public void testConnectHandlerTemporary() throws Exception {
+ void testConnectHandlerTemporary() throws Exception {
ConnectHandler<SMTPSession> connectHandler = session -> new SMTPResponse("451", "Bye Bye");
ProtocolServer server = null;
@@ -908,7 +908,7 @@ public abstract class AbstractSMTPServerTest {
}
@Test
- public void testDisconnectHandler() throws Exception {
+ void testDisconnectHandler() throws Exception {
final AtomicBoolean called = new AtomicBoolean(false);
DisconnectHandler<SMTPSession> handler = session -> called.set(true);
diff --git a/protocols/smtp/src/test/java/org/apache/james/protocols/smtp/SMTPStartTlsResponseTest.java b/protocols/smtp/src/test/java/org/apache/james/protocols/smtp/SMTPStartTlsResponseTest.java
index 112a338..7306dc5 100644
--- a/protocols/smtp/src/test/java/org/apache/james/protocols/smtp/SMTPStartTlsResponseTest.java
+++ b/protocols/smtp/src/test/java/org/apache/james/protocols/smtp/SMTPStartTlsResponseTest.java
@@ -22,7 +22,8 @@ package org.apache.james.protocols.smtp;
import static org.assertj.core.api.Assertions.assertThat;
import org.apache.james.protocols.api.StartTlsResponse;
-import org.junit.Test;
+import org.junit.jupiter.api.Test;
+
public class SMTPStartTlsResponseTest {
@@ -30,7 +31,7 @@ public class SMTPStartTlsResponseTest {
* Test for PROTOCOLS-89
*/
@Test
- public void testImmutable() {
+ void testImmutable() {
SMTPStartTlsResponse response = new SMTPStartTlsResponse("554", "Reject");
assertThat(response).isInstanceOf(StartTlsResponse.class);
assertThat(response.immutable()).isInstanceOf(StartTlsResponse.class);
diff --git a/protocols/smtp/src/test/java/org/apache/james/protocols/smtp/core/fastfail/DNSRBLHandlerTest.java b/protocols/smtp/src/test/java/org/apache/james/protocols/smtp/core/fastfail/DNSRBLHandlerTest.java
index 2265aad..a0b48b6 100644
--- a/protocols/smtp/src/test/java/org/apache/james/protocols/smtp/core/fastfail/DNSRBLHandlerTest.java
+++ b/protocols/smtp/src/test/java/org/apache/james/protocols/smtp/core/fastfail/DNSRBLHandlerTest.java
@@ -38,8 +38,8 @@ import org.apache.james.core.MaybeSender;
import org.apache.james.protocols.api.ProtocolSession.State;
import org.apache.james.protocols.smtp.SMTPSession;
import org.apache.james.protocols.smtp.utils.BaseFakeSMTPSession;
-import org.junit.Before;
-import org.junit.Test;
+import org.junit.jupiter.api.BeforeEach;
+import org.junit.jupiter.api.Test;
import com.google.common.base.Preconditions;
@@ -51,8 +51,8 @@ public class DNSRBLHandlerTest {
private boolean relaying = false;
- @Before
- public void setUp() throws Exception {
+ @BeforeEach
+ void setUp() throws Exception {
setRelayingAllowed(false);
}
@@ -184,7 +184,7 @@ public class DNSRBLHandlerTest {
// ip is blacklisted and has txt details
@Test
- public void testBlackListedTextPresent() throws Exception {
+ void testBlackListedTextPresent() throws Exception {
DNSRBLHandler rbl = createHandler();
setupMockedSMTPSession(new MailAddress("any@domain"));
@@ -198,7 +198,7 @@ public class DNSRBLHandlerTest {
// ip is blacklisted and has txt details but we don'T want to retrieve the txt record
@Test
- public void testGetNoDetail() throws Exception {
+ void testGetNoDetail() throws Exception {
DNSRBLHandler rbl = createHandler();
setupMockedSMTPSession(new MailAddress("any@domain"));
@@ -211,7 +211,7 @@ public class DNSRBLHandlerTest {
// ip is allowed to relay
@Test
- public void testRelayAllowed() throws Exception {
+ void testRelayAllowed() throws Exception {
DNSRBLHandler rbl = createHandler();
setRelayingAllowed(true);
setupMockedSMTPSession(new MailAddress("any@domain"));
@@ -225,7 +225,7 @@ public class DNSRBLHandlerTest {
// ip not on blacklist
@Test
- public void testNotBlackListed() throws Exception {
+ void testNotBlackListed() throws Exception {
DNSRBLHandler rbl = createHandler();
setRemoteIp("192.168.0.1");
@@ -240,7 +240,7 @@ public class DNSRBLHandlerTest {
// ip on blacklist without txt details
@Test
- public void testBlackListedNoTxt() throws Exception {
+ void testBlackListedNoTxt() throws Exception {
DNSRBLHandler rbl = createHandler();
setRemoteIp("127.0.0.3");
@@ -255,7 +255,7 @@ public class DNSRBLHandlerTest {
// ip on whitelist
@Test
- public void testWhiteListed() throws Exception {
+ void testWhiteListed() throws Exception {
DNSRBLHandler rbl = createHandler();
setRemoteIp("127.0.0.2");
diff --git a/protocols/smtp/src/test/java/org/apache/james/protocols/smtp/core/fastfail/MaxRcptHandlerTest.java b/protocols/smtp/src/test/java/org/apache/james/protocols/smtp/core/fastfail/MaxRcptHandlerTest.java
index 72ee259..b195a21 100644
--- a/protocols/smtp/src/test/java/org/apache/james/protocols/smtp/core/fastfail/MaxRcptHandlerTest.java
+++ b/protocols/smtp/src/test/java/org/apache/james/protocols/smtp/core/fastfail/MaxRcptHandlerTest.java
@@ -29,7 +29,7 @@ import org.apache.james.core.MaybeSender;
import org.apache.james.protocols.smtp.SMTPSession;
import org.apache.james.protocols.smtp.hook.HookReturnCode;
import org.apache.james.protocols.smtp.utils.BaseFakeSMTPSession;
-import org.junit.Test;
+import org.junit.jupiter.api.Test;
public class MaxRcptHandlerTest {
@@ -56,7 +56,7 @@ public class MaxRcptHandlerTest {
}
@Test
- public void testRejectMaxRcpt() throws Exception {
+ void testRejectMaxRcpt() throws Exception {
SMTPSession session = setupMockedSession(3);
MaxRcptHandler handler = new MaxRcptHandler();
@@ -68,7 +68,7 @@ public class MaxRcptHandlerTest {
@Test
- public void testNotRejectMaxRcpt() throws Exception {
+ void testNotRejectMaxRcpt() throws Exception {
SMTPSession session = setupMockedSession(3);
MaxRcptHandler handler = new MaxRcptHandler();
diff --git a/protocols/smtp/src/test/java/org/apache/james/protocols/smtp/core/fastfail/MaxUnknownCmdHandlerTest.java b/protocols/smtp/src/test/java/org/apache/james/protocols/smtp/core/fastfail/MaxUnknownCmdHandlerTest.java
index 98f9412..e6be609 100644
--- a/protocols/smtp/src/test/java/org/apache/james/protocols/smtp/core/fastfail/MaxUnknownCmdHandlerTest.java
+++ b/protocols/smtp/src/test/java/org/apache/james/protocols/smtp/core/fastfail/MaxUnknownCmdHandlerTest.java
@@ -29,7 +29,7 @@ import java.util.Optional;
import org.apache.james.protocols.smtp.SMTPSession;
import org.apache.james.protocols.smtp.hook.HookReturnCode;
import org.apache.james.protocols.smtp.utils.BaseFakeSMTPSession;
-import org.junit.Test;
+import org.junit.jupiter.api.Test;
import com.google.common.base.Preconditions;
@@ -37,7 +37,7 @@ public class MaxUnknownCmdHandlerTest {
@Test
- public void testRejectAndClose() throws Exception {
+ void testRejectAndClose() throws Exception {
SMTPSession session = new BaseFakeSMTPSession() {
private final HashMap<AttachmentKey<?>, Object> map = new HashMap<>();
diff --git a/protocols/smtp/src/test/java/org/apache/james/protocols/smtp/core/fastfail/ResolvableEhloHeloHandlerTest.java b/protocols/smtp/src/test/java/org/apache/james/protocols/smtp/core/fastfail/ResolvableEhloHeloHandlerTest.java
index cf2052b..c53184a 100644
--- a/protocols/smtp/src/test/java/org/apache/james/protocols/smtp/core/fastfail/ResolvableEhloHeloHandlerTest.java
+++ b/protocols/smtp/src/test/java/org/apache/james/protocols/smtp/core/fastfail/ResolvableEhloHeloHandlerTest.java
@@ -35,7 +35,7 @@ import org.apache.james.core.Username;
import org.apache.james.protocols.smtp.SMTPSession;
import org.apache.james.protocols.smtp.hook.HookReturnCode;
import org.apache.james.protocols.smtp.utils.BaseFakeSMTPSession;
-import org.junit.Test;
+import org.junit.jupiter.api.Test;
import com.google.common.base.Preconditions;
@@ -129,7 +129,7 @@ public class ResolvableEhloHeloHandlerTest {
}
@Test
- public void testRejectInvalidHelo() throws Exception {
+ void testRejectInvalidHelo() throws Exception {
MailAddress mailAddress = new MailAddress("test@localhost");
SMTPSession session = setupMockSession(INVALID_HOST, false, false, null, mailAddress);
ResolvableEhloHeloHandler handler = createHandler();
@@ -142,7 +142,7 @@ public class ResolvableEhloHeloHandlerTest {
}
@Test
- public void testNotRejectValidHelo() throws Exception {
+ void testNotRejectValidHelo() throws Exception {
MailAddress mailAddress = new MailAddress("test@localhost");
SMTPSession session = setupMockSession(VALID_HOST, false, false, null, mailAddress);
ResolvableEhloHeloHandler handler = createHandler();
@@ -156,7 +156,7 @@ public class ResolvableEhloHeloHandlerTest {
}
@Test
- public void testRejectInvalidHeloAuthUser() throws Exception {
+ void testRejectInvalidHeloAuthUser() throws Exception {
MailAddress mailAddress = new MailAddress("test@localhost");
SMTPSession session = setupMockSession(INVALID_HOST, false, true, Username.of("valid@user"), mailAddress);
ResolvableEhloHeloHandler handler = createHandler();
@@ -172,7 +172,7 @@ public class ResolvableEhloHeloHandlerTest {
@Test
- public void testRejectRelay() throws Exception {
+ void testRejectRelay() throws Exception {
MailAddress mailAddress = new MailAddress("test@localhost");
SMTPSession session = setupMockSession(INVALID_HOST, true, false, null, mailAddress);
ResolvableEhloHeloHandler handler = createHandler();
diff --git a/protocols/smtp/src/test/java/org/apache/james/protocols/smtp/core/fastfail/SpamTrapHandlerTest.java b/protocols/smtp/src/test/java/org/apache/james/protocols/smtp/core/fastfail/SpamTrapHandlerTest.java
index 3e7a528..41766a1 100644
--- a/protocols/smtp/src/test/java/org/apache/james/protocols/smtp/core/fastfail/SpamTrapHandlerTest.java
+++ b/protocols/smtp/src/test/java/org/apache/james/protocols/smtp/core/fastfail/SpamTrapHandlerTest.java
@@ -30,7 +30,7 @@ import org.apache.james.core.MaybeSender;
import org.apache.james.protocols.smtp.SMTPSession;
import org.apache.james.protocols.smtp.hook.HookReturnCode;
import org.apache.james.protocols.smtp.utils.BaseFakeSMTPSession;
-import org.junit.Test;
+import org.junit.jupiter.api.Test;
public class SpamTrapHandlerTest {
private static final String SPAM_TRAP_RECIP1 = "spamtrap1@localhost";
@@ -51,7 +51,7 @@ public class SpamTrapHandlerTest {
}
@Test
- public void testSpamTrap() throws Exception {
+ void testSpamTrap() throws Exception {
String ip = "192.168.100.1";
String ip2 = "192.168.100.2";
long blockTime = 2000;
diff --git a/protocols/smtp/src/test/java/org/apache/james/protocols/smtp/core/fastfail/ValidSenderDomainHandlerTest.java b/protocols/smtp/src/test/java/org/apache/james/protocols/smtp/core/fastfail/ValidSenderDomainHandlerTest.java
index 685b4f2..903f423 100644
--- a/protocols/smtp/src/test/java/org/apache/james/protocols/smtp/core/fastfail/ValidSenderDomainHandlerTest.java
+++ b/protocols/smtp/src/test/java/org/apache/james/protocols/smtp/core/fastfail/ValidSenderDomainHandlerTest.java
@@ -31,7 +31,7 @@ import org.apache.james.protocols.api.ProtocolSession.State;
import org.apache.james.protocols.smtp.SMTPSession;
import org.apache.james.protocols.smtp.hook.HookReturnCode;
import org.apache.james.protocols.smtp.utils.BaseFakeSMTPSession;
-import org.junit.Test;
+import org.junit.jupiter.api.Test;
import com.google.common.base.Preconditions;
@@ -103,7 +103,7 @@ public class ValidSenderDomainHandlerTest {
// Test for JAMES-580
@Test
- public void testNullSenderNotReject() {
+ void testNullSenderNotReject() {
ValidSenderDomainHandler handler = createHandler();
HookReturnCode response = handler.doMail(setupMockedSession(null), MaybeSender.nullSender()).getResult();
@@ -111,7 +111,7 @@ public class ValidSenderDomainHandlerTest {
}
@Test
- public void testInvalidSenderDomainReject() throws Exception {
+ void testInvalidSenderDomainReject() throws Exception {
ValidSenderDomainHandler handler = createHandler();
SMTPSession session = setupMockedSession(new MailAddress("invalid@invalid"));
MaybeSender sender = session.getAttachment(SMTPSession.SENDER, State.Transaction).get();
diff --git a/protocols/smtp/src/test/java/org/apache/james/protocols/smtp/hook/HookResultTest.java b/protocols/smtp/src/test/java/org/apache/james/protocols/smtp/hook/HookResultTest.java
index a76d50a..f7a0a2f 100644
--- a/protocols/smtp/src/test/java/org/apache/james/protocols/smtp/hook/HookResultTest.java
+++ b/protocols/smtp/src/test/java/org/apache/james/protocols/smtp/hook/HookResultTest.java
@@ -19,14 +19,14 @@
package org.apache.james.protocols.smtp.hook;
-import org.junit.Test;
+import org.junit.jupiter.api.Test;
import nl.jqno.equalsverifier.EqualsVerifier;
public class HookResultTest {
@Test
- public void shouldMatchBeanContract() {
+ void shouldMatchBeanContract() {
EqualsVerifier.forClass(HookResult.class)
.verify();
}
diff --git a/protocols/smtp/src/test/java/org/apache/james/protocols/smtp/netty/NettySMTPSServerTest.java b/protocols/smtp/src/test/java/org/apache/james/protocols/smtp/netty/NettySMTPSServerTest.java
index b14b568..0289b32 100644
--- a/protocols/smtp/src/test/java/org/apache/james/protocols/smtp/netty/NettySMTPSServerTest.java
+++ b/protocols/smtp/src/test/java/org/apache/james/protocols/smtp/netty/NettySMTPSServerTest.java
@@ -26,8 +26,8 @@ import org.apache.james.protocols.api.ProtocolServer;
import org.apache.james.protocols.netty.NettyServer;
import org.apache.james.protocols.smtp.AbstractSMTPSServerTest;
import org.jboss.netty.util.HashedWheelTimer;
-import org.junit.After;
-import org.junit.Before;
+import org.junit.jupiter.api.AfterEach;
+import org.junit.jupiter.api.BeforeEach;
/**
* Integration tests which use netty implementation
@@ -41,13 +41,13 @@ public class NettySMTPSServerTest extends AbstractSMTPSServerTest {
private HashedWheelTimer hashedWheelTimer;
- @Before
- public void setup() {
+ @BeforeEach
+ void setup() {
hashedWheelTimer = new HashedWheelTimer();
}
- @After
- public void teardown() {
+ @AfterEach
+ void teardown() {
hashedWheelTimer.stop();
}
diff --git a/protocols/smtp/src/test/java/org/apache/james/protocols/smtp/netty/NettySMTPServerTest.java b/protocols/smtp/src/test/java/org/apache/james/protocols/smtp/netty/NettySMTPServerTest.java
index 3adeb44..d1bc8c5 100644
--- a/protocols/smtp/src/test/java/org/apache/james/protocols/smtp/netty/NettySMTPServerTest.java
+++ b/protocols/smtp/src/test/java/org/apache/james/protocols/smtp/netty/NettySMTPServerTest.java
@@ -25,8 +25,8 @@ import org.apache.james.protocols.api.ProtocolServer;
import org.apache.james.protocols.netty.NettyServer;
import org.apache.james.protocols.smtp.AbstractSMTPServerTest;
import org.jboss.netty.util.HashedWheelTimer;
-import org.junit.After;
-import org.junit.Before;
+import org.junit.jupiter.api.AfterEach;
+import org.junit.jupiter.api.BeforeEach;
/**
* Integration tests which use netty implementation
@@ -40,13 +40,13 @@ public class NettySMTPServerTest extends AbstractSMTPServerTest {
private HashedWheelTimer hashedWheelTimer;
- @Before
- public void setup() {
+ @BeforeEach
+ void setup() {
hashedWheelTimer = new HashedWheelTimer();
}
- @After
- public void teardown() {
+ @AfterEach
+ void teardown() {
hashedWheelTimer.stop();
}
diff --git a/protocols/smtp/src/test/java/org/apache/james/protocols/smtp/netty/NettyStartTlsSMTPServerTest.java b/protocols/smtp/src/test/java/org/apache/james/protocols/smtp/netty/NettyStartTlsSMTPServerTest.java
index b5edd0d..1b2a563 100644
--- a/protocols/smtp/src/test/java/org/apache/james/protocols/smtp/netty/NettyStartTlsSMTPServerTest.java
+++ b/protocols/smtp/src/test/java/org/apache/james/protocols/smtp/netty/NettyStartTlsSMTPServerTest.java
@@ -32,6 +32,8 @@ import javax.mail.Session;
import javax.mail.internet.InternetAddress;
import javax.mail.internet.MimeMessage;
+import com.sun.mail.smtp.SMTPTransport;
+
import org.apache.commons.net.smtp.SMTPReply;
import org.apache.commons.net.smtp.SMTPSClient;
import org.apache.james.metrics.tests.RecordingMetricFactory;
@@ -53,11 +55,9 @@ import org.apache.james.protocols.smtp.SMTPProtocolHandlerChain;
import org.apache.james.protocols.smtp.utils.TestMessageHook;
import org.assertj.core.api.AssertDelegateTarget;
import org.jboss.netty.util.HashedWheelTimer;
-import org.junit.After;
-import org.junit.Before;
-import org.junit.Test;
-
-import com.sun.mail.smtp.SMTPTransport;
+import org.junit.jupiter.api.AfterEach;
+import org.junit.jupiter.api.BeforeEach;
+import org.junit.jupiter.api.Test;
public class NettyStartTlsSMTPServerTest {
@@ -68,13 +68,13 @@ public class NettyStartTlsSMTPServerTest {
private ProtocolServer server = null;
private HashedWheelTimer hashedWheelTimer;
- @Before
- public void setup() {
+ @BeforeEach
+ void setup() {
hashedWheelTimer = new HashedWheelTimer();
}
- @After
- public void tearDown() throws Exception {
+ @AfterEach
+ void tearDown() throws Exception {
if (smtpsClient != null) {
smtpsClient.disconnect();
}
@@ -110,7 +110,7 @@ public class NettyStartTlsSMTPServerTest {
}
@Test
- public void connectShouldReturnTrueWhenConnecting() throws Exception {
+ void connectShouldReturnTrueWhenConnecting() throws Exception {
server = createServer(createProtocol(Optional.empty()), Encryption.createStartTls(BogusSslContextFactory.getServerContext()));
smtpsClient = createClient();
@@ -121,7 +121,7 @@ public class NettyStartTlsSMTPServerTest {
}
@Test
- public void ehloShouldReturnTrueWhenSendingTheCommand() throws Exception {
+ void ehloShouldReturnTrueWhenSendingTheCommand() throws Exception {
server = createServer(createProtocol(Optional.empty()), Encryption.createStartTls(BogusSslContextFactory.getServerContext()));
smtpsClient = createClient();
@@ -134,7 +134,7 @@ public class NettyStartTlsSMTPServerTest {
}
@Test
- public void startTlsShouldBeAnnouncedWhenServerSupportsIt() throws Exception {
+ void startTlsShouldBeAnnouncedWhenServerSupportsIt() throws Exception {
server = createServer(createProtocol(Optional.empty()), Encryption.createStartTls(BogusSslContextFactory.getServerContext()));
smtpsClient = createClient();
@@ -163,7 +163,7 @@ public class NettyStartTlsSMTPServerTest {
}
@Test
- public void startTlsShouldReturnTrueWhenServerSupportsIt() throws Exception {
+ void startTlsShouldReturnTrueWhenServerSupportsIt() throws Exception {
server = createServer(createProtocol(Optional.empty()), Encryption.createStartTls(BogusSslContextFactory.getServerContext()));
smtpsClient = createClient();
@@ -177,7 +177,7 @@ public class NettyStartTlsSMTPServerTest {
}
@Test
- public void startTlsShouldFailWhenFollowedByInjectedCommand() throws Exception {
+ void startTlsShouldFailWhenFollowedByInjectedCommand() throws Exception {
server = createServer(createProtocol(Optional.empty()), Encryption.createStartTls(BogusSslContextFactory.getServerContext()));
smtpsClient = createClient();
@@ -191,7 +191,7 @@ public class NettyStartTlsSMTPServerTest {
}
@Test
- public void startTlsShouldFailWhenFollowedByInjectedCommandAndNotAtBeginningOfLine() throws Exception {
+ void startTlsShouldFailWhenFollowedByInjectedCommandAndNotAtBeginningOfLine() throws Exception {
server = createServer(createProtocol(Optional.empty()), Encryption.createStartTls(BogusSslContextFactory.getServerContext()));
smtpsClient = createClient();
@@ -205,7 +205,7 @@ public class NettyStartTlsSMTPServerTest {
}
@Test
- public void startTlsShouldWorkWhenUsingJavamail() throws Exception {
+ void startTlsShouldWorkWhenUsingJavamail() throws Exception {
TestMessageHook hook = new TestMessageHook();
server = createServer(createProtocol(Optional.<ProtocolHandler>of(hook)), Encryption.createStartTls(BogusSslContextFactory.getServerContext()));
server.bind();
---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@james.apache.org
For additional commands, e-mail: notifications-help@james.apache.org