You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@james.apache.org by rc...@apache.org on 2021/01/12 11:02:19 UTC
[james-project] 20/20: JAMES-2543 Junit 4 -> 5 public access
modifier cleanups
This is an automated email from the ASF dual-hosted git repository.
rcordier pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/james-project.git
commit 6d899ce0b911e832bfa9a4835cd9d201766810aa
Author: Rene Cordier <rc...@linagora.com>
AuthorDate: Thu Jan 7 11:46:17 2021 +0700
JAMES-2543 Junit 4 -> 5 public access modifier cleanups
---
.../james/transport/mailets/SpamAssassinTest.java | 35 +++++++++++-----------
.../org/apache/james/jwt/JwtConfigurationTest.java | 12 ++++----
.../org/apache/james/jwt/JwtTokenVerifierTest.java | 32 ++++++++++----------
.../apache/james/jwt/PublicKeyProviderTest.java | 8 ++---
.../org/apache/james/jwt/PublicKeyReaderTest.java | 10 +++----
.../james/imapserver/netty/IMAPServerTest.java | 6 ++--
.../apache/james/pop3server/POP3ServerTest.java | 30 +++++++++----------
.../james/smtpserver/SpamAssassinHandlerTest.java | 10 +++----
.../apache/james/smtpserver/URIRBLHandlerTest.java | 12 ++++----
.../james/smtpserver/ValidRcptHandlerTest.java | 24 +++++++--------
.../spamassassin/mock/MockSpamdExtension.java | 2 --
11 files changed, 89 insertions(+), 92 deletions(-)
diff --git a/server/mailet/mailets/src/test/java/org/apache/james/transport/mailets/SpamAssassinTest.java b/server/mailet/mailets/src/test/java/org/apache/james/transport/mailets/SpamAssassinTest.java
index 4af5557..273bb3e 100644
--- a/server/mailet/mailets/src/test/java/org/apache/james/transport/mailets/SpamAssassinTest.java
+++ b/server/mailet/mailets/src/test/java/org/apache/james/transport/mailets/SpamAssassinTest.java
@@ -42,16 +42,17 @@ import org.junit.jupiter.api.extension.RegisterExtension;
import com.github.steveash.guavate.Guavate;
-public class SpamAssassinTest {
+class SpamAssassinTest {
+
+ private static final DomainList NO_DOMAIN_LIST = null;
- public static final DomainList NO_DOMAIN_LIST = null;
@RegisterExtension
- public MockSpamdExtension spamd = new MockSpamdExtension();
+ MockSpamdExtension spamd = new MockSpamdExtension();
private SpamAssassin mailet = new SpamAssassin(new RecordingMetricFactory(), MemoryUsersRepository.withVirtualHosting(NO_DOMAIN_LIST));
@Test
- public void initShouldSetDefaultSpamdHostWhenNone() throws Exception {
+ void initShouldSetDefaultSpamdHostWhenNone() throws Exception {
mailet.init(FakeMailetConfig.builder()
.mailetName("SpamAssassin")
.build());
@@ -60,7 +61,7 @@ public class SpamAssassinTest {
}
@Test
- public void initShouldSetDefaultSpamdPortWhenNone() throws Exception {
+ void initShouldSetDefaultSpamdPortWhenNone() throws Exception {
mailet.init(FakeMailetConfig.builder()
.mailetName("SpamAssassin")
.build());
@@ -69,7 +70,7 @@ public class SpamAssassinTest {
}
@Test
- public void initShouldSetSpamdHostWhenPresent() throws Exception {
+ void initShouldSetSpamdHostWhenPresent() throws Exception {
String spamdHost = "any.host";
mailet.init(FakeMailetConfig.builder()
.mailetName("SpamAssassin")
@@ -80,7 +81,7 @@ public class SpamAssassinTest {
}
@Test
- public void getSpamHostShouldReturnDefaultValueWhenEmpty() throws Exception {
+ void getSpamHostShouldReturnDefaultValueWhenEmpty() throws Exception {
mailet.init(FakeMailetConfig.builder()
.mailetName("SpamAssassin")
.setProperty(SpamAssassin.SPAMD_HOST, "")
@@ -90,7 +91,7 @@ public class SpamAssassinTest {
}
@Test
- public void initShouldSetDefaultSpamdPortWhenDefault() throws Exception {
+ void initShouldSetDefaultSpamdPortWhenDefault() throws Exception {
mailet.init(FakeMailetConfig.builder()
.mailetName("SpamAssassin")
.build());
@@ -99,7 +100,7 @@ public class SpamAssassinTest {
}
@Test
- public void initShouldThrowWhenSpamdPortIsNotNumber() {
+ void initShouldThrowWhenSpamdPortIsNotNumber() {
assertThatThrownBy(() -> mailet.init(FakeMailetConfig.builder()
.mailetName("SpamAssassin")
.setProperty(SpamAssassin.SPAMD_PORT, "noNumber")
@@ -107,7 +108,7 @@ public class SpamAssassinTest {
}
@Test
- public void initShouldThrowWhenSpamdPortIsNegative() {
+ void initShouldThrowWhenSpamdPortIsNegative() {
assertThatThrownBy(() -> mailet.init(FakeMailetConfig.builder()
.mailetName("SpamAssassin")
.setProperty(SpamAssassin.SPAMD_PORT, "-1")
@@ -115,7 +116,7 @@ public class SpamAssassinTest {
}
@Test
- public void initShouldThrowWhenSpamdPortIsZero() {
+ void initShouldThrowWhenSpamdPortIsZero() {
assertThatThrownBy(() -> mailet.init(FakeMailetConfig.builder()
.mailetName("SpamAssassin")
.setProperty(SpamAssassin.SPAMD_PORT, "0")
@@ -123,7 +124,7 @@ public class SpamAssassinTest {
}
@Test
- public void initShouldThrowWhenSpamdPortTooBig() {
+ void initShouldThrowWhenSpamdPortTooBig() {
assertThatThrownBy(() -> mailet.init(FakeMailetConfig.builder()
.mailetName("SpamAssassin")
.setProperty(SpamAssassin.SPAMD_PORT,
@@ -132,7 +133,7 @@ public class SpamAssassinTest {
}
@Test
- public void initShouldSetSpamPortWhenPresent() throws Exception {
+ void initShouldSetSpamPortWhenPresent() throws Exception {
int spamPort = 1000;
mailet.init(FakeMailetConfig.builder()
.mailetName("SpamAssassin")
@@ -143,7 +144,7 @@ public class SpamAssassinTest {
}
@Test
- public void serviceShouldWriteSpamAttributeOnMail() throws Exception {
+ void serviceShouldWriteSpamAttributeOnMail() throws Exception {
FakeMailetConfig mailetConfiguration = FakeMailetConfig.builder()
.mailetName("SpamAssassin")
.setProperty(SpamAssassin.SPAMD_HOST, "localhost")
@@ -177,7 +178,7 @@ public class SpamAssassinTest {
}
@Test
- public void serviceShouldWriteMessageAsNotSpamWhenNotSpam() throws Exception {
+ void serviceShouldWriteMessageAsNotSpamWhenNotSpam() throws Exception {
FakeMailetConfig mailetConfiguration = FakeMailetConfig.builder()
.mailetName("SpamAssassin")
.setProperty(SpamAssassin.SPAMD_HOST, "localhost")
@@ -213,7 +214,7 @@ public class SpamAssassinTest {
}
@Test
- public void serviceShouldWriteMessageAsSpamWhenSpam() throws Exception {
+ void serviceShouldWriteMessageAsSpamWhenSpam() throws Exception {
FakeMailetConfig mailetConfiguration = FakeMailetConfig.builder()
.mailetName("SpamAssassin")
.setProperty(SpamAssassin.SPAMD_HOST, "localhost")
@@ -249,7 +250,7 @@ public class SpamAssassinTest {
}
@Test
- public void getMailetInfoShouldReturnSpamAssasinMailetInformation() {
+ void getMailetInfoShouldReturnSpamAssasinMailetInformation() {
assertThat(mailet.getMailetInfo()).isEqualTo("Checks message against SpamAssassin");
}
diff --git a/server/protocols/jwt/src/test/java/org/apache/james/jwt/JwtConfigurationTest.java b/server/protocols/jwt/src/test/java/org/apache/james/jwt/JwtConfigurationTest.java
index 7941c29..ee8a557 100644
--- a/server/protocols/jwt/src/test/java/org/apache/james/jwt/JwtConfigurationTest.java
+++ b/server/protocols/jwt/src/test/java/org/apache/james/jwt/JwtConfigurationTest.java
@@ -26,7 +26,7 @@ import java.util.Optional;
import org.junit.jupiter.api.Test;
-public class JwtConfigurationTest {
+class JwtConfigurationTest {
private static final String INVALID_PUBLIC_KEY = "invalidPublicKey";
private static final String VALID_PUBLIC_KEY = "-----BEGIN PUBLIC KEY-----\n" +
"MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAtlChO/nlVP27MpdkG0Bh\n" +
@@ -39,32 +39,32 @@ public class JwtConfigurationTest {
"-----END PUBLIC KEY-----";
@Test
- public void getJwtPublicKeyPemShouldReturnEmptyWhenEmptyPublicKey() {
+ void getJwtPublicKeyPemShouldReturnEmptyWhenEmptyPublicKey() {
JwtConfiguration jwtConfiguration = new JwtConfiguration(Optional.empty());
assertThat(jwtConfiguration.getJwtPublicKeyPem()).isNotPresent();
}
@Test
- public void constructorShouldThrowWhenNullPublicKey() {
+ void constructorShouldThrowWhenNullPublicKey() {
assertThatThrownBy(() -> new JwtConfiguration(null))
.isInstanceOf(NullPointerException.class);
}
@Test
- public void constructorShouldThrowWhenNonePublicKey() {
+ void constructorShouldThrowWhenNonePublicKey() {
assertThatThrownBy(() -> new JwtConfiguration(Optional.of("")))
.isInstanceOf(IllegalStateException.class);
}
@Test
- public void constructorShouldThrowWhenInvalidPublicKey() {
+ void constructorShouldThrowWhenInvalidPublicKey() {
assertThatThrownBy(() -> new JwtConfiguration(Optional.of(INVALID_PUBLIC_KEY)))
.isInstanceOf(IllegalStateException.class);
}
@Test
- public void getJwtPublicKeyPemShouldReturnWhenValidPublicKey() {
+ void getJwtPublicKeyPemShouldReturnWhenValidPublicKey() {
JwtConfiguration jwtConfiguration = new JwtConfiguration(Optional.of(VALID_PUBLIC_KEY));
assertThat(jwtConfiguration.getJwtPublicKeyPem()).isPresent();
diff --git a/server/protocols/jwt/src/test/java/org/apache/james/jwt/JwtTokenVerifierTest.java b/server/protocols/jwt/src/test/java/org/apache/james/jwt/JwtTokenVerifierTest.java
index c464a6b..75b638a 100644
--- a/server/protocols/jwt/src/test/java/org/apache/james/jwt/JwtTokenVerifierTest.java
+++ b/server/protocols/jwt/src/test/java/org/apache/james/jwt/JwtTokenVerifierTest.java
@@ -24,13 +24,11 @@ import java.security.Security;
import java.util.Optional;
import org.bouncycastle.jce.provider.BouncyCastleProvider;
-import org.junit.Before;
-import org.junit.BeforeClass;
import org.junit.jupiter.api.BeforeAll;
import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.Test;
-public class JwtTokenVerifierTest {
+class JwtTokenVerifierTest {
private static final String PUBLIC_PEM_KEY = "-----BEGIN PUBLIC KEY-----\n" +
"MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAtlChO/nlVP27MpdkG0Bh\n" +
@@ -66,12 +64,12 @@ public class JwtTokenVerifierTest {
private JwtTokenVerifier sut;
@BeforeAll
- public static void init() {
+ static void init() {
Security.addProvider(new BouncyCastleProvider());
}
@BeforeEach
- public void setup() {
+ void setup() {
PublicKeyProvider pubKeyProvider = new PublicKeyProvider(getJWTConfiguration(), new PublicKeyReader());
sut = new JwtTokenVerifier(pubKeyProvider);
}
@@ -81,12 +79,12 @@ public class JwtTokenVerifierTest {
}
@Test
- public void shouldReturnTrueOnValidSignature() {
+ void shouldReturnTrueOnValidSignature() {
assertThat(sut.verify(VALID_TOKEN_WITHOUT_ADMIN)).isTrue();
}
@Test
- public void shouldReturnFalseOnMismatchingSigningKey() {
+ void shouldReturnFalseOnMismatchingSigningKey() {
String invalidToken = "eyJhbGciOiJSUzI1NiIsInR5cCI6IkpXVCJ9.eyJzdWIiOiIxMjM0NTY3ODkwIiwibmFtZSI6IkpvaG4gRG9lIn0.Pd6t82" +
"tPL3EZdkeYxw_DV2KimE1U2FvuLHmfR_mimJ5US3JFU4J2Gd94O7rwpSTGN1B9h-_lsTebo4ua4xHsTtmczZ9xa8a_kWKaSkqFjNFa" +
"Fp6zcoD6ivCu03SlRqsQzSRHXo6TKbnqOt9D6Y2rNa3C4igSwoS0jUE4BgpXbc0";
@@ -95,7 +93,7 @@ public class JwtTokenVerifierTest {
}
@Test
- public void verifyShouldReturnFalseWhenSubjectIsNull() {
+ void verifyShouldReturnFalseWhenSubjectIsNull() {
String tokenWithNullSubject = "eyJhbGciOiJSUzI1NiIsInR5cCI6IkpXVCJ9.eyJzdWIiOm51bGwsIm5hbWUiOiJKb2huIERvZSJ9.EB" +
"_1grWDy_kFelXs3AQeiP13ay4eG_134dWB9XPRSeWsuPs8Mz2UY-VHDxLGD-fAqv-xKXr4QFEnS7iZkdpe0tPLNSwIjqeqkC6KqQln" +
"oC1okqWVWBDOcf7Acp1Jzp_cFTUhL5LkHvZDsyCdq5T9OOVVkzO4A9RrzIUsTrYPtRCBuYJ3ggR33cKpw191PulPGNH70rZqpUfDXe" +
@@ -106,7 +104,7 @@ public class JwtTokenVerifierTest {
}
@Test
- public void verifyShouldReturnFalseWhenEmptySubject() {
+ void verifyShouldReturnFalseWhenEmptySubject() {
String tokenWithEmptySubject = "eyJhbGciOiJSUzI1NiIsInR5cCI6IkpXVCJ9.eyJzdWIiOiIiLCJuYW1lIjoiSm9obiBEb2UifQ.UdY" +
"s2PPzFCegUYspoDCnlJR_bJm8_z1InOv4v3tq8SJETQUarOXlhb_n6y6ujVvmJiSx9dI24Hc3Czi3RGUOXbnBDj1WPfd0aVSiUSqZr" +
"MCHBt5vjCYqAseDaP3w4aiiFb6EV3tteJFeBLZx8XlKPYxlzRLLUADDyDSQvrFBBPxfsvCETZovKdo9ofIN64o-yx23ss63yE6oIOd" +
@@ -118,48 +116,48 @@ public class JwtTokenVerifierTest {
}
@Test
- public void verifyShouldNotAcceptNoneAlgorithm() {
+ void verifyShouldNotAcceptNoneAlgorithm() {
assertThat(sut.verify(TOKEN_NONE_ALGORITHM)).isFalse();
}
@Test
- public void verifyShouldNotAcceptNoneAlgorithmWithoutSignature() {
+ void verifyShouldNotAcceptNoneAlgorithmWithoutSignature() {
assertThat(sut.verify(TOKEN_NONE_ALGORITHM_NO_SIGNATURE)).isFalse();
}
@Test
- public void shouldReturnUserLoginFromValidToken() {
+ void shouldReturnUserLoginFromValidToken() {
assertThat(sut.extractLogin(VALID_TOKEN_WITHOUT_ADMIN)).isEqualTo("1234567890");
}
@Test
- public void hasAttributeShouldReturnFalseOnNoneAlgorithm() throws Exception {
+ void hasAttributeShouldReturnFalseOnNoneAlgorithm() throws Exception {
boolean authorized = sut.hasAttribute("admin", true, TOKEN_NONE_ALGORITHM);
assertThat(authorized).isFalse();
}
@Test
- public void hasAttributeShouldReturnFalseOnNoneAlgorithmWithoutSignature() throws Exception {
+ void hasAttributeShouldReturnFalseOnNoneAlgorithmWithoutSignature() throws Exception {
boolean authorized = sut.hasAttribute("admin", true, TOKEN_NONE_ALGORITHM_NO_SIGNATURE);
assertThat(authorized).isFalse();
}
@Test
- public void hasAttributeShouldReturnTrueIfClaimValid() throws Exception {
+ void hasAttributeShouldReturnTrueIfClaimValid() throws Exception {
boolean authorized = sut.hasAttribute("admin", true, VALID_TOKEN_ADMIN_TRUE);
assertThat(authorized).isTrue();
}
@Test
- public void extractLoginShouldWorkWithAdminClaim() {
+ void extractLoginShouldWorkWithAdminClaim() {
assertThat(sut.extractLogin(VALID_TOKEN_ADMIN_TRUE)).isEqualTo("admin@open-paas.org");
}
@Test
- public void hasAttributeShouldThrowIfClaimInvalid() throws Exception {
+ void hasAttributeShouldThrowIfClaimInvalid() throws Exception {
boolean authorized = sut.hasAttribute("admin", true, VALID_TOKEN_ADMIN_FALSE);
assertThat(authorized).isFalse();
diff --git a/server/protocols/jwt/src/test/java/org/apache/james/jwt/PublicKeyProviderTest.java b/server/protocols/jwt/src/test/java/org/apache/james/jwt/PublicKeyProviderTest.java
index ce07dce..a4771b9 100644
--- a/server/protocols/jwt/src/test/java/org/apache/james/jwt/PublicKeyProviderTest.java
+++ b/server/protocols/jwt/src/test/java/org/apache/james/jwt/PublicKeyProviderTest.java
@@ -29,7 +29,7 @@ import org.bouncycastle.jce.provider.BouncyCastleProvider;
import org.junit.jupiter.api.BeforeAll;
import org.junit.jupiter.api.Test;
-public class PublicKeyProviderTest {
+class PublicKeyProviderTest {
private static final String PUBLIC_PEM_KEY = "-----BEGIN PUBLIC KEY-----\n" +
"MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAtlChO/nlVP27MpdkG0Bh\n" +
@@ -42,12 +42,12 @@ public class PublicKeyProviderTest {
"-----END PUBLIC KEY-----";
@BeforeAll
- public static void init() {
+ static void init() {
Security.addProvider(new BouncyCastleProvider());
}
@Test
- public void getShouldNotThrowWhenPEMKeyProvided() {
+ void getShouldNotThrowWhenPEMKeyProvided() {
JwtConfiguration configWithPEMKey = new JwtConfiguration(Optional.of(PUBLIC_PEM_KEY));
@@ -57,7 +57,7 @@ public class PublicKeyProviderTest {
}
@Test
- public void getShouldThrowWhenPEMKeyNotProvided() {
+ void getShouldThrowWhenPEMKeyNotProvided() {
JwtConfiguration configWithPEMKey = new JwtConfiguration(Optional.empty());
PublicKeyProvider sut = new PublicKeyProvider(configWithPEMKey, new PublicKeyReader());
diff --git a/server/protocols/jwt/src/test/java/org/apache/james/jwt/PublicKeyReaderTest.java b/server/protocols/jwt/src/test/java/org/apache/james/jwt/PublicKeyReaderTest.java
index 57a100e..655a1ab 100644
--- a/server/protocols/jwt/src/test/java/org/apache/james/jwt/PublicKeyReaderTest.java
+++ b/server/protocols/jwt/src/test/java/org/apache/james/jwt/PublicKeyReaderTest.java
@@ -28,7 +28,7 @@ import org.bouncycastle.jce.provider.BouncyCastleProvider;
import org.junit.jupiter.api.BeforeAll;
import org.junit.jupiter.api.Test;
-public class PublicKeyReaderTest {
+class PublicKeyReaderTest {
private static final String PUBLIC_PEM_KEY = "-----BEGIN PUBLIC KEY-----\n" +
"MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAtlChO/nlVP27MpdkG0Bh\n" +
@@ -41,22 +41,22 @@ public class PublicKeyReaderTest {
"-----END PUBLIC KEY-----";
@BeforeAll
- public static void init() {
+ static void init() {
Security.addProvider(new BouncyCastleProvider());
}
@Test
- public void fromPEMShouldReturnEmptyWhenEmptyProvided() {
+ void fromPEMShouldReturnEmptyWhenEmptyProvided() {
assertThat(new PublicKeyReader().fromPEM(Optional.empty())).isEmpty();
}
@Test
- public void fromPEMShouldReturnEmptyWhenInvalidPEMKey() {
+ void fromPEMShouldReturnEmptyWhenInvalidPEMKey() {
assertThat(new PublicKeyReader().fromPEM(Optional.of("blabla"))).isEmpty();
}
@Test
- public void fromPEMShouldReturnRSAPublicKeyWhenValidPEMKey() {
+ void fromPEMShouldReturnRSAPublicKeyWhenValidPEMKey() {
assertThat(new PublicKeyReader().fromPEM(Optional.of(PUBLIC_PEM_KEY))).isPresent();
}
}
diff --git a/server/protocols/protocols-imap4/src/test/java/org/apache/james/imapserver/netty/IMAPServerTest.java b/server/protocols/protocols-imap4/src/test/java/org/apache/james/imapserver/netty/IMAPServerTest.java
index 888f9fa..c4aa8c1 100644
--- a/server/protocols/protocols-imap4/src/test/java/org/apache/james/imapserver/netty/IMAPServerTest.java
+++ b/server/protocols/protocols-imap4/src/test/java/org/apache/james/imapserver/netty/IMAPServerTest.java
@@ -31,9 +31,9 @@ import org.junit.jupiter.api.Test;
import com.google.common.collect.ImmutableSet;
-public class IMAPServerTest {
+class IMAPServerTest {
@Test
- public void getImapConfigurationShouldReturnDefaultValuesWhenEmpty() {
+ void getImapConfigurationShouldReturnDefaultValuesWhenEmpty() {
ImapConfiguration imapConfiguration = IMAPServer.getImapConfiguration(new BaseHierarchicalConfiguration());
ImapConfiguration expectImapConfiguration = ImapConfiguration.builder()
@@ -47,7 +47,7 @@ public class IMAPServerTest {
}
@Test
- public void getImapConfigurationShouldReturnSetValue() {
+ void getImapConfigurationShouldReturnSetValue() {
HierarchicalConfiguration<ImmutableNode> configurationBuilder = new BaseHierarchicalConfiguration();
configurationBuilder.addProperty("enableIdle", "false");
configurationBuilder.addProperty("idleTimeInterval", "1");
diff --git a/server/protocols/protocols-pop3/src/test/java/org/apache/james/pop3server/POP3ServerTest.java b/server/protocols/protocols-pop3/src/test/java/org/apache/james/pop3server/POP3ServerTest.java
index 980f290..10120fa 100644
--- a/server/protocols/protocols-pop3/src/test/java/org/apache/james/pop3server/POP3ServerTest.java
+++ b/server/protocols/protocols-pop3/src/test/java/org/apache/james/pop3server/POP3ServerTest.java
@@ -57,7 +57,7 @@ import org.junit.jupiter.api.Test;
import com.google.inject.name.Names;
-public class POP3ServerTest {
+class POP3ServerTest {
private static final DomainList NO_DOMAIN_LIST = null;
private POP3TestConfiguration pop3Configuration;
@@ -74,7 +74,7 @@ public class POP3ServerTest {
private HashedWheelTimer hashedWheelTimer;
@BeforeEach
- public void setUp() throws Exception {
+ void setUp() throws Exception {
hashedWheelTimer = new HashedWheelTimer();
setUpServiceManager();
setUpPOP3Server();
@@ -82,7 +82,7 @@ public class POP3ServerTest {
}
@AfterEach
- public void tearDown() throws Exception {
+ void tearDown() throws Exception {
try {
if (pop3Client != null) {
if (pop3Client.isConnected()) {
@@ -99,7 +99,7 @@ public class POP3ServerTest {
}
@Test
- public void testAuthenticationFail() throws Exception {
+ void testAuthenticationFail() throws Exception {
finishSetUp(pop3Configuration);
pop3Client = new POP3Client();
@@ -114,7 +114,7 @@ public class POP3ServerTest {
}
@Test
- public void testUnknownUser() throws Exception {
+ void testUnknownUser() throws Exception {
finishSetUp(pop3Configuration);
pop3Client = new POP3Client();
@@ -127,7 +127,7 @@ public class POP3ServerTest {
}
@Test
- public void testKnownUserEmptyInbox() throws Exception {
+ void testKnownUserEmptyInbox() throws Exception {
finishSetUp(pop3Configuration);
pop3Client = new POP3Client();
@@ -176,7 +176,7 @@ public class POP3ServerTest {
*/
@Test
- public void testUnknownCommand() throws Exception {
+ void testUnknownCommand() throws Exception {
finishSetUp(pop3Configuration);
pop3Client = new POP3Client();
@@ -189,7 +189,7 @@ public class POP3ServerTest {
}
@Test
- public void testUidlCommand() throws Exception {
+ void testUidlCommand() throws Exception {
finishSetUp(pop3Configuration);
Username username = Username.of("foo");
@@ -229,7 +229,7 @@ public class POP3ServerTest {
}
@Test
- public void testMiscCommandsWithWithoutAuth() throws Exception {
+ void testMiscCommandsWithWithoutAuth() throws Exception {
finishSetUp(pop3Configuration);
usersRepository.addUser(Username.of("foo"), "bar");
@@ -284,7 +284,7 @@ public class POP3ServerTest {
}
@Test
- public void testKnownUserInboxWithMessages() throws Exception {
+ void testKnownUserInboxWithMessages() throws Exception {
finishSetUp(pop3Configuration);
pop3Client = new POP3Client();
@@ -374,7 +374,7 @@ public class POP3ServerTest {
* Test for JAMES-1202 - Which shows that UIDL,STAT and LIST all show the same message numbers.
*/
@Test
- public void testStatUidlList() throws Exception {
+ void testStatUidlList() throws Exception {
finishSetUp(pop3Configuration);
pop3Client = new POP3Client();
@@ -424,7 +424,7 @@ public class POP3ServerTest {
@Test
@Disabled("Test for JAMES-1202 - This was failing before as the more then one connection to the same mailbox was not handled the right way")
- public void testStatUidlListTwoConnections() throws Exception {
+ void testStatUidlListTwoConnections() throws Exception {
finishSetUp(pop3Configuration);
pop3Client = new POP3Client();
@@ -548,7 +548,7 @@ public class POP3ServerTest {
*/
@Test
- public void testIpStored() throws Exception {
+ void testIpStored() throws Exception {
finishSetUp(pop3Configuration);
@@ -566,7 +566,7 @@ public class POP3ServerTest {
}
@Test
- public void testCapa() throws Exception {
+ void testCapa() throws Exception {
finishSetUp(pop3Configuration);
pop3Client = new POP3Client();
@@ -635,7 +635,7 @@ public class POP3ServerTest {
*/
// See JAMES-1136
@Test
- public void testDeadlockOnRetr() throws Exception {
+ void testDeadlockOnRetr() throws Exception {
finishSetUp(pop3Configuration);
pop3Client = new POP3Client();
diff --git a/server/protocols/protocols-smtp/src/test/java/org/apache/james/smtpserver/SpamAssassinHandlerTest.java b/server/protocols/protocols-smtp/src/test/java/org/apache/james/smtpserver/SpamAssassinHandlerTest.java
index c727035..5211426 100644
--- a/server/protocols/protocols-smtp/src/test/java/org/apache/james/smtpserver/SpamAssassinHandlerTest.java
+++ b/server/protocols/protocols-smtp/src/test/java/org/apache/james/smtpserver/SpamAssassinHandlerTest.java
@@ -49,7 +49,7 @@ import org.junit.jupiter.api.extension.RegisterExtension;
import com.google.common.base.Preconditions;
-public class SpamAssassinHandlerTest {
+class SpamAssassinHandlerTest {
private static final String SPAMD_HOST = "localhost";
private static final Attribute FLAG_MAIL_ATTRIBUTE_NO = new Attribute(SpamAssassinResult.FLAG_MAIL, AttributeValue.of("NO"));
@@ -126,14 +126,14 @@ public class SpamAssassinHandlerTest {
.build();
}
- public MimeMessage setupMockedMimeMessage(String text) throws MessagingException {
+ private MimeMessage setupMockedMimeMessage(String text) throws MessagingException {
return MimeMessageBuilder.mimeMessageBuilder()
.setText(text)
.build();
}
@Test
- public void testNonSpam() throws Exception {
+ void testNonSpam() throws Exception {
SMTPSession session = setupMockedSMTPSession(setupMockedMail(setupMockedMimeMessage("test")));
SpamAssassinHandler handler = new SpamAssassinHandler(new RecordingMetricFactory());
@@ -150,7 +150,7 @@ public class SpamAssassinHandlerTest {
}
@Test
- public void testSpam() throws Exception {
+ void testSpam() throws Exception {
SMTPSession session = setupMockedSMTPSession(setupMockedMail(setupMockedMimeMessage(MockSpamd.GTUBE)));
SpamAssassinHandler handler = new SpamAssassinHandler(new RecordingMetricFactory());
@@ -166,7 +166,7 @@ public class SpamAssassinHandlerTest {
}
@Test
- public void testSpamReject() throws Exception {
+ void testSpamReject() throws Exception {
SMTPSession session = setupMockedSMTPSession(setupMockedMail(setupMockedMimeMessage(MockSpamd.GTUBE)));
SpamAssassinHandler handler = new SpamAssassinHandler(new RecordingMetricFactory());
diff --git a/server/protocols/protocols-smtp/src/test/java/org/apache/james/smtpserver/URIRBLHandlerTest.java b/server/protocols/protocols-smtp/src/test/java/org/apache/james/smtpserver/URIRBLHandlerTest.java
index acda4bb..b207f6d 100644
--- a/server/protocols/protocols-smtp/src/test/java/org/apache/james/smtpserver/URIRBLHandlerTest.java
+++ b/server/protocols/protocols-smtp/src/test/java/org/apache/james/smtpserver/URIRBLHandlerTest.java
@@ -49,7 +49,7 @@ import org.junit.jupiter.api.Test;
import com.google.common.base.Preconditions;
-public class URIRBLHandlerTest {
+class URIRBLHandlerTest {
private static final String BAD_DOMAIN1 = "bad.domain.de";
private static final String BAD_DOMAIN2 = "bad2.domain.de";
@@ -125,13 +125,13 @@ public class URIRBLHandlerTest {
.build();
}
- public MimeMessage setupMockedMimeMessage(String text) throws MessagingException {
+ private MimeMessage setupMockedMimeMessage(String text) throws MessagingException {
return MimeMessageBuilder.mimeMessageBuilder()
.setText(text)
.build();
}
- public MimeMessage setupMockedMimeMessageMP(String text) throws MessagingException {
+ private MimeMessage setupMockedMimeMessageMP(String text) throws MessagingException {
return MimeMessageBuilder.mimeMessageBuilder()
.setMultipartWithBodyParts(
MimeMessageBuilder.bodyPartBuilder()
@@ -175,7 +175,7 @@ public class URIRBLHandlerTest {
}
@Test
- public void testNotBlocked() throws IOException, MessagingException {
+ void testNotBlocked() throws IOException, MessagingException {
ArrayList<String> servers = new ArrayList<>();
servers.add(URISERVER);
@@ -193,7 +193,7 @@ public class URIRBLHandlerTest {
}
@Test
- public void testBlocked() throws IOException, MessagingException {
+ void testBlocked() throws IOException, MessagingException {
ArrayList<String> servers = new ArrayList<>();
servers.add(URISERVER);
@@ -211,7 +211,7 @@ public class URIRBLHandlerTest {
}
@Test
- public void testBlockedMultiPart() throws IOException, MessagingException {
+ void testBlockedMultiPart() throws IOException, MessagingException {
ArrayList<String> servers = new ArrayList<>();
servers.add(URISERVER);
diff --git a/server/protocols/protocols-smtp/src/test/java/org/apache/james/smtpserver/ValidRcptHandlerTest.java b/server/protocols/protocols-smtp/src/test/java/org/apache/james/smtpserver/ValidRcptHandlerTest.java
index 8bbb2a0..21608fb 100644
--- a/server/protocols/protocols-smtp/src/test/java/org/apache/james/smtpserver/ValidRcptHandlerTest.java
+++ b/server/protocols/protocols-smtp/src/test/java/org/apache/james/smtpserver/ValidRcptHandlerTest.java
@@ -46,7 +46,7 @@ import org.junit.jupiter.api.BeforeEach;
import com.google.common.base.Preconditions;
-public class ValidRcptHandlerTest {
+class ValidRcptHandlerTest {
private static final Username VALID_USER = Username.of("postmaster");
private static final String INVALID_USER = "invalid";
private static final String USER1 = "user1";
@@ -54,7 +54,7 @@ public class ValidRcptHandlerTest {
private static final String PASSWORD = "xxx";
private static final boolean RELAYING_ALLOWED = true;
private static final MaybeSender MAYBE_SENDER = MaybeSender.of(SENDER);
- public static final Domain DOMAIN_1 = Domain.of("domain.tld");
+ private static final Domain DOMAIN_1 = Domain.of("domain.tld");
private ValidRcptHandler handler;
private MemoryRecipientRewriteTable memoryRecipientRewriteTable;
@@ -63,7 +63,7 @@ public class ValidRcptHandlerTest {
private MailAddress invalidUserEmail;
@BeforeEach
- public void setUp() throws Exception {
+ void setUp() throws Exception {
MemoryDomainList memoryDomainList = new MemoryDomainList(mock(DNSService.class));
memoryDomainList.configure(DomainListConfiguration.builder()
.defaultDomain(Domain.LOCALHOST)
@@ -128,7 +128,7 @@ public class ValidRcptHandlerTest {
}
@Test
- public void doRcptShouldRejectNotExistingLocalUsersWhenNoRelay() {
+ void doRcptShouldRejectNotExistingLocalUsersWhenNoRelay() {
SMTPSession session = setupMockedSMTPSession(!RELAYING_ALLOWED);
HookReturnCode rCode = handler.doRcpt(session, MAYBE_SENDER, invalidUserEmail).getResult();
@@ -137,7 +137,7 @@ public class ValidRcptHandlerTest {
}
@Test
- public void doRcptShouldDenyNotExistingLocalUsersWhenRelay() {
+ void doRcptShouldDenyNotExistingLocalUsersWhenRelay() {
SMTPSession session = setupMockedSMTPSession(RELAYING_ALLOWED);
HookReturnCode rCode = handler.doRcpt(session, MAYBE_SENDER, invalidUserEmail).getResult();
@@ -146,7 +146,7 @@ public class ValidRcptHandlerTest {
}
@Test
- public void doRcptShouldDeclineNonLocalUsersWhenRelay() throws Exception {
+ void doRcptShouldDeclineNonLocalUsersWhenRelay() throws Exception {
MailAddress mailAddress = new MailAddress(INVALID_USER + "@otherdomain");
SMTPSession session = setupMockedSMTPSession(RELAYING_ALLOWED);
@@ -156,7 +156,7 @@ public class ValidRcptHandlerTest {
}
@Test
- public void doRcptShouldDeclineNonLocalUsersWhenNoRelay() throws Exception {
+ void doRcptShouldDeclineNonLocalUsersWhenNoRelay() throws Exception {
MailAddress mailAddress = new MailAddress(INVALID_USER + "@otherdomain");
SMTPSession session = setupMockedSMTPSession(!RELAYING_ALLOWED);
@@ -166,7 +166,7 @@ public class ValidRcptHandlerTest {
}
@Test
- public void doRcptShouldDeclineValidUsersWhenNoRelay() throws Exception {
+ void doRcptShouldDeclineValidUsersWhenNoRelay() throws Exception {
SMTPSession session = setupMockedSMTPSession(!RELAYING_ALLOWED);
HookReturnCode rCode = handler.doRcpt(session, MAYBE_SENDER, validUserEmail).getResult();
@@ -175,7 +175,7 @@ public class ValidRcptHandlerTest {
}
@Test
- public void doRcptShouldDeclineValidUsersWhenRelay() throws Exception {
+ void doRcptShouldDeclineValidUsersWhenRelay() throws Exception {
SMTPSession session = setupMockedSMTPSession(RELAYING_ALLOWED);
HookReturnCode rCode = handler.doRcpt(session, MAYBE_SENDER, validUserEmail).getResult();
@@ -184,7 +184,7 @@ public class ValidRcptHandlerTest {
}
@Test
- public void doRcptShouldDeclineWhenHasAddressMapping() throws Exception {
+ void doRcptShouldDeclineWhenHasAddressMapping() throws Exception {
memoryRecipientRewriteTable.addAddressMapping(MappingSource.fromUser(USER1, Domain.LOCALHOST), "address");
SMTPSession session = setupMockedSMTPSession(!RELAYING_ALLOWED);
@@ -195,7 +195,7 @@ public class ValidRcptHandlerTest {
}
@Test
- public void doRcptShouldDenyWhenHasMappingLoop() throws Exception {
+ void doRcptShouldDenyWhenHasMappingLoop() throws Exception {
memoryRecipientRewriteTable.addAddressMapping(MappingSource.fromUser(USER1, Domain.LOCALHOST), USER2 + "@domain.tld");
memoryRecipientRewriteTable.addAddressMapping(MappingSource.fromUser(USER2, DOMAIN_1), USER1 + "@domain.tld");
// The loop needs to be created by a domain mapping
@@ -209,7 +209,7 @@ public class ValidRcptHandlerTest {
}
@Test
- public void doRcptShouldDeclineWhenHasErrorMapping() throws Exception {
+ void doRcptShouldDeclineWhenHasErrorMapping() throws Exception {
memoryRecipientRewriteTable.addErrorMapping(MappingSource.fromUser(USER1, Domain.LOCALHOST), "554 BOUNCE");
SMTPSession session = setupMockedSMTPSession(!RELAYING_ALLOWED);
diff --git a/third-party/spamassassin/src/test/java/org/apache/james/spamassassin/mock/MockSpamdExtension.java b/third-party/spamassassin/src/test/java/org/apache/james/spamassassin/mock/MockSpamdExtension.java
index 1440a79..c97bb51 100644
--- a/third-party/spamassassin/src/test/java/org/apache/james/spamassassin/mock/MockSpamdExtension.java
+++ b/third-party/spamassassin/src/test/java/org/apache/james/spamassassin/mock/MockSpamdExtension.java
@@ -24,10 +24,8 @@ import java.util.concurrent.Executors;
import org.apache.james.util.concurrent.NamedThreadFactory;
import org.junit.jupiter.api.extension.AfterEachCallback;
-import org.junit.jupiter.api.extension.BeforeAllCallback;
import org.junit.jupiter.api.extension.BeforeEachCallback;
import org.junit.jupiter.api.extension.ExtensionContext;
-import org.junit.rules.ExternalResource;
public class MockSpamdExtension implements AfterEachCallback, BeforeEachCallback {
---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@james.apache.org
For additional commands, e-mail: notifications-help@james.apache.org