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 03182dca75c0220d73f0dd997b47eb362219fa3c
Author: Benoit Tellier <[email protected]>
AuthorDate: Mon Feb 21 15:24:22 2022 +0700

    [SONAR] Solve some minor warnings in mailet projects
---
 .../james/jdkim/mailets/CRLFOutputStream.java      |   2 +
 .../jdkim/mailets/HeaderSkippingOutputStream.java  |   2 +
 .../mailetcontainer/impl/MailetConfigImpl.java     |   5 +-
 .../impl/jmx/MailProcessorManagement.java          |  11 --
 .../org/apache/james/transport/mailets/Bounce.java |   2 +-
 .../james/transport/mailets/RemoteDelivery.java    |   9 --
 .../transport/mailets/delivery/MailDispatcher.java |   3 +-
 .../transport/mailets/jsieve/RejectAction.java     |   2 +-
 .../mailets/jsieve/delivery/SieveExecutor.java     |   2 +-
 .../mailets/redirect/ProcessRedirectNotify.java    |   2 +-
 .../transport/mailets/remote/delivery/Bouncer.java |   2 +-
 .../mailets/remote/delivery/MailDelivrer.java      |   2 +-
 .../delivery/RemoteDeliveryConfiguration.java      |   6 +-
 .../delivery/RemoteDeliverySocketFactory.java      | 143 ---------------------
 .../transport/matchers/NetworkIsInWhitelist.java   |  12 +-
 .../transport/mailets/NotifyPostmasterTest.java    |   2 +-
 .../james/transport/mailets/NotifySenderTest.java  |   2 +-
 .../RecipientRewriteTableProcessorTest.java        |  10 +-
 .../mailets/RecipientRewriteTableTest.java         |   2 +-
 .../james/transport/mailets/RequeueTest.java       |   4 +-
 .../apache/james/transport/mailets/ResendTest.java |   2 +-
 .../transport/mailets/ResourceLocatorTest.java     |   4 +-
 .../james/transport/mailets/ToRepositoryTest.java  |   2 +-
 .../mailets/delivery/MailboxAppenderImplTest.java  |   2 +-
 .../managesieve/ManageSieveMailetTestCase.java     |   2 +-
 .../mailets/redirect/MailModifierTest.java         |  15 ++-
 .../mailets/redirect/MessageAlteringUtilsTest.java |   2 +-
 .../redirect/RedirectMailetInitParametersTest.java |  90 ++++++-------
 .../remote/delivery/HeloNameProviderTest.java      |   2 +-
 .../delivery/InternetAddressConverterTest.java     |   2 +-
 .../delivery/RemoteDeliveryConfigurationTest.java  |  10 +-
 .../remote/delivery/RemoteDeliveryTest.java        |   2 +-
 .../mailets/remote/delivery/RepeatTest.java        |   2 +-
 .../transport/matchers/IsMarkedAsSpamTest.java     |   2 +-
 .../james/transport/matchers/IsOverQuotaTest.java  |   2 +-
 .../IsRemoteDeliveryPermanentErrorTest.java        |   2 +-
 .../IsRemoteDeliveryTemporaryErrorTest.java        |   2 +-
 .../matchers/RemoteAddrInNetworkTest.java          |   2 +-
 .../RemoteDeliveryFailedWithSMTPCodeTest.java      |   2 +-
 .../james/transport/util/MailAddressUtilsTest.java |   2 +-
 .../transport/util/SpecialAddressesUtilsTest.java  |   2 +-
 .../james/rate/limiter/RedisExtensionTest.java     |   2 +-
 42 files changed, 100 insertions(+), 280 deletions(-)

diff --git 
a/server/mailet/dkim/src/main/java/org/apache/james/jdkim/mailets/CRLFOutputStream.java
 
b/server/mailet/dkim/src/main/java/org/apache/james/jdkim/mailets/CRLFOutputStream.java
index 5610cf0..d6d9084 100644
--- 
a/server/mailet/dkim/src/main/java/org/apache/james/jdkim/mailets/CRLFOutputStream.java
+++ 
b/server/mailet/dkim/src/main/java/org/apache/james/jdkim/mailets/CRLFOutputStream.java
@@ -68,6 +68,7 @@ public class CRLFOutputStream extends FilterOutputStream {
      * @throws IOException
      *             if an error occurs writing the byte
      */
+    @Override
     public void write(int b) throws IOException {
         switch (b) {
             case '\r':
@@ -107,6 +108,7 @@ public class CRLFOutputStream extends FilterOutputStream {
     /**
      * @see java.io.FilterOutputStream#write(byte[], int, int)
      */
+    @Override
     public synchronized void write(byte[] buffer, int offset, int length)
             throws IOException {
         /* optimized */
diff --git 
a/server/mailet/dkim/src/main/java/org/apache/james/jdkim/mailets/HeaderSkippingOutputStream.java
 
b/server/mailet/dkim/src/main/java/org/apache/james/jdkim/mailets/HeaderSkippingOutputStream.java
index 5ccfbb0..46f5178 100644
--- 
a/server/mailet/dkim/src/main/java/org/apache/james/jdkim/mailets/HeaderSkippingOutputStream.java
+++ 
b/server/mailet/dkim/src/main/java/org/apache/james/jdkim/mailets/HeaderSkippingOutputStream.java
@@ -36,6 +36,7 @@ public class HeaderSkippingOutputStream extends 
FilterOutputStream {
         super(out);
     }
 
+    @Override
     public void write(byte[] b, int off, int len) throws IOException {
         if (inHeaders) {
             for (int i = off; i < off + len; i++) {
@@ -57,6 +58,7 @@ public class HeaderSkippingOutputStream extends 
FilterOutputStream {
         }
     }
 
+    @Override
     public void write(int b) throws IOException {
         if (inHeaders) {
             if (skipTo[pos] == b) {
diff --git 
a/server/mailet/mailetcontainer-impl/src/main/java/org/apache/james/mailetcontainer/impl/MailetConfigImpl.java
 
b/server/mailet/mailetcontainer-impl/src/main/java/org/apache/james/mailetcontainer/impl/MailetConfigImpl.java
index e5b30ab..d6ca5d4 100644
--- 
a/server/mailet/mailetcontainer-impl/src/main/java/org/apache/james/mailetcontainer/impl/MailetConfigImpl.java
+++ 
b/server/mailet/mailetcontainer-impl/src/main/java/org/apache/james/mailetcontainer/impl/MailetConfigImpl.java
@@ -44,10 +44,7 @@ public class MailetConfigImpl implements MailetConfig {
     /** The mailet name */
     private String name;
 
-    // This would probably be better.
-    // Properties params = new Properties();
-    // Instead, we're tied to the Configuration object
-    /** The mailet Avalon Configuration */
+    /** The mailet Configuration */
     private Configuration configuration;
 
     /**
diff --git 
a/server/mailet/mailetcontainer-impl/src/main/java/org/apache/james/mailetcontainer/impl/jmx/MailProcessorManagement.java
 
b/server/mailet/mailetcontainer-impl/src/main/java/org/apache/james/mailetcontainer/impl/jmx/MailProcessorManagement.java
index 893a83a..b8b6793 100644
--- 
a/server/mailet/mailetcontainer-impl/src/main/java/org/apache/james/mailetcontainer/impl/jmx/MailProcessorManagement.java
+++ 
b/server/mailet/mailetcontainer-impl/src/main/java/org/apache/james/mailetcontainer/impl/jmx/MailProcessorManagement.java
@@ -73,17 +73,6 @@ public class MailProcessorManagement extends StandardMBean 
implements MailProces
         return getSuccessCount() + getErrorCount();
     }
 
-    /*
-     * TODO
-     * Is deprecated or dead code? Can't find an interface defining this method
-     *
-     * @see
-     * 
org.apache.james.mailetcontainer.api.jmx.MailProcessorDetailMBean#getName()
-     */
-    public String getName() {
-        return processorName;
-    }
-
     @Override
     public long getFastestProcessing() {
         return fastestProcessing.get();
diff --git 
a/server/mailet/mailets/src/main/java/org/apache/james/transport/mailets/Bounce.java
 
b/server/mailet/mailets/src/main/java/org/apache/james/transport/mailets/Bounce.java
index 4b59cf6..2dee229 100644
--- 
a/server/mailet/mailets/src/main/java/org/apache/james/transport/mailets/Bounce.java
+++ 
b/server/mailet/mailets/src/main/java/org/apache/james/transport/mailets/Bounce.java
@@ -246,7 +246,7 @@ public class Bounce extends GenericMailet implements 
RedirectNotify {
         }
     }
 
-    private void passThrough(Mail originalMail) throws MessagingException {
+    private void passThrough(Mail originalMail) {
         if (getInitParameters().isDebug()) {
             LOGGER.debug("Processing a bounce request for a message with an 
empty reverse-path.  No bounce will be sent.");
         }
diff --git 
a/server/mailet/mailets/src/main/java/org/apache/james/transport/mailets/RemoteDelivery.java
 
b/server/mailet/mailets/src/main/java/org/apache/james/transport/mailets/RemoteDelivery.java
index 67e95d5..b0f080c 100644
--- 
a/server/mailet/mailets/src/main/java/org/apache/james/transport/mailets/RemoteDelivery.java
+++ 
b/server/mailet/mailets/src/main/java/org/apache/james/transport/mailets/RemoteDelivery.java
@@ -20,7 +20,6 @@
 package org.apache.james.transport.mailets;
 
 import java.io.IOException;
-import java.net.UnknownHostException;
 import java.util.Collection;
 import java.util.Map;
 
@@ -39,7 +38,6 @@ import org.apache.james.queue.api.MailQueueFactory;
 import org.apache.james.transport.mailets.remote.delivery.Bouncer;
 import org.apache.james.transport.mailets.remote.delivery.DeliveryRunnable;
 import 
org.apache.james.transport.mailets.remote.delivery.RemoteDeliveryConfiguration;
-import 
org.apache.james.transport.mailets.remote.delivery.RemoteDeliverySocketFactory;
 import org.apache.mailet.Mail;
 import org.apache.mailet.base.GenericMailet;
 import org.slf4j.Logger;
@@ -172,13 +170,6 @@ public class RemoteDelivery extends GenericMailet {
     public void init() throws MessagingException {
         configuration = new RemoteDeliveryConfiguration(getMailetConfig(), 
domainList);
         queue = queueFactory.createQueue(configuration.getOutGoingQueueName());
-        try {
-            if (configuration.isBindUsed()) {
-                
RemoteDeliverySocketFactory.setBindAdress(configuration.getBindAddress());
-            }
-        } catch (UnknownHostException e) {
-            LOGGER.error("Invalid bind setting ({}): ", 
configuration.getBindAddress(), e);
-        }
         deliveryRunnable = new DeliveryRunnable(queue,
             configuration,
             dnsServer,
diff --git 
a/server/mailet/mailets/src/main/java/org/apache/james/transport/mailets/delivery/MailDispatcher.java
 
b/server/mailet/mailets/src/main/java/org/apache/james/transport/mailets/delivery/MailDispatcher.java
index a7eec28..b8cb379 100644
--- 
a/server/mailet/mailets/src/main/java/org/apache/james/transport/mailets/delivery/MailDispatcher.java
+++ 
b/server/mailet/mailets/src/main/java/org/apache/james/transport/mailets/delivery/MailDispatcher.java
@@ -129,8 +129,7 @@ public class MailDispatcher {
         // This only works because there is a placeholder inserted by 
MimeMessageWrapper
         message.setHeader(RFC2822Headers.RETURN_PATH, 
mail.getMaybeSender().asPrettyString());
 
-        List<MailAddress> errors = deliver(mail, message);
-        return errors;
+        return deliver(mail, message);
     }
 
     private List<MailAddress> deliver(Mail mail, MimeMessage message) {
diff --git 
a/server/mailet/mailets/src/main/java/org/apache/james/transport/mailets/jsieve/RejectAction.java
 
b/server/mailet/mailets/src/main/java/org/apache/james/transport/mailets/jsieve/RejectAction.java
index fd8a898..a35ebc6 100644
--- 
a/server/mailet/mailets/src/main/java/org/apache/james/transport/mailets/jsieve/RejectAction.java
+++ 
b/server/mailet/mailets/src/main/java/org/apache/james/transport/mailets/jsieve/RejectAction.java
@@ -142,7 +142,7 @@ public class RejectAction implements MailAction {
             MailImpl mail = MailImpl.builder()
                 .name(MailImpl.getId())
                 .addRecipients(Arrays.stream(recipientAddresses)
-                    .map(address -> (InternetAddress) address)
+                    .map(InternetAddress.class::cast)
                     .map(Throwing.function(MailAddress::new))
                     .collect(ImmutableList.toImmutableList()))
                 .mimeMessage(reply)
diff --git 
a/server/mailet/mailets/src/main/java/org/apache/james/transport/mailets/jsieve/delivery/SieveExecutor.java
 
b/server/mailet/mailets/src/main/java/org/apache/james/transport/mailets/jsieve/delivery/SieveExecutor.java
index e6d9a7a..ad79440 100644
--- 
a/server/mailet/mailets/src/main/java/org/apache/james/transport/mailets/jsieve/delivery/SieveExecutor.java
+++ 
b/server/mailet/mailets/src/main/java/org/apache/james/transport/mailets/jsieve/delivery/SieveExecutor.java
@@ -119,7 +119,7 @@ public class SieveExecutor {
         Preconditions.checkNotNull(recipient, "Recipient for mail to be 
spooled cannot be null.");
         Preconditions.checkNotNull(mail.getMessage(), "Mail message to be 
spooled cannot be null.");
         boolean isSieveNotification = 
AttributeUtils.getValueAndCastFromMail(mail, SIEVE_NOTIFICATION, 
Boolean.class).orElse(false);
-        return !isSieveNotification ? sieveMessage(recipient, mail) : false;
+        return !isSieveNotification && sieveMessage(recipient, mail);
     }
 
     private boolean sieveMessage(MailAddress recipient, Mail aMail) {
diff --git 
a/server/mailet/mailets/src/main/java/org/apache/james/transport/mailets/redirect/ProcessRedirectNotify.java
 
b/server/mailet/mailets/src/main/java/org/apache/james/transport/mailets/redirect/ProcessRedirectNotify.java
index 7bb7366..e59e539 100644
--- 
a/server/mailet/mailets/src/main/java/org/apache/james/transport/mailets/redirect/ProcessRedirectNotify.java
+++ 
b/server/mailet/mailets/src/main/java/org/apache/james/transport/mailets/redirect/ProcessRedirectNotify.java
@@ -178,7 +178,7 @@ public class ProcessRedirectNotify {
      *         true for the sender host part
      */
     @SuppressWarnings("deprecation")
-    private boolean senderDomainIsValid(Mail mail) throws MessagingException {
+    private boolean senderDomainIsValid(Mail mail) {
         return !mailet.getInitParameters().getFakeDomainCheck()
                 || !mail.hasSender()
                 || !mailet.getMailetContext()
diff --git 
a/server/mailet/mailets/src/main/java/org/apache/james/transport/mailets/remote/delivery/Bouncer.java
 
b/server/mailet/mailets/src/main/java/org/apache/james/transport/mailets/remote/delivery/Bouncer.java
index 92ae455..f5e2789 100644
--- 
a/server/mailet/mailets/src/main/java/org/apache/james/transport/mailets/remote/delivery/Bouncer.java
+++ 
b/server/mailet/mailets/src/main/java/org/apache/james/transport/mailets/remote/delivery/Bouncer.java
@@ -73,7 +73,7 @@ public class Bouncer {
 
     private Optional<Attribute> computeErrorCode(Exception ex) {
         return Optional.ofNullable(ex)
-            .filter(e -> e instanceof MessagingException)
+            .filter(MessagingException.class::isInstance)
             .map(MessagingException.class::cast)
             .map(EnhancedMessagingException::new)
             .flatMap(EnhancedMessagingException::getReturnCode)
diff --git 
a/server/mailet/mailets/src/main/java/org/apache/james/transport/mailets/remote/delivery/MailDelivrer.java
 
b/server/mailet/mailets/src/main/java/org/apache/james/transport/mailets/remote/delivery/MailDelivrer.java
index 04dfa2f..34dd22a 100644
--- 
a/server/mailet/mailets/src/main/java/org/apache/james/transport/mailets/remote/delivery/MailDelivrer.java
+++ 
b/server/mailet/mailets/src/main/java/org/apache/james/transport/mailets/remote/delivery/MailDelivrer.java
@@ -187,7 +187,7 @@ public class MailDelivrer {
 
     private MessagingException handleMessagingException(Mail mail, 
MessagingException me) throws MessagingException {
         LOGGER.debug("Exception delivering message ({}) - {}", mail.getName(), 
me.getMessage());
-        if ((me.getNextException() != null) && (me.getNextException() 
instanceof IOException)) {
+        if (me.getNextException() instanceof IOException) {
             // If it's an IO exception with no nested exception, it's probably
             // some socket or weird I/O related problem.
             return me;
diff --git 
a/server/mailet/mailets/src/main/java/org/apache/james/transport/mailets/remote/delivery/RemoteDeliveryConfiguration.java
 
b/server/mailet/mailets/src/main/java/org/apache/james/transport/mailets/remote/delivery/RemoteDeliveryConfiguration.java
index 036106e..493a15a 100644
--- 
a/server/mailet/mailets/src/main/java/org/apache/james/transport/mailets/remote/delivery/RemoteDeliveryConfiguration.java
+++ 
b/server/mailet/mailets/src/main/java/org/apache/james/transport/mailets/remote/delivery/RemoteDeliveryConfiguration.java
@@ -237,11 +237,7 @@ public class RemoteDeliveryConfiguration {
         props.put("mail." + protocol + ".localhost", 
heloNameProvider.getHeloName());
         props.put("mail." + protocol + ".starttls.enable", 
String.valueOf(startTLS));
         if (isBindUsed()) {
-            // undocumented JavaMail 1.2 feature, smtp transport will use
-            // our socket factory, which will also set the local address
-            props.put("mail." + protocol + ".socketFactory.class", 
RemoteDeliverySocketFactory.class);
-            // Don't fallback to the standard socket factory on error, do 
throw an exception
-            props.put("mail." + protocol + ".socketFactory.fallback", "false");
+            props.put("mail." + protocol + ".localaddress", bindAddress);
         }
         if (authUser != null) {
             props.put("mail." + protocol + ".auth", "true");
diff --git 
a/server/mailet/mailets/src/main/java/org/apache/james/transport/mailets/remote/delivery/RemoteDeliverySocketFactory.java
 
b/server/mailet/mailets/src/main/java/org/apache/james/transport/mailets/remote/delivery/RemoteDeliverySocketFactory.java
deleted file mode 100644
index cd22059..0000000
--- 
a/server/mailet/mailets/src/main/java/org/apache/james/transport/mailets/remote/delivery/RemoteDeliverySocketFactory.java
+++ /dev/null
@@ -1,143 +0,0 @@
-/****************************************************************
- * Licensed to the Apache Software Foundation (ASF) under one   *
- * or more contributor license agreements.  See the NOTICE file *
- * distributed with this work for additional information        *
- * regarding copyright ownership.  The ASF licenses this file   *
- * to you under the Apache License, Version 2.0 (the            *
- * "License"); you may not use this file except in compliance   *
- * with the License.  You may obtain a copy of the License at   *
- *                                                              *
- *   http://www.apache.org/licenses/LICENSE-2.0                 *
- *                                                              *
- * Unless required by applicable law or agreed to in writing,   *
- * software distributed under the License is distributed on an  *
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY       *
- * KIND, either express or implied.  See the License for the    *
- * specific language governing permissions and limitations      *
- * under the License.                                           *
- ****************************************************************/
-
-package org.apache.james.transport.mailets.remote.delivery;
-
-import java.io.IOException;
-import java.net.InetAddress;
-import java.net.InetSocketAddress;
-import java.net.Socket;
-import java.net.UnknownHostException;
-
-import javax.net.SocketFactory;
-
-/**
- * <p>
- * It is used by RemoteDelivery in order to make possible to bind the client
- * socket to a specific ip address.
- * </p>
- * <p>
- * This is not a nice solution because the ip address must be shared by all
- * RemoteDelivery instances. It would be better to modify JavaMail (current
- * version 1.3) to support a corresonding property, e.g. mail.smtp.bindAdress.
- * </p>
- * <p>
- * This used to not extend javax.net.SocketFactory descendant, because
- * <ol>
- * <li>
- * it was not necessary because JavaMail 1.2 uses reflection when accessing 
this
- * class;</li>
- * <li>
- * it was not desirable because it would require java 1.4.</li>
- * </ol>
- * </p>
- * <p>
- * But since James 2.3.0a1:
- * <ol>
- * <li>we require Java 1.4 so the dependency on SocketFactory is not really an
- * issue;</li>
- * <li>Javamail 1.4 cast the object returned by getDefault to SocketFactory and
- * fails to create the socket if we don't extend SocketFactory.</li>
- * </ol>
- * </p>
- * <p>
- * <strong>Note</strong>: Javamail 1.4 should correctly support
- * mail.smtp.localaddr so we could probably get rid of this class and simply 
add
- * that property to the Session.
- * </p>
- */
-public class RemoteDeliverySocketFactory extends SocketFactory {
-
-    /**
-     * @param addr
-     *            the ip address or host name the delivery socket will bind to
-     */
-    public static void setBindAdress(String addr) throws UnknownHostException {
-        if (addr == null) {
-            bindAddress = null;
-        } else {
-            bindAddress = InetAddress.getByName(addr);
-        }
-    }
-
-    /**
-     * the same as the similarly named javax.net.SocketFactory operation.
-     */
-    public static SocketFactory getDefault() {
-        return new RemoteDeliverySocketFactory();
-    }
-
-    /**
-     * the same as the similarly named javax.net.SocketFactory operation. Just
-     * to be safe, it is not used by JavaMail 1.3. This is the only method used
-     * by JavaMail 1.4.
-     */
-    @Override
-    public Socket createSocket() throws IOException {
-        Socket s = new Socket();
-        s.bind(new InetSocketAddress(bindAddress, 0));
-        return s;
-    }
-
-    /**
-     * the same as the similarly named javax.net.SocketFactory operation. This
-     * is the one which is used by JavaMail 1.3. This is not used by JavaMail
-     * 1.4.
-     */
-    @Override
-    public Socket createSocket(String host, int port) throws IOException {
-        return new Socket(host, port, bindAddress, 0);
-    }
-
-    /**
-     * the same as the similarly named javax.net.SocketFactory operation. Just
-     * to be safe, it is not used by JavaMail 1.3. This is not used by JavaMail
-     * 1.4.
-     */
-    @Override
-    public Socket createSocket(String host, int port, InetAddress clientHost, 
int clientPort) throws IOException {
-        return new Socket(host, port, clientHost == null ? bindAddress : 
clientHost, clientPort);
-    }
-
-    /**
-     * the same as the similarly named javax.net.SocketFactory operation. Just
-     * to be safe, it is not used by JavaMail 1.3. This is not used by JavaMail
-     * 1.4.
-     */
-    @Override
-    public Socket createSocket(InetAddress host, int port) throws IOException {
-        return new Socket(host, port, bindAddress, 0);
-    }
-
-    /**
-     * the same as the similarly named javax.net.SocketFactory operation. Just
-     * to be safe, it is not used by JavaMail 1.3. This is not used by JavaMail
-     * 1.4.
-     */
-    @Override
-    public Socket createSocket(InetAddress address, int port, InetAddress 
clientAddress, int clientPort) throws IOException {
-        return new Socket(address, port, clientAddress == null ? bindAddress : 
clientAddress, clientPort);
-    }
-
-    /**
-     * it should be set by setBindAdress(). Null means the socket is bind to 
the
-     * default address.
-     */
-    private static InetAddress bindAddress;
-}
diff --git 
a/server/mailet/mailets/src/main/java/org/apache/james/transport/matchers/NetworkIsInWhitelist.java
 
b/server/mailet/mailets/src/main/java/org/apache/james/transport/matchers/NetworkIsInWhitelist.java
index 46e5df2..a582246 100644
--- 
a/server/mailet/mailets/src/main/java/org/apache/james/transport/matchers/NetworkIsInWhitelist.java
+++ 
b/server/mailet/mailets/src/main/java/org/apache/james/transport/matchers/NetworkIsInWhitelist.java
@@ -34,8 +34,6 @@ import org.apache.james.dnsservice.api.DNSService;
 import org.apache.james.dnsservice.library.netmatcher.NetMatcher;
 import org.apache.mailet.Experimental;
 import org.apache.mailet.Mail;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
 
 /**
  * <p>
@@ -51,8 +49,6 @@ import org.slf4j.LoggerFactory;
  */
 @Experimental
 public class NetworkIsInWhitelist extends AbstractSQLWhitelistMatcher {
-    private static final Logger LOGGER = 
LoggerFactory.getLogger(NetworkIsInWhitelist.class);
-
     private DNSService dns;
     private String selectNetworks;
 
@@ -87,15 +83,11 @@ public class NetworkIsInWhitelist extends 
AbstractSQLWhitelistMatcher {
             String recipientUser = 
recipientMailAddress.getLocalPart().toLowerCase(Locale.US);
             String recipientHost = recipientMailAddress.getDomain().asString();
 
-            if (conn == null) {
-                conn = datasource.getConnection();
-            }
+            conn = datasource.getConnection();
 
             List<String> nets = new ArrayList<>();
             try {
-                if (selectStmt == null) {
-                    selectStmt = conn.prepareStatement(selectNetworks);
-                }
+                selectStmt = conn.prepareStatement(selectNetworks);
                 selectStmt.setString(1, recipientUser);
                 selectStmt.setString(2, recipientHost);
                 selectRS = selectStmt.executeQuery();
diff --git 
a/server/mailet/mailets/src/test/java/org/apache/james/transport/mailets/NotifyPostmasterTest.java
 
b/server/mailet/mailets/src/test/java/org/apache/james/transport/mailets/NotifyPostmasterTest.java
index 8c50ca3..5d967fc 100644
--- 
a/server/mailet/mailets/src/test/java/org/apache/james/transport/mailets/NotifyPostmasterTest.java
+++ 
b/server/mailet/mailets/src/test/java/org/apache/james/transport/mailets/NotifyPostmasterTest.java
@@ -39,7 +39,7 @@ import org.apache.mailet.base.test.FakeMailetConfig;
 import org.junit.jupiter.api.BeforeEach;
 import org.junit.jupiter.api.Test;
 
-public class NotifyPostmasterTest {
+class NotifyPostmasterTest {
 
     private static final String MAILET_NAME = "mailetName";
 
diff --git 
a/server/mailet/mailets/src/test/java/org/apache/james/transport/mailets/NotifySenderTest.java
 
b/server/mailet/mailets/src/test/java/org/apache/james/transport/mailets/NotifySenderTest.java
index 665777d..eae8ba8 100644
--- 
a/server/mailet/mailets/src/test/java/org/apache/james/transport/mailets/NotifySenderTest.java
+++ 
b/server/mailet/mailets/src/test/java/org/apache/james/transport/mailets/NotifySenderTest.java
@@ -39,7 +39,7 @@ import org.apache.mailet.base.test.FakeMailetConfig;
 import org.junit.jupiter.api.BeforeEach;
 import org.junit.jupiter.api.Test;
 
-public class NotifySenderTest {
+class NotifySenderTest {
 
     private static final String MAILET_NAME = "mailetName";
 
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 9fee75e..1744358 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
@@ -22,29 +22,21 @@ package org.apache.james.transport.mailets;
 import static java.nio.charset.StandardCharsets.UTF_8;
 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;
 
 import javax.mail.MessagingException;
 import javax.mail.internet.MimeMessage;
 
-import org.apache.commons.configuration2.HierarchicalConfiguration;
 import org.apache.commons.configuration2.ex.ConfigurationException;
 import org.apache.james.core.Domain;
 import org.apache.james.core.MailAddress;
 import org.apache.james.dnsservice.api.InMemoryDNSService;
 import org.apache.james.domainlist.lib.DomainListConfiguration;
 import org.apache.james.domainlist.memory.MemoryDomainList;
-import org.apache.james.rrt.api.RecipientRewriteTable.ErrorMappingException;
 import org.apache.james.rrt.api.RecipientRewriteTableConfiguration;
-import org.apache.james.rrt.api.RecipientRewriteTableException;
 import org.apache.james.rrt.lib.Mapping;
 import org.apache.james.rrt.lib.MappingSource;
-import org.apache.james.rrt.lib.Mappings;
 import org.apache.james.rrt.lib.MappingsImpl;
 import org.apache.james.rrt.memory.MemoryRecipientRewriteTable;
 import org.apache.james.util.MimeMessageUtil;
@@ -94,7 +86,7 @@ class RecipientRewriteTableProcessorTest {
     }
 
     @Test
-    public void 
handleMappingsShouldThrowExceptionWhenMappingsContainAtLeastOneNoneDomainObjectButCannotGetDefaultDomain()
 throws Exception {
+    void 
handleMappingsShouldThrowExceptionWhenMappingsContainAtLeastOneNoneDomainObjectButCannotGetDefaultDomain()
 throws Exception {
         mappings = MappingsImpl.builder()
                 .add(MailAddressFixture.ANY_AT_JAMES.toString())
                 .add(NONEDOMAIN)
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 a085170..49a09f0 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
@@ -65,7 +65,7 @@ class RecipientRewriteTableTest {
     }
 
     @Test
-    public void serviceShouldThrowExceptionWithNullMail() {
+    void serviceShouldThrowExceptionWithNullMail() {
         assertThatThrownBy(() -> mailet.service(null))
             .isInstanceOf(NullPointerException.class);
     }
diff --git 
a/server/mailet/mailets/src/test/java/org/apache/james/transport/mailets/RequeueTest.java
 
b/server/mailet/mailets/src/test/java/org/apache/james/transport/mailets/RequeueTest.java
index 84cef00..2893342 100644
--- 
a/server/mailet/mailets/src/test/java/org/apache/james/transport/mailets/RequeueTest.java
+++ 
b/server/mailet/mailets/src/test/java/org/apache/james/transport/mailets/RequeueTest.java
@@ -45,7 +45,7 @@ import org.junit.jupiter.api.Test;
 
 import reactor.core.publisher.Flux;
 
-public class RequeueTest {
+class RequeueTest {
     private Mail mailSample;
     private MailQueueFactory<?> mailQueueFactory;
     private MailQueue spoolQueue;
@@ -179,7 +179,7 @@ public class RequeueTest {
             .block();
 
         assertThat(mailQueueItem).isNotNull();
-        assertThat(Duration.between(enqueueTime, 
dequeueTime.get()).abs().toSeconds()).isEqualTo(0);
+        assertThat(Duration.between(enqueueTime, 
dequeueTime.get()).abs().toSeconds()).isZero();
     }
 
     @Test
diff --git 
a/server/mailet/mailets/src/test/java/org/apache/james/transport/mailets/ResendTest.java
 
b/server/mailet/mailets/src/test/java/org/apache/james/transport/mailets/ResendTest.java
index 92b8a4d..260a05b 100644
--- 
a/server/mailet/mailets/src/test/java/org/apache/james/transport/mailets/ResendTest.java
+++ 
b/server/mailet/mailets/src/test/java/org/apache/james/transport/mailets/ResendTest.java
@@ -39,7 +39,7 @@ import org.apache.mailet.base.test.FakeMailetConfig;
 import org.junit.jupiter.api.BeforeEach;
 import org.junit.jupiter.api.Test;
 
-public class ResendTest {
+class ResendTest {
 
     private static final String MAILET_NAME = "mailetName";
 
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 c630e90..c05d00f 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
@@ -53,7 +53,7 @@ class ResourceLocatorTest {
     }
 
     @Test
-    public void resourceLocatorImplShouldPropagateScriptNotFound() throws 
Exception {
+    void resourceLocatorImplShouldPropagateScriptNotFound() throws Exception {
         when(sieveRepository.getActive(USERNAME)).thenThrow(new 
ScriptNotFoundException());
         
when(usersRepository.getUsername(mailAddress)).thenReturn(Username.of(RECEIVER_LOCALHOST));
 
@@ -62,7 +62,7 @@ class ResourceLocatorTest {
     }
 
     @Test
-    public void resourceLocatorImplShouldWork() throws Exception {
+    void resourceLocatorImplShouldWork() throws Exception {
         InputStream inputStream = new ByteArrayInputStream(new byte[0]);
         when(sieveRepository.getActive(USERNAME)).thenReturn(inputStream);
         
when(usersRepository.getUsername(mailAddress)).thenReturn(Username.of(RECEIVER_LOCALHOST));
diff --git 
a/server/mailet/mailets/src/test/java/org/apache/james/transport/mailets/ToRepositoryTest.java
 
b/server/mailet/mailets/src/test/java/org/apache/james/transport/mailets/ToRepositoryTest.java
index 7ed4d8b..0a25b79 100644
--- 
a/server/mailet/mailets/src/test/java/org/apache/james/transport/mailets/ToRepositoryTest.java
+++ 
b/server/mailet/mailets/src/test/java/org/apache/james/transport/mailets/ToRepositoryTest.java
@@ -37,7 +37,7 @@ import org.apache.mailet.base.test.MailUtil;
 import org.junit.jupiter.api.BeforeEach;
 import org.junit.jupiter.api.Test;
 
-public class ToRepositoryTest {
+class ToRepositoryTest {
     public static final String REPOSITORY_PATH = "file://var/mail/any";
 
     private ToRepository mailet;
diff --git 
a/server/mailet/mailets/src/test/java/org/apache/james/transport/mailets/delivery/MailboxAppenderImplTest.java
 
b/server/mailet/mailets/src/test/java/org/apache/james/transport/mailets/delivery/MailboxAppenderImplTest.java
index 2dd8544..e50ffa4 100644
--- 
a/server/mailet/mailets/src/test/java/org/apache/james/transport/mailets/delivery/MailboxAppenderImplTest.java
+++ 
b/server/mailet/mailets/src/test/java/org/apache/james/transport/mailets/delivery/MailboxAppenderImplTest.java
@@ -43,7 +43,7 @@ import org.junit.jupiter.api.Test;
 
 import reactor.core.publisher.Mono;
 
-public class MailboxAppenderImplTest {
+class MailboxAppenderImplTest {
 
     public static final Username USER = Username.of("user");
     public static final String FOLDER = "folder";
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 dc1fd8d..cdb0475 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
@@ -60,7 +60,7 @@ import org.junit.jupiter.api.Test;
 
 import com.google.common.collect.Lists;
 
-public class ManageSieveMailetTestCase {
+class ManageSieveMailetTestCase {
 
     public static final Username USERNAME = Username.of("test@localhost");
     public static final ScriptName SCRIPT_NAME = new ScriptName("scriptName");
diff --git 
a/server/mailet/mailets/src/test/java/org/apache/james/transport/mailets/redirect/MailModifierTest.java
 
b/server/mailet/mailets/src/test/java/org/apache/james/transport/mailets/redirect/MailModifierTest.java
index d15d6f2..a10f82c 100644
--- 
a/server/mailet/mailets/src/test/java/org/apache/james/transport/mailets/redirect/MailModifierTest.java
+++ 
b/server/mailet/mailets/src/test/java/org/apache/james/transport/mailets/redirect/MailModifierTest.java
@@ -18,6 +18,7 @@
  ****************************************************************/
 package org.apache.james.transport.mailets.redirect;
 
+import static org.assertj.core.api.Assertions.assertThatCode;
 import static org.assertj.core.api.Assertions.assertThatThrownBy;
 import static org.mockito.Mockito.mock;
 
@@ -25,7 +26,7 @@ import org.apache.james.dnsservice.api.DNSService;
 import org.apache.james.server.core.MailImpl;
 import org.junit.jupiter.api.Test;
 
-public class MailModifierTest {
+class MailModifierTest {
 
     @Test
     void buildShouldThrowWhenMailetIsNull() {
@@ -55,10 +56,12 @@ public class MailModifierTest {
 
     @Test
     void buildShouldWorkWhenEverythingProvided() {
-        MailModifier.builder()
-            .mailet(mock(RedirectNotify.class))
-            .mail(mock(MailImpl.class))
-            .dns(mock(DNSService.class))
-            .build();
+        assertThatCode(() ->
+            MailModifier.builder()
+                .mailet(mock(RedirectNotify.class))
+                .mail(mock(MailImpl.class))
+                .dns(mock(DNSService.class))
+                .build())
+            .doesNotThrowAnyException();
     }
 }
diff --git 
a/server/mailet/mailets/src/test/java/org/apache/james/transport/mailets/redirect/MessageAlteringUtilsTest.java
 
b/server/mailet/mailets/src/test/java/org/apache/james/transport/mailets/redirect/MessageAlteringUtilsTest.java
index 9b7da2a..9fab2d8 100644
--- 
a/server/mailet/mailets/src/test/java/org/apache/james/transport/mailets/redirect/MessageAlteringUtilsTest.java
+++ 
b/server/mailet/mailets/src/test/java/org/apache/james/transport/mailets/redirect/MessageAlteringUtilsTest.java
@@ -25,7 +25,7 @@ import static org.mockito.Mockito.mock;
 import org.apache.mailet.Mail;
 import org.junit.jupiter.api.Test;
 
-public class MessageAlteringUtilsTest {
+class MessageAlteringUtilsTest {
 
     @Test
     void buildShouldThrowWhenMailetIsNull() {
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 5f3b11c..067d064 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
@@ -43,7 +43,7 @@ class RedirectMailetInitParametersTest {
     }
 
     @Test
-    public void getPassThroughShouldReturnTrueWhenSetToTrue() throws Exception 
{
+    void getPassThroughShouldReturnTrueWhenSetToTrue() throws Exception {
         FakeMailetConfig mailetConfig = FakeMailetConfig.builder()
                 .mailetName("mailet")
                 .setProperty("passThrough", "true")
@@ -56,7 +56,7 @@ class RedirectMailetInitParametersTest {
     }
 
     @Test
-    public void getPassThroughShouldReturnFalseWhenSetToFalse() throws 
Exception {
+    void getPassThroughShouldReturnFalseWhenSetToFalse() throws Exception {
         FakeMailetConfig mailetConfig = FakeMailetConfig.builder()
                 .mailetName("mailet")
                 .setProperty("passThrough", "false")
@@ -69,7 +69,7 @@ class RedirectMailetInitParametersTest {
     }
 
     @Test
-    public void getPassThroughShouldReturnFalseWhenNotSet() throws Exception {
+    void getPassThroughShouldReturnFalseWhenNotSet() throws Exception {
         FakeMailetConfig mailetConfig = FakeMailetConfig.builder()
                 .mailetName("mailet")
                 .build();
@@ -81,7 +81,7 @@ class RedirectMailetInitParametersTest {
     }
 
     @Test
-    public void getFakeDomainCheckShouldReturnTrueWhenSetToTrue() throws 
Exception {
+    void getFakeDomainCheckShouldReturnTrueWhenSetToTrue() throws Exception {
         FakeMailetConfig mailetConfig = FakeMailetConfig.builder()
                 .mailetName("mailet")
                 .setProperty("fakeDomainCheck", "true")
@@ -94,7 +94,7 @@ class RedirectMailetInitParametersTest {
     }
 
     @Test
-    public void getFakeDomainCheckShouldReturnFalseWhenSetToFalse() throws 
Exception {
+    void getFakeDomainCheckShouldReturnFalseWhenSetToFalse() throws Exception {
         FakeMailetConfig mailetConfig = FakeMailetConfig.builder()
                 .mailetName("mailet")
                 .setProperty("fakeDomainCheck", "false")
@@ -107,7 +107,7 @@ class RedirectMailetInitParametersTest {
     }
 
     @Test
-    public void getFakeDomainCheckShouldReturnFalseWhenNotSet() throws 
Exception {
+    void getFakeDomainCheckShouldReturnFalseWhenNotSet() throws Exception {
         FakeMailetConfig mailetConfig = FakeMailetConfig.builder()
                 .mailetName("mailet")
                 .build();
@@ -119,7 +119,7 @@ class RedirectMailetInitParametersTest {
     }
 
     @Test
-    public void getInLineTypeShouldReturnValueWhenSet() throws Exception {
+    void getInLineTypeShouldReturnValueWhenSet() throws Exception {
         FakeMailetConfig mailetConfig = FakeMailetConfig.builder()
                 .mailetName("mailet")
                 .setProperty("inline", "none")
@@ -132,7 +132,7 @@ class RedirectMailetInitParametersTest {
     }
 
     @Test
-    public void getInLineTypeShouldReturnNoneWhenNotSet() throws Exception {
+    void getInLineTypeShouldReturnNoneWhenNotSet() throws Exception {
         FakeMailetConfig mailetConfig = FakeMailetConfig.builder()
                 .mailetName("mailet")
                 .build();
@@ -144,7 +144,7 @@ class RedirectMailetInitParametersTest {
     }
 
     @Test
-    public void getAttachmentTypeShouldReturnValueWhenSet() throws Exception {
+    void getAttachmentTypeShouldReturnValueWhenSet() throws Exception {
         FakeMailetConfig mailetConfig = FakeMailetConfig.builder()
                 .mailetName("mailet")
                 .setProperty("attachment", "unaltered")
@@ -157,7 +157,7 @@ class RedirectMailetInitParametersTest {
     }
 
     @Test
-    public void getAttachmentTypeShouldReturnMessageWhenNotSet() throws 
Exception {
+    void getAttachmentTypeShouldReturnMessageWhenNotSet() throws Exception {
         FakeMailetConfig mailetConfig = FakeMailetConfig.builder()
                 .mailetName("mailet")
                 .build();
@@ -169,7 +169,7 @@ class RedirectMailetInitParametersTest {
     }
 
     @Test
-    public void getMessageShouldReturnMessageValueWhenSet() throws Exception {
+    void getMessageShouldReturnMessageValueWhenSet() throws Exception {
         FakeMailetConfig mailetConfig = FakeMailetConfig.builder()
                 .mailetName("mailet")
                 .setProperty("message", "my message")
@@ -182,7 +182,7 @@ class RedirectMailetInitParametersTest {
     }
 
     @Test
-    public void getMessageShouldReturnEmptyWhenNotSet() throws Exception {
+    void getMessageShouldReturnEmptyWhenNotSet() throws Exception {
         FakeMailetConfig mailetConfig = FakeMailetConfig.builder()
                 .mailetName("mailet")
                 .build();
@@ -190,11 +190,11 @@ class RedirectMailetInitParametersTest {
         InitParameters testee = RedirectMailetInitParameters.from(mailet);
 
         String message = testee.getMessage();
-        assertThat(message).isEqualTo("");
+        assertThat(message).isEmpty();
     }
 
     @Test
-    public void getSubjectShouldReturnValueWhenSet() throws Exception {
+    void getSubjectShouldReturnValueWhenSet() throws Exception {
         FakeMailetConfig mailetConfig = FakeMailetConfig.builder()
                 .mailetName("mailet")
                 .setProperty("subject", "my subject")
@@ -207,7 +207,7 @@ class RedirectMailetInitParametersTest {
     }
 
     @Test
-    public void getSubjectShouldReturnNullWhenNotSet() throws Exception {
+    void getSubjectShouldReturnNullWhenNotSet() throws Exception {
         FakeMailetConfig mailetConfig = FakeMailetConfig.builder()
                 .mailetName("mailet")
                 .build();
@@ -219,7 +219,7 @@ class RedirectMailetInitParametersTest {
     }
 
     @Test
-    public void getSubjectPrefixShouldReturnValueWhenSet() throws Exception {
+    void getSubjectPrefixShouldReturnValueWhenSet() throws Exception {
         FakeMailetConfig mailetConfig = FakeMailetConfig.builder()
                 .mailetName("mailet")
                 .setProperty("prefix", "my prefix")
@@ -232,7 +232,7 @@ class RedirectMailetInitParametersTest {
     }
 
     @Test
-    public void getSubjectPrefixShouldReturnNullWhenNotSet() throws Exception {
+    void getSubjectPrefixShouldReturnNullWhenNotSet() throws Exception {
         FakeMailetConfig mailetConfig = FakeMailetConfig.builder()
                 .mailetName("mailet")
                 .build();
@@ -244,7 +244,7 @@ class RedirectMailetInitParametersTest {
     }
 
     @Test
-    public void isAttachErrorShouldReturnTrueWhenSetToTrue() throws Exception {
+    void isAttachErrorShouldReturnTrueWhenSetToTrue() throws Exception {
         FakeMailetConfig mailetConfig = FakeMailetConfig.builder()
                 .mailetName("mailet")
                 .setProperty("attachError", "true")
@@ -257,7 +257,7 @@ class RedirectMailetInitParametersTest {
     }
 
     @Test
-    public void isAttachErrorShouldReturnFalseWhenSetToFalse() throws 
Exception {
+    void isAttachErrorShouldReturnFalseWhenSetToFalse() throws Exception {
         FakeMailetConfig mailetConfig = FakeMailetConfig.builder()
                 .mailetName("mailet")
                 .setProperty("attachError", "false")
@@ -270,7 +270,7 @@ class RedirectMailetInitParametersTest {
     }
 
     @Test
-    public void isAttachErrorShouldReturnFalseWhenNotSet() throws Exception {
+    void isAttachErrorShouldReturnFalseWhenNotSet() throws Exception {
         FakeMailetConfig mailetConfig = FakeMailetConfig.builder()
                 .mailetName("mailet")
                 .build();
@@ -282,7 +282,7 @@ class RedirectMailetInitParametersTest {
     }
 
     @Test
-    public void isReplyShouldReturnTrueWhenSetToTrue() throws Exception {
+    void isReplyShouldReturnTrueWhenSetToTrue() throws Exception {
         FakeMailetConfig mailetConfig = FakeMailetConfig.builder()
                 .mailetName("mailet")
                 .setProperty("isReply", "true")
@@ -295,7 +295,7 @@ class RedirectMailetInitParametersTest {
     }
 
     @Test
-    public void isReplyShouldReturnFalseWhenSetToFalse() throws Exception {
+    void isReplyShouldReturnFalseWhenSetToFalse() throws Exception {
         FakeMailetConfig mailetConfig = FakeMailetConfig.builder()
                 .mailetName("mailet")
                 .setProperty("isReply", "false")
@@ -308,7 +308,7 @@ class RedirectMailetInitParametersTest {
     }
 
     @Test
-    public void isReplyShouldReturnFalseWhenNotSet() throws Exception {
+    void isReplyShouldReturnFalseWhenNotSet() throws Exception {
         FakeMailetConfig mailetConfig = FakeMailetConfig.builder()
                 .mailetName("mailet")
                 .build();
@@ -320,7 +320,7 @@ class RedirectMailetInitParametersTest {
     }
 
     @Test
-    public void getRecipientsShouldReturnValueWhenSet() throws Exception {
+    void getRecipientsShouldReturnValueWhenSet() throws Exception {
         FakeMailetConfig mailetConfig = FakeMailetConfig.builder()
                 .mailetName("mailet")
                 .setProperty("recipients", "[email protected], [email protected]")
@@ -333,7 +333,7 @@ class RedirectMailetInitParametersTest {
     }
 
     @Test
-    public void getRecipientsShouldReturnAbsentWhenEmpty() throws Exception {
+    void getRecipientsShouldReturnAbsentWhenEmpty() throws Exception {
         FakeMailetConfig mailetConfig = FakeMailetConfig.builder()
                 .mailetName("mailet")
                 .setProperty("recipients", "")
@@ -346,7 +346,7 @@ class RedirectMailetInitParametersTest {
     }
 
     @Test
-    public void getRecipientsShouldReturnAbsentWhenNotSet() throws Exception {
+    void getRecipientsShouldReturnAbsentWhenNotSet() throws Exception {
         FakeMailetConfig mailetConfig = FakeMailetConfig.builder()
                 .mailetName("mailet")
                 .build();
@@ -358,7 +358,7 @@ class RedirectMailetInitParametersTest {
     }
 
     @Test
-    public void getToShouldReturnValueWhenSet() throws Exception {
+    void getToShouldReturnValueWhenSet() throws Exception {
         FakeMailetConfig mailetConfig = FakeMailetConfig.builder()
                 .mailetName("mailet")
                 .setProperty("to", "[email protected], [email protected]")
@@ -371,7 +371,7 @@ class RedirectMailetInitParametersTest {
     }
 
     @Test
-    public void getToShouldReturnAbsentWhenEmpty() throws Exception {
+    void getToShouldReturnAbsentWhenEmpty() throws Exception {
         FakeMailetConfig mailetConfig = FakeMailetConfig.builder()
                 .mailetName("mailet")
                 .setProperty("to", "")
@@ -384,7 +384,7 @@ class RedirectMailetInitParametersTest {
     }
 
     @Test
-    public void getToShouldReturnAbsentWhenNotSet() throws Exception {
+    void getToShouldReturnAbsentWhenNotSet() throws Exception {
         FakeMailetConfig mailetConfig = FakeMailetConfig.builder()
                 .mailetName("mailet")
                 .build();
@@ -396,7 +396,7 @@ class RedirectMailetInitParametersTest {
     }
 
     @Test
-    public void getReversePathShouldReturnValueWhenSet() throws Exception {
+    void getReversePathShouldReturnValueWhenSet() throws Exception {
         FakeMailetConfig mailetConfig = FakeMailetConfig.builder()
                 .mailetName("mailet")
                 .setProperty("reversePath", "[email protected], [email protected]")
@@ -409,7 +409,7 @@ class RedirectMailetInitParametersTest {
     }
 
     @Test
-    public void getReversePathShouldReturnAbsentWhenEmpty() throws Exception {
+    void getReversePathShouldReturnAbsentWhenEmpty() throws Exception {
         FakeMailetConfig mailetConfig = FakeMailetConfig.builder()
                 .mailetName("mailet")
                 .setProperty("reversePath", "")
@@ -422,7 +422,7 @@ class RedirectMailetInitParametersTest {
     }
 
     @Test
-    public void getReversePathShouldReturnAbsentWhenNotSet() throws Exception {
+    void getReversePathShouldReturnAbsentWhenNotSet() throws Exception {
         FakeMailetConfig mailetConfig = FakeMailetConfig.builder()
                 .mailetName("mailet")
                 .build();
@@ -434,7 +434,7 @@ class RedirectMailetInitParametersTest {
     }
 
     @Test
-    public void getSenderShouldReturnValueWhenSet() throws Exception {
+    void getSenderShouldReturnValueWhenSet() throws Exception {
         FakeMailetConfig mailetConfig = FakeMailetConfig.builder()
                 .mailetName("mailet")
                 .setProperty("sender", "[email protected], [email protected]")
@@ -447,7 +447,7 @@ class RedirectMailetInitParametersTest {
     }
 
     @Test
-    public void getSenderShouldReturnAbsentWhenEmpty() throws Exception {
+    void getSenderShouldReturnAbsentWhenEmpty() throws Exception {
         FakeMailetConfig mailetConfig = FakeMailetConfig.builder()
                 .mailetName("mailet")
                 .setProperty("sender", "")
@@ -460,7 +460,7 @@ class RedirectMailetInitParametersTest {
     }
 
     @Test
-    public void getSenderShouldReturnAbsentWhenNotSet() throws Exception {
+    void getSenderShouldReturnAbsentWhenNotSet() throws Exception {
         FakeMailetConfig mailetConfig = FakeMailetConfig.builder()
                 .mailetName("mailet")
                 .build();
@@ -472,7 +472,7 @@ class RedirectMailetInitParametersTest {
     }
 
     @Test
-    public void getReplyToShouldReturnValueWhenSet() throws Exception {
+    void getReplyToShouldReturnValueWhenSet() throws Exception {
         FakeMailetConfig mailetConfig = FakeMailetConfig.builder()
                 .mailetName("mailet")
                 .setProperty("replyTo", "[email protected], [email protected]")
@@ -485,7 +485,7 @@ class RedirectMailetInitParametersTest {
     }
 
     @Test
-    public void getReplyToShouldReturnreplytoValueWhenSet() throws Exception {
+    void getReplyToShouldReturnreplytoValueWhenSet() throws Exception {
         FakeMailetConfig mailetConfig = FakeMailetConfig.builder()
                 .mailetName("mailet")
                 .setProperty("replyto", "[email protected], [email protected]")
@@ -498,7 +498,7 @@ class RedirectMailetInitParametersTest {
     }
 
     @Test
-    public void getReplyToShouldReturnAbsentWhenEmpty() throws Exception {
+    void getReplyToShouldReturnAbsentWhenEmpty() throws Exception {
         FakeMailetConfig mailetConfig = FakeMailetConfig.builder()
                 .mailetName("mailet")
                 .setProperty("replyTo", "")
@@ -511,7 +511,7 @@ class RedirectMailetInitParametersTest {
     }
 
     @Test
-    public void getReplyToShouldReturnAbsentWhenNotSet() throws Exception {
+    void getReplyToShouldReturnAbsentWhenNotSet() throws Exception {
         FakeMailetConfig mailetConfig = FakeMailetConfig.builder()
                 .mailetName("mailet")
                 .build();
@@ -523,7 +523,7 @@ class RedirectMailetInitParametersTest {
     }
 
     @Test
-    public void isDebugShouldReturnTrueWhenSetToTrue() throws Exception {
+    void isDebugShouldReturnTrueWhenSetToTrue() throws Exception {
         FakeMailetConfig mailetConfig = FakeMailetConfig.builder()
                 .mailetName("mailet")
                 .setProperty("debug", "true")
@@ -536,7 +536,7 @@ class RedirectMailetInitParametersTest {
     }
 
     @Test
-    public void isDebugShouldReturnFalseWhenSetToFalse() throws Exception {
+    void isDebugShouldReturnFalseWhenSetToFalse() throws Exception {
         FakeMailetConfig mailetConfig = FakeMailetConfig.builder()
                 .mailetName("mailet")
                 .setProperty("debug", "false")
@@ -549,7 +549,7 @@ class RedirectMailetInitParametersTest {
     }
 
     @Test
-    public void isDebugShouldReturnFalseWhenNotSet() throws Exception {
+    void isDebugShouldReturnFalseWhenNotSet() throws Exception {
         FakeMailetConfig mailetConfig = FakeMailetConfig.builder()
                 .mailetName("mailet")
                 .build();
@@ -561,7 +561,7 @@ class RedirectMailetInitParametersTest {
     }
 
     @Test
-    public void isStaticShouldReturnTrueWhenSetToTrue() throws Exception {
+    void isStaticShouldReturnTrueWhenSetToTrue() throws Exception {
         FakeMailetConfig mailetConfig = FakeMailetConfig.builder()
                 .mailetName("mailet")
                 .setProperty("static", "true")
@@ -574,7 +574,7 @@ class RedirectMailetInitParametersTest {
     }
 
     @Test
-    public void isStaticShouldReturnFalseWhenSetToFalse() throws Exception {
+    void isStaticShouldReturnFalseWhenSetToFalse() throws Exception {
         FakeMailetConfig mailetConfig = FakeMailetConfig.builder()
                 .mailetName("mailet")
                 .setProperty("static", "false")
@@ -587,7 +587,7 @@ class RedirectMailetInitParametersTest {
     }
 
     @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/remote/delivery/HeloNameProviderTest.java
 
b/server/mailet/mailets/src/test/java/org/apache/james/transport/mailets/remote/delivery/HeloNameProviderTest.java
index 02be85f..b9b0cb7 100644
--- 
a/server/mailet/mailets/src/test/java/org/apache/james/transport/mailets/remote/delivery/HeloNameProviderTest.java
+++ 
b/server/mailet/mailets/src/test/java/org/apache/james/transport/mailets/remote/delivery/HeloNameProviderTest.java
@@ -30,7 +30,7 @@ import org.apache.james.domainlist.api.DomainListException;
 import org.junit.jupiter.api.BeforeEach;
 import org.junit.jupiter.api.Test;
 
-public class HeloNameProviderTest {
+class HeloNameProviderTest {
 
     public static final String DOMAIN = "domain";
 
diff --git 
a/server/mailet/mailets/src/test/java/org/apache/james/transport/mailets/remote/delivery/InternetAddressConverterTest.java
 
b/server/mailet/mailets/src/test/java/org/apache/james/transport/mailets/remote/delivery/InternetAddressConverterTest.java
index c49acda..d033e9a 100644
--- 
a/server/mailet/mailets/src/test/java/org/apache/james/transport/mailets/remote/delivery/InternetAddressConverterTest.java
+++ 
b/server/mailet/mailets/src/test/java/org/apache/james/transport/mailets/remote/delivery/InternetAddressConverterTest.java
@@ -29,7 +29,7 @@ import org.junit.jupiter.api.Test;
 
 import com.google.common.collect.ImmutableList;
 
-public class InternetAddressConverterTest {
+class InternetAddressConverterTest {
 
     @Test
     void convertShouldWorkWithEmptyAddressList() {
diff --git 
a/server/mailet/mailets/src/test/java/org/apache/james/transport/mailets/remote/delivery/RemoteDeliveryConfigurationTest.java
 
b/server/mailet/mailets/src/test/java/org/apache/james/transport/mailets/remote/delivery/RemoteDeliveryConfigurationTest.java
index 65d9de0..e888faf 100644
--- 
a/server/mailet/mailets/src/test/java/org/apache/james/transport/mailets/remote/delivery/RemoteDeliveryConfigurationTest.java
+++ 
b/server/mailet/mailets/src/test/java/org/apache/james/transport/mailets/remote/delivery/RemoteDeliveryConfigurationTest.java
@@ -33,7 +33,7 @@ import org.apache.mailet.base.test.FakeMailetConfig;
 import org.assertj.core.data.MapEntry;
 import org.junit.jupiter.api.Test;
 
-public class RemoteDeliveryConfigurationTest {
+class RemoteDeliveryConfigurationTest {
 
     @Test
     void isDebugShouldBeFalseByDefault() {
@@ -107,7 +107,7 @@ public class RemoteDeliveryConfigurationTest {
             .build();
 
         assertThat(new RemoteDeliveryConfiguration(mailetConfig, 
mock(DomainList.class)).getSmtpTimeout())
-            .isEqualTo(0);
+            .isZero();
     }
 
     @Test
@@ -177,7 +177,7 @@ public class RemoteDeliveryConfigurationTest {
             .build();
 
         assertThat(new RemoteDeliveryConfiguration(mailetConfig, 
mock(DomainList.class)).getConnectionTimeout())
-            .isEqualTo(0);
+            .isZero();
     }
 
     @Test
@@ -379,7 +379,7 @@ public class RemoteDeliveryConfigurationTest {
             .build();
 
         assertThat(new RemoteDeliveryConfiguration(mailetConfig, 
mock(DomainList.class)).getDnsProblemRetry())
-            .isEqualTo(0);
+            .isZero();
     }
 
     @Test
@@ -389,7 +389,7 @@ public class RemoteDeliveryConfigurationTest {
             .build();
 
         assertThat(new RemoteDeliveryConfiguration(mailetConfig, 
mock(DomainList.class)).getDnsProblemRetry())
-            .isEqualTo(0);
+            .isZero();
     }
 
     @Test
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 1445026..4694f6c 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
@@ -55,7 +55,7 @@ import org.junit.jupiter.api.Test;
 import com.google.common.collect.ImmutableList;
 import com.google.common.collect.ImmutableMap;
 
-public class RemoteDeliveryTest {
+class RemoteDeliveryTest {
 
     public static class MailProjection {
         public static MailProjection from(Mail mail) {
diff --git 
a/server/mailet/mailets/src/test/java/org/apache/james/transport/mailets/remote/delivery/RepeatTest.java
 
b/server/mailet/mailets/src/test/java/org/apache/james/transport/mailets/remote/delivery/RepeatTest.java
index 2ea3f56..61df5ea 100644
--- 
a/server/mailet/mailets/src/test/java/org/apache/james/transport/mailets/remote/delivery/RepeatTest.java
+++ 
b/server/mailet/mailets/src/test/java/org/apache/james/transport/mailets/remote/delivery/RepeatTest.java
@@ -24,7 +24,7 @@ import static 
org.assertj.core.api.Assertions.assertThatThrownBy;
 
 import org.junit.jupiter.api.Test;
 
-public class RepeatTest {
+class RepeatTest {
 
     public static final String ELEMENT = "a";
 
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 7eaf2b4..d49c66e 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
@@ -29,7 +29,7 @@ import org.apache.mailet.base.test.FakeMail;
 import org.junit.jupiter.api.BeforeEach;
 import org.junit.jupiter.api.Test;
 
-public class IsMarkedAsSpamTest {
+class IsMarkedAsSpamTest {
     private IsMarkedAsSpam matcher;
 
     @BeforeEach
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 b9528fb..64166b1 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
@@ -41,7 +41,7 @@ import org.apache.mailet.base.test.FakeMatcherConfig;
 import org.junit.jupiter.api.BeforeEach;
 import org.junit.jupiter.api.Test;
 
-public class IsOverQuotaTest {
+class IsOverQuotaTest {
     private IsOverQuota testee;
     private InMemoryPerUserMaxQuotaManager maxQuotaManager;
     private DefaultUserQuotaRootResolver quotaRootResolver;
diff --git 
a/server/mailet/mailets/src/test/java/org/apache/james/transport/matchers/IsRemoteDeliveryPermanentErrorTest.java
 
b/server/mailet/mailets/src/test/java/org/apache/james/transport/matchers/IsRemoteDeliveryPermanentErrorTest.java
index 5c35156..e4f40e1 100644
--- 
a/server/mailet/mailets/src/test/java/org/apache/james/transport/matchers/IsRemoteDeliveryPermanentErrorTest.java
+++ 
b/server/mailet/mailets/src/test/java/org/apache/james/transport/matchers/IsRemoteDeliveryPermanentErrorTest.java
@@ -38,7 +38,7 @@ import org.junit.jupiter.api.Test;
 import org.junit.jupiter.params.ParameterizedTest;
 import org.junit.jupiter.params.provider.ValueSource;
 
-public class IsRemoteDeliveryPermanentErrorTest {
+class IsRemoteDeliveryPermanentErrorTest {
 
     private IsRemoteDeliveryPermanentError testee;
 
diff --git 
a/server/mailet/mailets/src/test/java/org/apache/james/transport/matchers/IsRemoteDeliveryTemporaryErrorTest.java
 
b/server/mailet/mailets/src/test/java/org/apache/james/transport/matchers/IsRemoteDeliveryTemporaryErrorTest.java
index 4a078d9..48870f5 100644
--- 
a/server/mailet/mailets/src/test/java/org/apache/james/transport/matchers/IsRemoteDeliveryTemporaryErrorTest.java
+++ 
b/server/mailet/mailets/src/test/java/org/apache/james/transport/matchers/IsRemoteDeliveryTemporaryErrorTest.java
@@ -38,7 +38,7 @@ import org.junit.jupiter.api.Test;
 import org.junit.jupiter.params.ParameterizedTest;
 import org.junit.jupiter.params.provider.ValueSource;
 
-public class IsRemoteDeliveryTemporaryErrorTest {
+class IsRemoteDeliveryTemporaryErrorTest {
     private IsRemoteDeliveryTemporaryError testee;
 
     private Mail createMail() throws MessagingException {
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 8503be4..7b392aa 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
@@ -32,7 +32,7 @@ import org.apache.mailet.base.test.FakeMatcherConfig;
 import org.junit.jupiter.api.BeforeEach;
 import org.junit.jupiter.api.Test;
 
-public class RemoteAddrInNetworkTest {
+class RemoteAddrInNetworkTest {
     private RemoteAddrInNetwork matcher;
     private FakeMail fakeMail;
     private MailAddress testRecipient;
diff --git 
a/server/mailet/mailets/src/test/java/org/apache/james/transport/matchers/RemoteDeliveryFailedWithSMTPCodeTest.java
 
b/server/mailet/mailets/src/test/java/org/apache/james/transport/matchers/RemoteDeliveryFailedWithSMTPCodeTest.java
index 95fea28..04f6aea 100644
--- 
a/server/mailet/mailets/src/test/java/org/apache/james/transport/matchers/RemoteDeliveryFailedWithSMTPCodeTest.java
+++ 
b/server/mailet/mailets/src/test/java/org/apache/james/transport/matchers/RemoteDeliveryFailedWithSMTPCodeTest.java
@@ -40,7 +40,7 @@ import org.junit.jupiter.api.Test;
 import org.junit.jupiter.params.ParameterizedTest;
 import org.junit.jupiter.params.provider.ValueSource;
 
-public class RemoteDeliveryFailedWithSMTPCodeTest {
+class RemoteDeliveryFailedWithSMTPCodeTest {
 
     private static final String CONDITION = "521";
     public static final int SMTP_ERROR_CODE_521 = 521;
diff --git 
a/server/mailet/mailets/src/test/java/org/apache/james/transport/util/MailAddressUtilsTest.java
 
b/server/mailet/mailets/src/test/java/org/apache/james/transport/util/MailAddressUtilsTest.java
index 7dab9f3..501591f 100644
--- 
a/server/mailet/mailets/src/test/java/org/apache/james/transport/util/MailAddressUtilsTest.java
+++ 
b/server/mailet/mailets/src/test/java/org/apache/james/transport/util/MailAddressUtilsTest.java
@@ -31,7 +31,7 @@ import org.junit.jupiter.api.Test;
 
 import com.google.common.collect.ImmutableList;
 
-public class MailAddressUtilsTest {
+class MailAddressUtilsTest {
 
     @Test
     void fromShouldThrowWhenInternetAddressesIsNull() {
diff --git 
a/server/mailet/mailets/src/test/java/org/apache/james/transport/util/SpecialAddressesUtilsTest.java
 
b/server/mailet/mailets/src/test/java/org/apache/james/transport/util/SpecialAddressesUtilsTest.java
index d9c2b05..87c4fac 100644
--- 
a/server/mailet/mailets/src/test/java/org/apache/james/transport/util/SpecialAddressesUtilsTest.java
+++ 
b/server/mailet/mailets/src/test/java/org/apache/james/transport/util/SpecialAddressesUtilsTest.java
@@ -43,7 +43,7 @@ import org.junit.jupiter.api.Test;
 
 import com.google.common.collect.ImmutableList;
 
-public class SpecialAddressesUtilsTest {
+class SpecialAddressesUtilsTest {
 
     private MailAddress postmaster;
     private SpecialAddressesUtils testee;
diff --git 
a/server/mailet/rate-limiter-redis/src/test/java/org/apache/james/rate/limiter/RedisExtensionTest.java
 
b/server/mailet/rate-limiter-redis/src/test/java/org/apache/james/rate/limiter/RedisExtensionTest.java
index 99fe806..8f67c1c 100644
--- 
a/server/mailet/rate-limiter-redis/src/test/java/org/apache/james/rate/limiter/RedisExtensionTest.java
+++ 
b/server/mailet/rate-limiter-redis/src/test/java/org/apache/james/rate/limiter/RedisExtensionTest.java
@@ -26,7 +26,7 @@ import org.junit.jupiter.api.extension.RegisterExtension;
 
 import io.lettuce.core.api.sync.RedisCommands;
 
-public class RedisExtensionTest {
+class RedisExtensionTest {
 
     @RegisterExtension
     static RedisExtension redisExtension = new RedisExtension();

---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to