You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@commons.apache.org by gg...@apache.org on 2025/02/11 18:59:15 UTC

(commons-pool) branch master updated: Use the same Checkstyle configuration as in branch POOL_2_X

This is an automated email from the ASF dual-hosted git repository.

ggregory pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/commons-pool.git


The following commit(s) were added to refs/heads/master by this push:
     new 3d132b35 Use the same Checkstyle configuration as in branch POOL_2_X
3d132b35 is described below

commit 3d132b35e9a3877f4a72bb87f9d6a36968bfd681
Author: Gary Gregory <ga...@gmail.com>
AuthorDate: Tue Feb 11 13:59:08 2025 -0500

    Use the same Checkstyle configuration as in branch POOL_2_X
---
 pom.xml                                            |   5 +-
 src/conf/checkstyle-suppressions.xml               |  25 ++
 src/conf/checkstyle.xml                            | 118 ++---
 .../java/org/apache/commons/pool3/PoolUtils.java   |  17 +-
 .../commons/pool3/impl/BaseGenericObjectPool.java  |   4 +-
 .../org/apache/commons/pool3/impl/CallStack.java   |   2 +-
 .../commons/pool3/impl/DefaultPooledObject.java    |   2 +-
 .../commons/pool3/impl/GenericKeyedObjectPool.java |   2 +-
 .../pool3/impl/InterruptibleReentrantLock.java     |   4 +-
 .../commons/pool3/impl/LinkedBlockingDeque.java    |  84 ++--
 .../pool3/impl/ResilientPooledObjectFactory.java   |   2 +-
 .../commons/pool3/AbstractTestKeyedObjectPool.java | 274 ++++++------
 .../commons/pool3/AbstractTestObjectPool.java      |  22 +-
 .../java/org/apache/commons/pool3/MethodCall.java  |   4 +-
 .../java/org/apache/commons/pool3/PoolTest.java    |   4 +-
 .../pool3/TestBaseKeyedPooledObjectFactory.java    |  11 +-
 .../apache/commons/pool3/TestBaseObjectPool.java   |  18 +-
 .../pool3/TestBasePoolableObjectFactory.java       |   9 +-
 .../org/apache/commons/pool3/TestPoolUtils.java    |  45 +-
 .../org/apache/commons/pool3/WaiterFactory.java    |  22 +-
 .../commons/pool3/impl/AtomicIntegerFactory.java   |   2 +-
 .../apache/commons/pool3/impl/CallStackTest.java   |   2 +-
 .../pool3/impl/DisconnectingWaiterFactory.java     |   2 +-
 .../commons/pool3/impl/NoOpCallStackTest.java      |   2 +-
 .../pool3/impl/TestAbandonedKeyedObjectPool.java   |  22 +-
 .../pool3/impl/TestAbandonedObjectPool.java        |  19 +-
 .../pool3/impl/TestBaseGenericObjectPool.java      |   4 +-
 .../pool3/impl/TestDefaultPooledObject.java        |   2 +-
 .../pool3/impl/TestDefaultPooledObjectInfo.java    |   8 +-
 .../commons/pool3/impl/TestEvictionTimer.java      |   4 +-
 .../pool3/impl/TestGenericKeyedObjectPool.java     | 491 ++++++++++-----------
 .../commons/pool3/impl/TestGenericObjectPool.java  | 100 ++---
 .../impl/TestGenericObjectPoolClassLoaders.java    |   8 +-
 .../TestGenericObjectPoolFactoryCreateFailure.java |   2 +-
 .../impl/TestResilientPooledObjectFactory.java     |  99 +++--
 .../commons/pool3/impl/TestSoftRefOutOfMemory.java |   4 +-
 .../impl/TestSynchronizedPooledObjectFactory.java  | 187 ++++----
 .../commons/pool3/performance/PerformanceTest.java |  27 +-
 .../pool3/pool407/AbstractPool407Factory.java      |   2 +
 .../pool3/pool407/KeyedPool407NormalFactory.java   |   3 +-
 .../commons/pool3/pool407/KeyedPool407Test.java    |   7 +-
 .../pool3/pool407/Pool407NormalFactory.java        |   3 +-
 .../apache/commons/pool3/pool407/Pool407Test.java  |   7 +-
 43 files changed, 847 insertions(+), 834 deletions(-)

diff --git a/pom.xml b/pom.xml
index ab651176..dbc8705d 100644
--- a/pom.xml
+++ b/pom.xml
@@ -89,6 +89,7 @@
     <commons.componentid>pool</commons.componentid>
     <commons.module.name>org.apache.commons.pool3</commons.module.name>
     <commons.rc.version>RC1</commons.rc.version>
+    <checkstyle.suppress.file>${basedir}/src/conf/checkstyle-suppressions.xml</checkstyle.suppress.file>
     <!-- Java 17 -->
     <commons.release.version>3.0.0</commons.release.version>
     <commons.release.desc>(Java 17)</commons.release.desc>
@@ -137,8 +138,10 @@
             <artifactId>maven-checkstyle-plugin</artifactId>
              <configuration>
               <configLocation>${basedir}/src/conf/checkstyle.xml</configLocation>
-              <enableRulesSummary>false</enableRulesSummary>
+              <suppressionsLocation>${checkstyle.suppress.file}</suppressionsLocation>
               <headerLocation>${basedir}/license-header.txt</headerLocation>
+              <enableRulesSummary>false</enableRulesSummary>
+              <includeTestSourceDirectory>true</includeTestSourceDirectory>
             </configuration>
           </plugin>
           <plugin>
diff --git a/src/conf/checkstyle-suppressions.xml b/src/conf/checkstyle-suppressions.xml
new file mode 100644
index 00000000..74924812
--- /dev/null
+++ b/src/conf/checkstyle-suppressions.xml
@@ -0,0 +1,25 @@
+<?xml version="1.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
+
+     https://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.
+-->
+<!DOCTYPE suppressions PUBLIC
+    "-//Checkstyle//DTD SuppressionFilter Configuration 1.2//EN"
+    "https://checkstyle.org/dtds/suppressions_1_2.dtd">
+<!-- SEE: http://checkstyle.sourceforge.net/config.html#Examples -->
+<suppressions>
+  <suppress checks="JavadocPackage" files="src[/\\]test[/\\]java[/\\]" />
+  <suppress checks="NewlineAtEndOfFile" files="./target/classes/META-INF/maven/org.apache.commons/commons-pool3/pom.properties" />
+</suppressions>
diff --git a/src/conf/checkstyle.xml b/src/conf/checkstyle.xml
index 2b959d03..85cd3df7 100644
--- a/src/conf/checkstyle.xml
+++ b/src/conf/checkstyle.xml
@@ -22,69 +22,19 @@
 <!--
   Checkstyle checks configured for Maven.
 -->
-
 <module name="Checker">
-
-  <property name="localeLanguage" value="en"/>
-
-  <!-- No tabs allowed! -->
-  <module name="FileTabCharacter"/>
-    
-  <module name="TreeWalker">
-   
-    <!-- Operator must be at end of wrapped line -->
-    <module name="OperatorWrap">
-      <property name="option" value="eol"/>
-    </module>
-    
-    <!-- Interfaces must be types (not just constants) -->
-    <module name="InterfaceIsType"/>
-
-    <!-- Must have class / interface header comments -->
-    <module name="JavadocType"/>
-        
-     <!-- Require method javadocs, allow undeclared RTE -->
-    <module name="JavadocMethod">
-    </module>
-        
-    <!-- Require field javadoc -->
-    <module name="JavadocVariable">
-      <property name="scope" value="protected"/>
-    </module>
-        
-    <!-- No public fields -->
-    <module name="VisibilityModifier">
-       <property name="packageAllowed" value="true"/>
-       <property name="protectedAllowed" value="true"/>
-    </module>
-    
-    <!-- Require hash code override when equals is -->
-    <module name="EqualsHashCode"/>
-    
-    <!-- Disallow unnecessary instantiation of Boolean, String -->
-    <module name="IllegalInstantiation">
-      <property name="classes" value="java.lang.Boolean, java.lang.String"/>
-    </module>
-    <module name="ImportOrder">
-      <property name="option" value="top"/>
-      <property name="groups" value="java,javax,org"/>
-      <property name="ordered" value="true"/>
-      <property name="separated" value="true"/>
-    </module>
-    <module name="ParenPad" />
-    <module name="TypecastParenPad" />
-  </module>
-  
-  <!-- Require package Javadoc -->
+  <property name="localeLanguage" value="en" />
+  <module name="FileTabCharacter" />
   <module name="JavadocPackage">
-    <!-- setting allowLegacy means it will check for package.html instead of just package-info.java -->
-    <property name="allowLegacy" value="true"/>
+    <property name="allowLegacy" value="true" />
   </module>
-
   <module name="LineLength">
-    <property name="max" value="160"/>
+    <property name="max" value="160" />
+  </module>
+  <module name="NewlineAtEndOfFile">
+    <!-- Files are saved in the repository with LF line endings; on Windows, use git config core.autocrlf input -->
+    <property name="lineSeparator" value="lf" />
   </module>
-  <!-- @author tags are deprecated -->
   <module name="RegexpSingleline">
     <property name="format" value="^\s+\*\s+@author\s" />
     <property name="message" value="Deprecated @author tag" />
@@ -92,8 +42,58 @@
     <property name="severity" value="warning" />
   </module>
   <module name="RegexpSingleline">
-    <!-- \s matches whitespace character, $ matches end of line. -->
     <property name="format" value="\s+$" />
     <property name="message" value="Line has trailing spaces." />
   </module>
+  <module name="TreeWalker">
+    <module name="ArrayTypeStyle" />
+    <module name="AvoidStarImport" />
+    <module name="CovariantEquals" />
+    <module name="DefaultComesLast" />
+    <module name="EmptyBlock">
+      <property name="option" value="text" />
+    </module>
+    <module name="EqualsHashCode" />
+    <module name="ExplicitInitialization" />
+    <module name="FinalLocalVariable" />
+    <module name="IllegalInstantiation" />
+    <module name="ImportOrder">
+      <property name="option" value="top" />
+      <property name="groups" value="java,javax,org" />
+      <property name="ordered" value="true" />
+      <property name="separated" value="true" />
+    </module>
+    <module name="InterfaceIsType" />
+    <module name="JavadocType" />
+    <module name="JavadocMethod">
+    </module>
+    <module name="JavadocVariable">
+      <property name="scope" value="protected" />
+    </module>
+    <module name="LeftCurly" />
+    <module name="MethodParamPad"/>
+    <module name="MissingOverride" />
+    <module name="ModifierOrder" />
+    <module name="MultipleVariableDeclarations" />
+    <module name="NeedBraces" />
+    <module name="ParenPad" />
+    <module name="RedundantImport" />
+    <module name="RedundantModifier" />
+    <module name="RightCurly" />
+    <module name="SimplifyBooleanExpression" />
+    <module name="SimplifyBooleanReturn" />
+    <module name="StringLiteralEquality" />
+    <module name="SuperClone" /> 
+    <module name="SuperFinalize" />
+    <module name="TypecastParenPad" />
+    <module name="UnnecessaryParentheses" />
+    <module name="UnusedImports" />
+    <module name="UpperEll" />
+    <module name="VisibilityModifier">
+      <property name="packageAllowed" value="true" />
+      <property name="protectedAllowed" value="true" />
+    </module>
+    <module name="WhitespaceAfter" />
+    <module name="WhitespaceAround" />
+  </module>
 </module>
diff --git a/src/main/java/org/apache/commons/pool3/PoolUtils.java b/src/main/java/org/apache/commons/pool3/PoolUtils.java
index b5b18e3c..ef5c456f 100644
--- a/src/main/java/org/apache/commons/pool3/PoolUtils.java
+++ b/src/main/java/org/apache/commons/pool3/PoolUtils.java
@@ -64,7 +64,7 @@ public final class PoolUtils {
          * @param factor
          *            erosion factor
          */
-        public ErodingFactor(final float factor) {
+        ErodingFactor(final float factor) {
             this.factor = factor;
             nextShrinkMillis = System.currentTimeMillis() + (long) (900000 * factor); // now + 15 min * factor
             idleHighWaterMark = 1;
@@ -133,11 +133,9 @@ public final class PoolUtils {
          *            events
          * @see #erodingFactor
          */
-        protected ErodingKeyedObjectPool(final KeyedObjectPool<K, V, E> keyedPool,
-                final ErodingFactor erodingFactor) {
+        ErodingKeyedObjectPool(final KeyedObjectPool<K, V, E> keyedPool, final ErodingFactor erodingFactor) {
             if (keyedPool == null) {
-                throw new IllegalArgumentException(
-                        MSG_NULL_KEYED_POOL);
+                throw new IllegalArgumentException(MSG_NULL_KEYED_POOL);
             }
             this.keyedPool = keyedPool;
             this.erodingFactor = erodingFactor;
@@ -154,8 +152,7 @@ public final class PoolUtils {
          *            events
          * @see #erodingFactor
          */
-        public ErodingKeyedObjectPool(final KeyedObjectPool<K, V, E> keyedPool,
-                final float factor) {
+        ErodingKeyedObjectPool(final KeyedObjectPool<K, V, E> keyedPool, final float factor) {
             this(keyedPool, new ErodingFactor(factor));
         }
 
@@ -351,7 +348,7 @@ public final class PoolUtils {
          *            events
          * @see #factor
          */
-        public ErodingObjectPool(final ObjectPool<T, E> pool, final float factor) {
+        ErodingObjectPool(final ObjectPool<T, E> pool, final float factor) {
             this.pool = pool;
             this.factor = new ErodingFactor(factor);
         }
@@ -360,7 +357,7 @@ public final class PoolUtils {
          * {@inheritDoc}
          */
         @Override
-        public void addObject() throws E, IllegalStateException, UnsupportedOperationException{
+        public void addObject() throws E, IllegalStateException, UnsupportedOperationException {
             pool.addObject();
         }
 
@@ -492,7 +489,7 @@ public final class PoolUtils {
          * @param factor
          *            erosion factor
          */
-        public ErodingPerKeyKeyedObjectPool(final KeyedObjectPool<K, V, E> keyedPool, final float factor) {
+        ErodingPerKeyKeyedObjectPool(final KeyedObjectPool<K, V, E> keyedPool, final float factor) {
             super(keyedPool, null);
             this.factor = factor;
         }
diff --git a/src/main/java/org/apache/commons/pool3/impl/BaseGenericObjectPool.java b/src/main/java/org/apache/commons/pool3/impl/BaseGenericObjectPool.java
index ffd2eaab..9e519a59 100644
--- a/src/main/java/org/apache/commons/pool3/impl/BaseGenericObjectPool.java
+++ b/src/main/java/org/apache/commons/pool3/impl/BaseGenericObjectPool.java
@@ -226,7 +226,7 @@ public abstract class BaseGenericObjectPool<T, E extends Exception> extends Base
          *
          * @param instance object to wrap.
          */
-        public IdentityWrapper(final T instance) {
+        IdentityWrapper(final T instance) {
             this.instance = instance;
         }
 
@@ -1153,7 +1153,7 @@ public abstract class BaseGenericObjectPool<T, E extends Exception> extends Base
         }
         while (!registered) {
             try {
-                ObjectName objName;
+                final ObjectName objName;
                 // Skip the numeric suffix for the first pool in case there is
                 // only one so the names are cleaner.
                 if (i == 1) {
diff --git a/src/main/java/org/apache/commons/pool3/impl/CallStack.java b/src/main/java/org/apache/commons/pool3/impl/CallStack.java
index 5c036443..33f9049e 100644
--- a/src/main/java/org/apache/commons/pool3/impl/CallStack.java
+++ b/src/main/java/org/apache/commons/pool3/impl/CallStack.java
@@ -50,5 +50,5 @@ public interface CallStack {
      * @param writer a PrintWriter to write the current stack trace to if available
      * @return true if a stack trace was available to print or false if nothing was printed
      */
-    boolean printStackTrace(final PrintWriter writer);
+    boolean printStackTrace(PrintWriter writer);
 }
diff --git a/src/main/java/org/apache/commons/pool3/impl/DefaultPooledObject.java b/src/main/java/org/apache/commons/pool3/impl/DefaultPooledObject.java
index 23eff043..54d64fd8 100644
--- a/src/main/java/org/apache/commons/pool3/impl/DefaultPooledObject.java
+++ b/src/main/java/org/apache/commons/pool3/impl/DefaultPooledObject.java
@@ -295,4 +295,4 @@ public class DefaultPooledObject<T> implements PooledObject<T> {
         usedBy.fillInStackTrace();
     }
 
-}
\ No newline at end of file
+}
diff --git a/src/main/java/org/apache/commons/pool3/impl/GenericKeyedObjectPool.java b/src/main/java/org/apache/commons/pool3/impl/GenericKeyedObjectPool.java
index 4bbf3735..16352c19 100644
--- a/src/main/java/org/apache/commons/pool3/impl/GenericKeyedObjectPool.java
+++ b/src/main/java/org/apache/commons/pool3/impl/GenericKeyedObjectPool.java
@@ -129,7 +129,7 @@ public class GenericKeyedObjectPool<K, T, E extends Exception> extends BaseGener
          * @param fairness true means client threads waiting to borrow / return instances
          * will be served as if waiting in a FIFO queue.
          */
-        public ObjectDeque(final boolean fairness) {
+        ObjectDeque(final boolean fairness) {
             idleObjects = new LinkedBlockingDeque<>(fairness);
         }
 
diff --git a/src/main/java/org/apache/commons/pool3/impl/InterruptibleReentrantLock.java b/src/main/java/org/apache/commons/pool3/impl/InterruptibleReentrantLock.java
index 0c2def7c..13a52b3d 100644
--- a/src/main/java/org/apache/commons/pool3/impl/InterruptibleReentrantLock.java
+++ b/src/main/java/org/apache/commons/pool3/impl/InterruptibleReentrantLock.java
@@ -39,7 +39,7 @@ final class InterruptibleReentrantLock extends ReentrantLock {
      * @param fairness true means threads should acquire contended locks as if
      * waiting in a FIFO queue
      */
-    public InterruptibleReentrantLock(final boolean fairness) {
+    InterruptibleReentrantLock(final boolean fairness) {
         super(fairness);
     }
 
@@ -48,7 +48,7 @@ final class InterruptibleReentrantLock extends ReentrantLock {
      *
      * @param condition the condition on which the threads are waiting.
      */
-    public void interruptWaiters(final Condition condition) {
+    void interruptWaiters(final Condition condition) {
         getWaitingThreads(condition).forEach(Thread::interrupt);
     }
 }
diff --git a/src/main/java/org/apache/commons/pool3/impl/LinkedBlockingDeque.java b/src/main/java/org/apache/commons/pool3/impl/LinkedBlockingDeque.java
index 3c5c3a3b..ec972a65 100644
--- a/src/main/java/org/apache/commons/pool3/impl/LinkedBlockingDeque.java
+++ b/src/main/java/org/apache/commons/pool3/impl/LinkedBlockingDeque.java
@@ -223,18 +223,28 @@ final class LinkedBlockingDeque<E> extends AbstractQueue<E>
     /** Descending iterator */
     private final class DescendingItr extends AbstractItr {
         @Override
-        Node<E> firstNode() { return last; }
+        Node<E> firstNode() {
+            return last;
+        }
+
         @Override
-        Node<E> nextNode(final Node<E> n) { return n.prev; }
+        Node<E> nextNode(final Node<E> n) {
+            return n.prev;
+        }
     }
 
     /** Forward iterator */
     private final class Itr extends AbstractItr {
         @Override
-        Node<E> firstNode() { return first; }
+        Node<E> firstNode() {
+            return first;
+        }
+
         @Override
-        Node<E> nextNode(final Node<E> n) { return n.next; }
+        Node<E> nextNode(final Node<E> n) {
+            return n.next;
         }
+    }
 
     /**
      * Doubly-linked list node class.
@@ -312,7 +322,7 @@ final class LinkedBlockingDeque<E> extends AbstractQueue<E>
      * Creates a {@code LinkedBlockingDeque} with a capacity of
      * {@link Integer#MAX_VALUE}.
      */
-    public LinkedBlockingDeque() {
+    LinkedBlockingDeque() {
         this(Integer.MAX_VALUE);
     }
 
@@ -322,7 +332,7 @@ final class LinkedBlockingDeque<E> extends AbstractQueue<E>
      * @param fairness true means threads waiting on the deque should be served
      * as if waiting in a FIFO request queue
      */
-    public LinkedBlockingDeque(final boolean fairness) {
+    LinkedBlockingDeque(final boolean fairness) {
         this(Integer.MAX_VALUE, fairness);
     }
 
@@ -338,7 +348,7 @@ final class LinkedBlockingDeque<E> extends AbstractQueue<E>
      * @throws NullPointerException if the specified collection or any
      *         of its elements are null
      */
-    public LinkedBlockingDeque(final Collection<? extends E> c) {
+    LinkedBlockingDeque(final Collection<? extends E> c) {
         this(Integer.MAX_VALUE);
         lock.lock(); // Never contended, but necessary for visibility
         try {
@@ -359,7 +369,7 @@ final class LinkedBlockingDeque<E> extends AbstractQueue<E>
      * @param capacity the capacity of this deque
      * @throws IllegalArgumentException if {@code capacity} is less than 1
      */
-    public LinkedBlockingDeque(final int capacity) {
+    LinkedBlockingDeque(final int capacity) {
         this(capacity, false);
     }
 
@@ -372,7 +382,7 @@ final class LinkedBlockingDeque<E> extends AbstractQueue<E>
      * as if waiting in a FIFO request queue
      * @throws IllegalArgumentException if {@code capacity} is less than 1
      */
-    public LinkedBlockingDeque(final int capacity, final boolean fairness) {
+    LinkedBlockingDeque(final int capacity, final boolean fairness) {
         if (capacity <= 0) {
             throw new IllegalArgumentException();
         }
@@ -483,7 +493,7 @@ final class LinkedBlockingDeque<E> extends AbstractQueue<E>
      * @throws NullPointerException if c is null
      * @throws IllegalArgumentException if c is this instance
      */
-    public int drainTo(final Collection<? super E> c) {
+    int drainTo(final Collection<? super E> c) {
         return drainTo(c, Integer.MAX_VALUE);
     }
 
@@ -502,7 +512,7 @@ final class LinkedBlockingDeque<E> extends AbstractQueue<E>
      * @throws NullPointerException if c is null
      * @throws IllegalArgumentException if c is this instance
      */
-    public int drainTo(final Collection<? super E> collection, final int maxElements) {
+    int drainTo(final Collection<? super E> collection, final int maxElements) {
         Objects.requireNonNull(collection, "c");
         if (collection == this) {
             throw new IllegalArgumentException();
@@ -565,7 +575,7 @@ final class LinkedBlockingDeque<E> extends AbstractQueue<E>
      *
      * @return number of threads waiting on this deque's notEmpty condition.
      */
-    public int getTakeQueueLength() {
+    int getTakeQueueLength() {
         lock.lock();
         try {
            return lock.getWaitQueueLength(notEmpty);
@@ -580,7 +590,7 @@ final class LinkedBlockingDeque<E> extends AbstractQueue<E>
      *
      * @return true if there is at least one thread waiting on this deque's notEmpty condition.
      */
-    public boolean hasTakeWaiters() {
+    boolean hasTakeWaiters() {
         lock.lock();
         try {
             return lock.hasWaiters(notEmpty);
@@ -593,7 +603,7 @@ final class LinkedBlockingDeque<E> extends AbstractQueue<E>
      * Interrupts the threads currently waiting to take an object from the pool. See disclaimer on accuracy in
      * {@link java.util.concurrent.locks.ReentrantLock#getWaitingThreads(Condition)}.
      */
-    public void interuptTakeWaiters() {
+    void interuptTakeWaiters() {
         lock.lock();
         try {
             lock.interruptWaiters(notEmpty);
@@ -706,7 +716,7 @@ final class LinkedBlockingDeque<E> extends AbstractQueue<E>
      * @throws InterruptedException if the thread is interrupted whilst waiting
      *         for space
      */
-    public boolean offer(final E e, final long timeout, final TimeUnit unit) throws InterruptedException {
+    boolean offer(final E e, final long timeout, final TimeUnit unit) throws InterruptedException {
         return offerLast(e, timeout, unit);
     }
 
@@ -735,7 +745,7 @@ final class LinkedBlockingDeque<E> extends AbstractQueue<E>
      * @throws InterruptedException if the thread is interrupted whilst waiting
      *         for space
      */
-    public boolean offerFirst(final E e, final Duration timeout) throws InterruptedException {
+    boolean offerFirst(final E e, final Duration timeout) throws InterruptedException {
         Objects.requireNonNull(e, "e");
         long nanos = timeout.toNanos();
         lock.lockInterruptibly();
@@ -764,7 +774,7 @@ final class LinkedBlockingDeque<E> extends AbstractQueue<E>
      * @throws InterruptedException if the thread is interrupted whilst waiting
      *         for space
      */
-    public boolean offerFirst(final E e, final long timeout, final TimeUnit unit) throws InterruptedException {
+    boolean offerFirst(final E e, final long timeout, final TimeUnit unit) throws InterruptedException {
         return offerFirst(e, PoolImplUtils.toDuration(timeout, unit));
     }
 
@@ -822,7 +832,7 @@ final class LinkedBlockingDeque<E> extends AbstractQueue<E>
      * @throws InterruptedException if the thread is interrupted whist waiting
      *         for space
      */
-    public boolean offerLast(final E e, final long timeout, final TimeUnit unit) throws InterruptedException {
+    boolean offerLast(final E e, final long timeout, final TimeUnit unit) throws InterruptedException {
         return offerLast(e, PoolImplUtils.toDuration(timeout, unit));
     }
 
@@ -883,7 +893,7 @@ final class LinkedBlockingDeque<E> extends AbstractQueue<E>
      * @return the unlinked element
      * @throws InterruptedException if the current thread is interrupted
      */
-    public E poll(final long timeout, final TimeUnit unit) throws InterruptedException {
+    E poll(final long timeout, final TimeUnit unit) throws InterruptedException {
         return pollFirst(timeout, unit);
     }
 
@@ -931,7 +941,7 @@ final class LinkedBlockingDeque<E> extends AbstractQueue<E>
      * @return the unlinked element
      * @throws InterruptedException if the current thread is interrupted
      */
-    public E pollFirst(final long timeout, final TimeUnit unit) throws InterruptedException {
+    E pollFirst(final long timeout, final TimeUnit unit) throws InterruptedException {
         return pollFirst(PoolImplUtils.toDuration(timeout, unit));
     }
 
@@ -953,7 +963,7 @@ final class LinkedBlockingDeque<E> extends AbstractQueue<E>
      * @return the unlinked element
      * @throws InterruptedException if the current thread is interrupted
      */
-    public E pollLast(final Duration timeout) throws InterruptedException {
+    E pollLast(final Duration timeout) throws InterruptedException {
         long nanos = timeout.toNanos();
         lock.lockInterruptibly();
         try {
@@ -979,7 +989,7 @@ final class LinkedBlockingDeque<E> extends AbstractQueue<E>
      * @return the unlinked element
      * @throws InterruptedException if the current thread is interrupted
      */
-    public E pollLast(final long timeout, final TimeUnit unit)
+    E pollLast(final long timeout, final TimeUnit unit)
         throws InterruptedException {
         return pollLast(PoolImplUtils.toDuration(timeout, unit));
     }
@@ -1013,7 +1023,7 @@ final class LinkedBlockingDeque<E> extends AbstractQueue<E>
      * @throws InterruptedException if the thread is interrupted whilst waiting
      *         for space
      */
-    public void put(final E e) throws InterruptedException {
+    void put(final E e) throws InterruptedException {
         putLast(e);
     }
 
@@ -1026,7 +1036,7 @@ final class LinkedBlockingDeque<E> extends AbstractQueue<E>
      * @throws InterruptedException if the thread is interrupted whilst waiting
      *         for space
      */
-    public void putFirst(final E e) throws InterruptedException {
+    void putFirst(final E e) throws InterruptedException {
         Objects.requireNonNull(e, "e");
         lock.lock();
         try {
@@ -1047,7 +1057,7 @@ final class LinkedBlockingDeque<E> extends AbstractQueue<E>
      * @throws InterruptedException if the thread is interrupted whilst waiting
      *         for space
      */
-    public void putLast(final E e) throws InterruptedException {
+    void putLast(final E e) throws InterruptedException {
         Objects.requireNonNull(e, "e");
         lock.lock();
         try {
@@ -1059,15 +1069,12 @@ final class LinkedBlockingDeque<E> extends AbstractQueue<E>
         }
     }
 
-    // Stack methods
-
     /**
-     * Reconstitutes this deque from a stream (that is,
-     * deserialize it).
+     * Reconstitutes this deque from a stream (that is, deserialize it).
+     *
      * @param s the stream
      */
-    private void readObject(final ObjectInputStream s)
-        throws IOException, ClassNotFoundException {
+    private void readObject(final ObjectInputStream s) throws IOException, ClassNotFoundException {
         s.defaultReadObject();
         count = 0;
         first = null;
@@ -1075,7 +1082,7 @@ final class LinkedBlockingDeque<E> extends AbstractQueue<E>
         // Read in all elements and place in queue
         for (;;) {
             @SuppressWarnings("unchecked")
-            final E item = (E)s.readObject();
+            final E item = (E) s.readObject();
             if (item == null) {
                 break;
             }
@@ -1098,7 +1105,7 @@ final class LinkedBlockingDeque<E> extends AbstractQueue<E>
      *
      * @return The number of additional elements the queue is able to accept
      */
-    public int remainingCapacity() {
+    int remainingCapacity() {
         lock.lock();
         try {
             return capacity - count;
@@ -1276,7 +1283,7 @@ final class LinkedBlockingDeque<E> extends AbstractQueue<E>
      * @return the unlinked element
      * @throws InterruptedException if the current thread is interrupted
      */
-    public E take() throws InterruptedException {
+    E take() throws InterruptedException {
         return takeFirst();
     }
 
@@ -1287,7 +1294,7 @@ final class LinkedBlockingDeque<E> extends AbstractQueue<E>
      * @return the unlinked element
      * @throws InterruptedException if the current thread is interrupted
      */
-    public E takeFirst() throws InterruptedException {
+    E takeFirst() throws InterruptedException {
         lock.lock();
         try {
             E x;
@@ -1307,7 +1314,7 @@ final class LinkedBlockingDeque<E> extends AbstractQueue<E>
      * @return the unlinked element
      * @throws InterruptedException if the current thread is interrupted
      */
-    public E takeLast() throws InterruptedException {
+    E takeLast() throws InterruptedException {
         lock.lock();
         try {
             E x;
@@ -1360,12 +1367,11 @@ final class LinkedBlockingDeque<E> extends AbstractQueue<E>
         lock.lock();
         try {
             if (a.length < count) {
-                a = (T[])java.lang.reflect.Array.newInstance
-                    (a.getClass().getComponentType(), count);
+                a = (T[]) java.lang.reflect.Array.newInstance(a.getClass().getComponentType(), count);
             }
             int k = 0;
             for (Node<E> p = first; p != null; p = p.next) {
-                a[k++] = (T)p.item;
+                a[k++] = (T) p.item;
             }
             if (a.length > k) {
                 a[k] = null;
diff --git a/src/main/java/org/apache/commons/pool3/impl/ResilientPooledObjectFactory.java b/src/main/java/org/apache/commons/pool3/impl/ResilientPooledObjectFactory.java
index 2100b851..f9c9b939 100644
--- a/src/main/java/org/apache/commons/pool3/impl/ResilientPooledObjectFactory.java
+++ b/src/main/java/org/apache/commons/pool3/impl/ResilientPooledObjectFactory.java
@@ -106,7 +106,7 @@ public class ResilientPooledObjectFactory<T, E extends Exception> implements Poo
         /**
          * Constructor set statTime to now.
          */
-        public MakeEvent() {
+        MakeEvent() {
             startTime = Instant.now();
         }
 
diff --git a/src/test/java/org/apache/commons/pool3/AbstractTestKeyedObjectPool.java b/src/test/java/org/apache/commons/pool3/AbstractTestKeyedObjectPool.java
index 1e958f81..ed22fb80 100644
--- a/src/test/java/org/apache/commons/pool3/AbstractTestKeyedObjectPool.java
+++ b/src/test/java/org/apache/commons/pool3/AbstractTestKeyedObjectPool.java
@@ -165,13 +165,14 @@ public abstract class AbstractTestKeyedObjectPool {
         public Object create(final Object key) {
             return new Object();
         }
+
         @Override
         public PooledObject<Object> wrap(final Object value) {
             return new DefaultPooledObject<>(value);
         }
     }
 
-    protected static final String KEY = "key";
+    private static final String KEY = "key";
 
     private KeyedObjectPool<Object, Object, RuntimeException> pool;
 
@@ -187,9 +188,8 @@ public abstract class AbstractTestKeyedObjectPool {
     }
 
     /**
-     * Return what we expect to be the n<sup>th</sup>
-     * object (zero indexed) created by the pool
-     * for the given key.
+     * Return what we expect to be the n<sup>th</sup> object (zero indexed) created by the pool for the given key.
+     *
      * @param key Key for the object to be obtained
      * @param n   index of the object to be obtained
      * @return the requested object
@@ -201,23 +201,20 @@ public abstract class AbstractTestKeyedObjectPool {
     protected abstract boolean isLifo();
 
     /**
-     * Creates an {@link KeyedObjectPool} instance
-     * that can contain at least <em>minCapacity</em>
-     * idle and active objects, or
-     * throw {@link IllegalArgumentException}
-     * if such a pool cannot be created.
+     * Creates an {@link KeyedObjectPool} instance that can contain at least <em>minCapacity</em> idle and active objects, or throw
+     * {@link IllegalArgumentException} if such a pool cannot be created.
+     *
+     * @param <E> Type of exception thrown by this pool.
      * @param minCapacity Minimum capacity of the pool to create
      * @return the newly created keyed object pool
      */
     protected abstract <E extends Exception> KeyedObjectPool<Object, Object, E> makeEmptyPool(int minCapacity);
 
     /**
-     * Creates an {@code KeyedObjectPool} with the specified factory.
-     * The pool should be in a default configuration and conform to the expected
-     * behaviors described in {@link KeyedObjectPool}.
-     * Generally speaking there should be no limits on the various object counts.
+     * Creates an {@code KeyedObjectPool} with the specified factory. The pool should be in a default configuration and conform to the expected behaviors
+     * described in {@link KeyedObjectPool}. Generally speaking there should be no limits on the various object counts.
      *
-     * @param <E> The type of exception thrown by the pool
+     * @param <E>     The type of exception thrown by the pool
      * @param factory Factory to use to associate with the pool
      * @return The newly created empty pool
      */
@@ -226,7 +223,7 @@ public abstract class AbstractTestKeyedObjectPool {
     protected abstract Object makeKey(int n);
 
     private <E extends Exception> void reset(final KeyedObjectPool<Object, Object, E> pool, final FailingKeyedPooledObjectFactory factory,
-        final List<MethodCall> expectedMethods) throws E {
+            final List<MethodCall> expectedMethods) throws E {
         pool.clear();
         clear(factory, expectedMethods);
         factory.reset();
@@ -246,26 +243,26 @@ public abstract class AbstractTestKeyedObjectPool {
         }
         final Object key = makeKey(0);
         try {
-            assertEquals(0,pool.getNumIdle());
-            assertEquals(0,pool.getNumActive());
-            assertEquals(0,pool.getNumIdle(key));
-            assertEquals(0,pool.getNumActive(key));
+            assertEquals(0, pool.getNumIdle());
+            assertEquals(0, pool.getNumActive());
+            assertEquals(0, pool.getNumIdle(key));
+            assertEquals(0, pool.getNumActive(key));
             pool.addObject(key);
-            assertEquals(1,pool.getNumIdle());
-            assertEquals(0,pool.getNumActive());
-            assertEquals(1,pool.getNumIdle(key));
-            assertEquals(0,pool.getNumActive(key));
+            assertEquals(1, pool.getNumIdle());
+            assertEquals(0, pool.getNumActive());
+            assertEquals(1, pool.getNumIdle(key));
+            assertEquals(0, pool.getNumActive(key));
             final Object obj = pool.borrowObject(key);
-            assertEquals(getNthObject(key,0),obj);
-            assertEquals(0,pool.getNumIdle());
-            assertEquals(1,pool.getNumActive());
-            assertEquals(0,pool.getNumIdle(key));
-            assertEquals(1,pool.getNumActive(key));
-            pool.returnObject(key,obj);
-            assertEquals(1,pool.getNumIdle());
-            assertEquals(0,pool.getNumActive());
-            assertEquals(1,pool.getNumIdle(key));
-            assertEquals(0,pool.getNumActive(key));
+            assertEquals(getNthObject(key, 0), obj);
+            assertEquals(0, pool.getNumIdle());
+            assertEquals(1, pool.getNumActive());
+            assertEquals(0, pool.getNumIdle(key));
+            assertEquals(1, pool.getNumActive(key));
+            pool.returnObject(key, obj);
+            assertEquals(1, pool.getNumIdle());
+            assertEquals(0, pool.getNumActive());
+            assertEquals(1, pool.getNumIdle(key));
+            assertEquals(0, pool.getNumActive(key));
         } catch (final UnsupportedOperationException e) {
             return; // skip this test if one of those calls is unsupported
         } finally {
@@ -282,12 +279,12 @@ public abstract class AbstractTestKeyedObjectPool {
         }
         final Object keya = makeKey(0);
         final Object keyb = makeKey(1);
-        assertEquals(getNthObject(keya,0),pool.borrowObject(keya),"1");
-        assertEquals(getNthObject(keyb,0),pool.borrowObject(keyb),"2");
-        assertEquals(getNthObject(keyb,1),pool.borrowObject(keyb),"3");
-        assertEquals(getNthObject(keya,1),pool.borrowObject(keya),"4");
-        assertEquals(getNthObject(keyb,2),pool.borrowObject(keyb),"5");
-        assertEquals(getNthObject(keya,2),pool.borrowObject(keya),"6");
+        assertEquals(getNthObject(keya, 0), pool.borrowObject(keya), "1");
+        assertEquals(getNthObject(keyb, 0), pool.borrowObject(keyb), "2");
+        assertEquals(getNthObject(keyb, 1), pool.borrowObject(keyb), "3");
+        assertEquals(getNthObject(keya, 1), pool.borrowObject(keya), "4");
+        assertEquals(getNthObject(keyb, 2), pool.borrowObject(keyb), "5");
+        assertEquals(getNthObject(keya, 2), pool.borrowObject(keya), "6");
         pool.close();
     }
 
@@ -300,32 +297,32 @@ public abstract class AbstractTestKeyedObjectPool {
         }
         final Object keya = makeKey(0);
         Object obj0 = pool.borrowObject(keya);
-        assertEquals(getNthObject(keya,0),obj0);
+        assertEquals(getNthObject(keya, 0), obj0);
         Object obj1 = pool.borrowObject(keya);
-        assertEquals(getNthObject(keya,1),obj1);
+        assertEquals(getNthObject(keya, 1), obj1);
         Object obj2 = pool.borrowObject(keya);
-        assertEquals(getNthObject(keya,2),obj2);
-        pool.returnObject(keya,obj2);
+        assertEquals(getNthObject(keya, 2), obj2);
+        pool.returnObject(keya, obj2);
         obj2 = pool.borrowObject(keya);
-        assertEquals(getNthObject(keya,2),obj2);
-        pool.returnObject(keya,obj1);
+        assertEquals(getNthObject(keya, 2), obj2);
+        pool.returnObject(keya, obj1);
         obj1 = pool.borrowObject(keya);
-        assertEquals(getNthObject(keya,1),obj1);
-        pool.returnObject(keya,obj0);
-        pool.returnObject(keya,obj2);
+        assertEquals(getNthObject(keya, 1), obj1);
+        pool.returnObject(keya, obj0);
+        pool.returnObject(keya, obj2);
         obj2 = pool.borrowObject(keya);
         if (isLifo()) {
-            assertEquals(getNthObject(keya,2),obj2);
+            assertEquals(getNthObject(keya, 2), obj2);
         }
         if (isFifo()) {
-            assertEquals(getNthObject(keya,0),obj2);
+            assertEquals(getNthObject(keya, 0), obj2);
         }
         obj0 = pool.borrowObject(keya);
         if (isLifo()) {
-            assertEquals(getNthObject(keya,0),obj0);
+            assertEquals(getNthObject(keya, 0), obj0);
         }
         if (isFifo()) {
-            assertEquals(getNthObject(keya,2),obj0);
+            assertEquals(getNthObject(keya, 2), obj0);
         }
         pool.close();
     }
@@ -338,21 +335,21 @@ public abstract class AbstractTestKeyedObjectPool {
             return; // skip this test if unsupported
         }
         final Object keya = makeKey(0);
-        assertEquals(0,pool.getNumActive(keya));
-        assertEquals(0,pool.getNumIdle(keya));
+        assertEquals(0, pool.getNumActive(keya));
+        assertEquals(0, pool.getNumIdle(keya));
         final Object obj0 = pool.borrowObject(keya);
         final Object obj1 = pool.borrowObject(keya);
-        assertEquals(2,pool.getNumActive(keya));
-        assertEquals(0,pool.getNumIdle(keya));
-        pool.returnObject(keya,obj1);
-        pool.returnObject(keya,obj0);
-        assertEquals(0,pool.getNumActive(keya));
-        assertEquals(2,pool.getNumIdle(keya));
+        assertEquals(2, pool.getNumActive(keya));
+        assertEquals(0, pool.getNumIdle(keya));
+        pool.returnObject(keya, obj1);
+        pool.returnObject(keya, obj0);
+        assertEquals(0, pool.getNumActive(keya));
+        assertEquals(2, pool.getNumIdle(keya));
         pool.clear(keya);
-        assertEquals(0,pool.getNumActive(keya));
-        assertEquals(0,pool.getNumIdle(keya));
+        assertEquals(0, pool.getNumActive(keya));
+        assertEquals(0, pool.getNumIdle(keya));
         final Object obj2 = pool.borrowObject(keya);
-        assertEquals(getNthObject(keya,2),obj2);
+        assertEquals(getNthObject(keya, 2), obj2);
         pool.close();
     }
 
@@ -364,18 +361,18 @@ public abstract class AbstractTestKeyedObjectPool {
             return; // skip this test if unsupported
         }
         final Object keya = makeKey(0);
-        assertEquals(0,pool.getNumActive(keya));
-        assertEquals(0,pool.getNumIdle(keya));
+        assertEquals(0, pool.getNumActive(keya));
+        assertEquals(0, pool.getNumIdle(keya));
         final Object obj0 = pool.borrowObject(keya);
         final Object obj1 = pool.borrowObject(keya);
-        assertEquals(2,pool.getNumActive(keya));
-        assertEquals(0,pool.getNumIdle(keya));
-        pool.invalidateObject(keya,obj0);
-        assertEquals(1,pool.getNumActive(keya));
-        assertEquals(0,pool.getNumIdle(keya));
-        pool.invalidateObject(keya,obj1);
-        assertEquals(0,pool.getNumActive(keya));
-        assertEquals(0,pool.getNumIdle(keya));
+        assertEquals(2, pool.getNumActive(keya));
+        assertEquals(0, pool.getNumIdle(keya));
+        pool.invalidateObject(keya, obj0);
+        assertEquals(1, pool.getNumActive(keya));
+        assertEquals(0, pool.getNumIdle(keya));
+        pool.invalidateObject(keya, obj1);
+        assertEquals(0, pool.getNumActive(keya));
+        assertEquals(0, pool.getNumIdle(keya));
         pool.close();
     }
 
@@ -387,23 +384,23 @@ public abstract class AbstractTestKeyedObjectPool {
             return; // skip this test if unsupported
         }
         final Object keya = makeKey(0);
-        assertEquals(0,pool.getNumActive(keya));
-        assertEquals(0,pool.getNumIdle(keya));
+        assertEquals(0, pool.getNumActive(keya));
+        assertEquals(0, pool.getNumIdle(keya));
         final Object obj0 = pool.borrowObject(keya);
-        assertEquals(1,pool.getNumActive(keya));
-        assertEquals(0,pool.getNumIdle(keya));
+        assertEquals(1, pool.getNumActive(keya));
+        assertEquals(0, pool.getNumIdle(keya));
         final Object obj1 = pool.borrowObject(keya);
-        assertEquals(2,pool.getNumActive(keya));
-        assertEquals(0,pool.getNumIdle(keya));
-        pool.returnObject(keya,obj1);
-        assertEquals(1,pool.getNumActive(keya));
-        assertEquals(1,pool.getNumIdle(keya));
-        pool.returnObject(keya,obj0);
-        assertEquals(0,pool.getNumActive(keya));
-        assertEquals(2,pool.getNumIdle(keya));
-
-        assertEquals(0,pool.getNumActive("xyzzy12345"));
-        assertEquals(0,pool.getNumIdle("xyzzy12345"));
+        assertEquals(2, pool.getNumActive(keya));
+        assertEquals(0, pool.getNumIdle(keya));
+        pool.returnObject(keya, obj1);
+        assertEquals(1, pool.getNumActive(keya));
+        assertEquals(1, pool.getNumIdle(keya));
+        pool.returnObject(keya, obj0);
+        assertEquals(0, pool.getNumActive(keya));
+        assertEquals(2, pool.getNumIdle(keya));
+
+        assertEquals(0, pool.getNumActive("xyzzy12345"));
+        assertEquals(0, pool.getNumIdle("xyzzy12345"));
 
         pool.close();
     }
@@ -417,52 +414,52 @@ public abstract class AbstractTestKeyedObjectPool {
         }
         final Object keya = makeKey(0);
         final Object keyb = makeKey(1);
-        assertEquals(0,pool.getNumActive());
-        assertEquals(0,pool.getNumIdle());
-        assertEquals(0,pool.getNumActive(keya));
-        assertEquals(0,pool.getNumIdle(keya));
-        assertEquals(0,pool.getNumActive(keyb));
-        assertEquals(0,pool.getNumIdle(keyb));
+        assertEquals(0, pool.getNumActive());
+        assertEquals(0, pool.getNumIdle());
+        assertEquals(0, pool.getNumActive(keya));
+        assertEquals(0, pool.getNumIdle(keya));
+        assertEquals(0, pool.getNumActive(keyb));
+        assertEquals(0, pool.getNumIdle(keyb));
 
         final Object objA0 = pool.borrowObject(keya);
         final Object objB0 = pool.borrowObject(keyb);
 
-        assertEquals(2,pool.getNumActive());
-        assertEquals(0,pool.getNumIdle());
-        assertEquals(1,pool.getNumActive(keya));
-        assertEquals(0,pool.getNumIdle(keya));
-        assertEquals(1,pool.getNumActive(keyb));
-        assertEquals(0,pool.getNumIdle(keyb));
+        assertEquals(2, pool.getNumActive());
+        assertEquals(0, pool.getNumIdle());
+        assertEquals(1, pool.getNumActive(keya));
+        assertEquals(0, pool.getNumIdle(keya));
+        assertEquals(1, pool.getNumActive(keyb));
+        assertEquals(0, pool.getNumIdle(keyb));
 
         final Object objA1 = pool.borrowObject(keya);
         final Object objB1 = pool.borrowObject(keyb);
 
-        assertEquals(4,pool.getNumActive());
-        assertEquals(0,pool.getNumIdle());
-        assertEquals(2,pool.getNumActive(keya));
-        assertEquals(0,pool.getNumIdle(keya));
-        assertEquals(2,pool.getNumActive(keyb));
-        assertEquals(0,pool.getNumIdle(keyb));
-
-        pool.returnObject(keya,objA0);
-        pool.returnObject(keyb,objB0);
-
-        assertEquals(2,pool.getNumActive());
-        assertEquals(2,pool.getNumIdle());
-        assertEquals(1,pool.getNumActive(keya));
-        assertEquals(1,pool.getNumIdle(keya));
-        assertEquals(1,pool.getNumActive(keyb));
-        assertEquals(1,pool.getNumIdle(keyb));
-
-        pool.returnObject(keya,objA1);
-        pool.returnObject(keyb,objB1);
-
-        assertEquals(0,pool.getNumActive());
-        assertEquals(4,pool.getNumIdle());
-        assertEquals(0,pool.getNumActive(keya));
-        assertEquals(2,pool.getNumIdle(keya));
-        assertEquals(0,pool.getNumActive(keyb));
-        assertEquals(2,pool.getNumIdle(keyb));
+        assertEquals(4, pool.getNumActive());
+        assertEquals(0, pool.getNumIdle());
+        assertEquals(2, pool.getNumActive(keya));
+        assertEquals(0, pool.getNumIdle(keya));
+        assertEquals(2, pool.getNumActive(keyb));
+        assertEquals(0, pool.getNumIdle(keyb));
+
+        pool.returnObject(keya, objA0);
+        pool.returnObject(keyb, objB0);
+
+        assertEquals(2, pool.getNumActive());
+        assertEquals(2, pool.getNumIdle());
+        assertEquals(1, pool.getNumActive(keya));
+        assertEquals(1, pool.getNumIdle(keya));
+        assertEquals(1, pool.getNumActive(keyb));
+        assertEquals(1, pool.getNumIdle(keyb));
+
+        pool.returnObject(keya, objA1);
+        pool.returnObject(keyb, objB1);
+
+        assertEquals(0, pool.getNumActive());
+        assertEquals(4, pool.getNumIdle());
+        assertEquals(0, pool.getNumActive(keya));
+        assertEquals(2, pool.getNumIdle(keya));
+        assertEquals(0, pool.getNumActive(keyb));
+        assertEquals(2, pool.getNumIdle(keyb));
 
         pool.close();
     }
@@ -481,20 +478,19 @@ public abstract class AbstractTestKeyedObjectPool {
 
         pool.close();
 
-        assertThrows(IllegalStateException.class, () -> pool.addObject(KEY),
-                "A closed pool must throw an IllegalStateException when addObject is called.");
+        assertThrows(IllegalStateException.class, () -> pool.addObject(KEY), "A closed pool must throw an IllegalStateException when addObject is called.");
 
         assertThrows(IllegalStateException.class, () -> pool.borrowObject(KEY),
                 "A closed pool must throw an IllegalStateException when borrowObject is called.");
 
         // The following should not throw exceptions just because the pool is closed.
-        assertEquals( 0, pool.getNumIdle(KEY),"A closed pool shouldn't have any idle objects.");
-        assertEquals( 0, pool.getNumIdle(),"A closed pool shouldn't have any idle objects.");
+        assertEquals(0, pool.getNumIdle(KEY), "A closed pool shouldn't have any idle objects.");
+        assertEquals(0, pool.getNumIdle(), "A closed pool shouldn't have any idle objects.");
         pool.getNumActive();
         pool.getNumActive(KEY);
         pool.returnObject(KEY, o1);
-        assertEquals( 0, pool.getNumIdle(KEY),"returnObject should not add items back into the idle object pool for a closed pool.");
-        assertEquals( 0, pool.getNumIdle(),"returnObject should not add items back into the idle object pool for a closed pool.");
+        assertEquals(0, pool.getNumIdle(KEY), "returnObject should not add items back into the idle object pool for a closed pool.");
+        assertEquals(0, pool.getNumIdle(), "returnObject should not add items back into the idle object pool for a closed pool.");
         pool.invalidateObject(KEY, o2);
         pool.clear(KEY);
         pool.clear();
@@ -549,7 +545,6 @@ public abstract class AbstractTestKeyedObjectPool {
             return; // test not supported
         }
         final List<MethodCall> expectedMethods = new ArrayList<>();
-        Object obj;
 
         if (pool instanceof GenericKeyedObjectPool) {
             ((GenericKeyedObjectPool<Object, Object, PrivateException>) pool).setTestOnBorrow(true);
@@ -560,7 +555,7 @@ public abstract class AbstractTestKeyedObjectPool {
         // existing idle object should be activated and validated
         pool.addObject(KEY);
         clear(factory, expectedMethods);
-        obj = pool.borrowObject(KEY);
+        final Object obj = pool.borrowObject(KEY);
         expectedMethods.add(new MethodCall("activateObject", KEY, ZERO));
         expectedMethods.add(new MethodCall("validateObject", KEY, ZERO).returned(Boolean.TRUE));
         assertEquals(expectedMethods, factory.getMethodCalls());
@@ -637,7 +632,7 @@ public abstract class AbstractTestKeyedObjectPool {
     @Test
     public void testKPOFCloseUsages() {
         final FailingKeyedPooledObjectFactory factory = new FailingKeyedPooledObjectFactory();
-        KeyedObjectPool<Object, Object, PrivateException> pool;
+        final KeyedObjectPool<Object, Object, PrivateException> pool;
         try {
             pool = makeEmptyPool(factory);
         } catch (final UnsupportedOperationException uoe) {
@@ -650,7 +645,7 @@ public abstract class AbstractTestKeyedObjectPool {
         pool.close();
 
         // Test exception handling close should swallow failures
-        try (final KeyedObjectPool<Object, Object, PrivateException> pool2 = makeEmptyPool(factory)) {
+        try (KeyedObjectPool<Object, Object, PrivateException> pool2 = makeEmptyPool(factory)) {
             reset(pool2, factory, expectedMethods);
             factory.setDestroyObjectFail(true);
             pool2.addObjects(KEY, 5);
@@ -667,11 +662,10 @@ public abstract class AbstractTestKeyedObjectPool {
             return; // test not supported
         }
         final List<MethodCall> expectedMethods = new ArrayList<>();
-        Object obj;
 
         // Test correct behavior code paths
 
-        obj = pool.borrowObject(KEY);
+        final Object obj = pool.borrowObject(KEY);
         clear(factory, expectedMethods);
 
         // invalidated object should be destroyed
@@ -730,7 +724,7 @@ public abstract class AbstractTestKeyedObjectPool {
         expectedMethods.add(new MethodCall("passivateObject", KEY, obj));
         AbstractTestObjectPool.removeDestroyObjectCall(factory.getMethodCalls()); // The exact timing of destroyObject is flexible here.
         assertEquals(expectedMethods, factory.getMethodCalls());
-        assertEquals(1, pool.getNumIdle(KEY));   // Not added
+        assertEquals(1, pool.getNumIdle(KEY)); // Not added
         assertEquals(1, pool.getNumActive(KEY)); // But not active
 
         reset(pool, factory, expectedMethods);
@@ -752,7 +746,7 @@ public abstract class AbstractTestKeyedObjectPool {
     @Test
     public void testToString() {
         final FailingKeyedPooledObjectFactory factory = new FailingKeyedPooledObjectFactory();
-        try (final KeyedObjectPool<Object, Object, PrivateException> pool = makeEmptyPool(factory)) {
+        try (KeyedObjectPool<Object, Object, PrivateException> pool = makeEmptyPool(factory)) {
             pool.toString();
         } catch (final UnsupportedOperationException uoe) {
             return; // test not supported
diff --git a/src/test/java/org/apache/commons/pool3/AbstractTestObjectPool.java b/src/test/java/org/apache/commons/pool3/AbstractTestObjectPool.java
index ef8cc6f7..8f180544 100644
--- a/src/test/java/org/apache/commons/pool3/AbstractTestObjectPool.java
+++ b/src/test/java/org/apache/commons/pool3/AbstractTestObjectPool.java
@@ -42,11 +42,13 @@ public abstract class AbstractTestObjectPool {
         calls.removeIf(call -> "destroyObject".equals(call.getName()));
     }
 
-    private static void reset(final ObjectPool<Object, ?> pool, final MethodCallPoolableObjectFactory factory, final List<MethodCall> expectedMethods) throws Exception {
+    private static void reset(final ObjectPool<Object, ?> pool, final MethodCallPoolableObjectFactory factory, final List<MethodCall> expectedMethods)
+            throws Exception {
         pool.clear();
         clear(factory, expectedMethods);
         factory.reset();
     }
+
     // Deliberate choice to create a new object in case future unit tests check
     // for a specific object.
     private final Integer ZERO = Integer.valueOf(0);
@@ -86,24 +88,24 @@ public abstract class AbstractTestObjectPool {
 
         // The following should not throw exceptions just because the pool is closed.
         if (pool.getNumIdle() >= 0) {
-            assertEquals( 0, pool.getNumIdle(),"A closed pool shouldn't have any idle objects.");
+            assertEquals(0, pool.getNumIdle(), "A closed pool shouldn't have any idle objects.");
         }
         if (pool.getNumActive() >= 0) {
-            assertEquals( 2, pool.getNumActive(),"A closed pool should still keep count of active objects.");
+            assertEquals(2, pool.getNumActive(), "A closed pool should still keep count of active objects.");
         }
         pool.returnObject(o1);
         if (pool.getNumIdle() >= 0) {
-            assertEquals( 0, pool.getNumIdle(),"returnObject should not add items back into the idle object pool for a closed pool.");
+            assertEquals(0, pool.getNumIdle(), "returnObject should not add items back into the idle object pool for a closed pool.");
         }
         if (pool.getNumActive() >= 0) {
-            assertEquals( 1, pool.getNumActive(),"A closed pool should still keep count of active objects.");
+            assertEquals(1, pool.getNumActive(), "A closed pool should still keep count of active objects.");
         }
         pool.invalidateObject(o2);
         if (pool.getNumIdle() >= 0) {
-            assertEquals( 0, pool.getNumIdle(),"invalidateObject must not add items back into the idle object pool.");
+            assertEquals(0, pool.getNumIdle(), "invalidateObject must not add items back into the idle object pool.");
         }
         if (pool.getNumActive() >= 0) {
-            assertEquals( 0, pool.getNumActive(),"A closed pool should still keep count of active objects.");
+            assertEquals(0, pool.getNumActive(), "A closed pool should still keep count of active objects.");
         }
         pool.clear();
         pool.close();
@@ -173,14 +175,13 @@ public abstract class AbstractTestObjectPool {
             ((GenericObjectPool<Object, PrivateException>) pool).setTestOnBorrow(true);
         }
         final List<MethodCall> expectedMethods = new ArrayList<>();
-        Object obj;
 
         // Test correct behavior code paths
 
         // existing idle object should be activated and validated
         pool.addObject();
         clear(factory, expectedMethods);
-        obj = pool.borrowObject();
+        final Object obj = pool.borrowObject();
         expectedMethods.add(new MethodCall("activateObject", ZERO));
         expectedMethods.add(new MethodCall("validateObject", ZERO).returned(Boolean.TRUE));
         assertEquals(expectedMethods, factory.getMethodCalls());
@@ -291,11 +292,10 @@ public abstract class AbstractTestObjectPool {
             return; // test not supported
         }
         final List<MethodCall> expectedMethods = new ArrayList<>();
-        Object obj;
 
         // Test correct behavior code paths
 
-        obj = pool.borrowObject();
+        final Object obj = pool.borrowObject();
         clear(factory, expectedMethods);
 
         // invalidated object should be destroyed
diff --git a/src/test/java/org/apache/commons/pool3/MethodCall.java b/src/test/java/org/apache/commons/pool3/MethodCall.java
index dd77cd56..f622ae3e 100644
--- a/src/test/java/org/apache/commons/pool3/MethodCall.java
+++ b/src/test/java/org/apache/commons/pool3/MethodCall.java
@@ -62,9 +62,7 @@ public class MethodCall {
         if (o == null || getClass() != o.getClass()) {
             return false;
         }
-
-        final MethodCall that = (MethodCall)o;
-
+        final MethodCall that = (MethodCall) o;
         if (!Objects.equals(name, that.name)) {
             return false;
         }
diff --git a/src/test/java/org/apache/commons/pool3/PoolTest.java b/src/test/java/org/apache/commons/pool3/PoolTest.java
index b36d2ca8..dd016a42 100644
--- a/src/test/java/org/apache/commons/pool3/PoolTest.java
+++ b/src/test/java/org/apache/commons/pool3/PoolTest.java
@@ -96,7 +96,7 @@ public class PoolTest {
                 continue;
             }
             final String name = thread.getName();
-            assertFalse( name.contains(COMMONS_POOL_EVICTIONS_TIMER_THREAD_NAME),name);
+            assertFalse(name.contains(COMMONS_POOL_EVICTIONS_TIMER_THREAD_NAME), name);
         }
     }
-}
\ No newline at end of file
+}
diff --git a/src/test/java/org/apache/commons/pool3/TestBaseKeyedPooledObjectFactory.java b/src/test/java/org/apache/commons/pool3/TestBaseKeyedPooledObjectFactory.java
index a48e8a1b..73a0b402 100644
--- a/src/test/java/org/apache/commons/pool3/TestBaseKeyedPooledObjectFactory.java
+++ b/src/test/java/org/apache/commons/pool3/TestBaseKeyedPooledObjectFactory.java
@@ -30,6 +30,7 @@ public class TestBaseKeyedPooledObjectFactory {
         public Object create(final Object key) {
             return null;
         }
+
         @Override
         public PooledObject<Object> wrap(final Object value) {
             return new DefaultPooledObject<>(value);
@@ -40,9 +41,9 @@ public class TestBaseKeyedPooledObjectFactory {
     public void testDefaultMethods() {
         final KeyedPooledObjectFactory<Object, Object, RuntimeException> factory = new TestFactory();
 
-        factory.activateObject("key",null); // a no-op
-        factory.passivateObject("key",null); // a no-op
-        factory.destroyObject("key",null); // a no-op
-        assertTrue(factory.validateObject("key",null)); // constant true
+        factory.activateObject("key", null); // a no-op
+        factory.passivateObject("key", null); // a no-op
+        factory.destroyObject("key", null); // a no-op
+        assertTrue(factory.validateObject("key", null)); // constant true
     }
-}
\ No newline at end of file
+}
diff --git a/src/test/java/org/apache/commons/pool3/TestBaseObjectPool.java b/src/test/java/org/apache/commons/pool3/TestBaseObjectPool.java
index c808e5a5..44f2e5b6 100644
--- a/src/test/java/org/apache/commons/pool3/TestBaseObjectPool.java
+++ b/src/test/java/org/apache/commons/pool3/TestBaseObjectPool.java
@@ -72,7 +72,9 @@ public class TestBaseObjectPool extends AbstractTestObjectPool {
 
     /**
      * @param minCapacity Ignored by this implemented. Used by sub-classes.
-     * @return A newly created empty pool
+     * @return A newly created empty pool.
+     *
+     * @param <E> Type of exception thrown by the pool.
      */
     protected <E extends Exception> ObjectPool<String, E> makeEmptyPool(final int minCapacity) {
         if (this.getClass() != TestBaseObjectPool.class) {
@@ -152,18 +154,18 @@ public class TestBaseObjectPool extends AbstractTestObjectPool {
         pool.returnObject(obj2);
         obj2 = pool.borrowObject();
         if (isLifo()) {
-            assertEquals(getNthObject(2),obj2);
+            assertEquals(getNthObject(2), obj2);
         }
         if (isFifo()) {
-            assertEquals(getNthObject(0),obj2);
+            assertEquals(getNthObject(0), obj2);
         }
 
         obj0 = pool.borrowObject();
         if (isLifo()) {
-            assertEquals(getNthObject(0),obj0);
+            assertEquals(getNthObject(0), obj0);
         }
         if (isFifo()) {
-            assertEquals(getNthObject(2),obj0);
+            assertEquals(getNthObject(2), obj0);
         }
         pool.close();
     }
@@ -267,10 +269,10 @@ public class TestBaseObjectPool extends AbstractTestObjectPool {
         if (!getClass().equals(TestBaseObjectPool.class)) {
             return; // skip redundant tests
         }
-        try (final ObjectPool<Object,RuntimeException> pool = new TestObjectPool()) {
+        try (ObjectPool<Object, RuntimeException> pool = new TestObjectPool()) {
 
-            assertTrue( pool.getNumIdle() < 0,"Negative expected.");
-            assertTrue( pool.getNumActive() < 0,"Negative expected.");
+            assertTrue(pool.getNumIdle() < 0, "Negative expected.");
+            assertTrue(pool.getNumActive() < 0, "Negative expected.");
 
             assertThrows(UnsupportedOperationException.class, pool::clear);
             assertThrows(UnsupportedOperationException.class, pool::addObject);
diff --git a/src/test/java/org/apache/commons/pool3/TestBasePoolableObjectFactory.java b/src/test/java/org/apache/commons/pool3/TestBasePoolableObjectFactory.java
index f6da35c5..c1f9b8d4 100644
--- a/src/test/java/org/apache/commons/pool3/TestBasePoolableObjectFactory.java
+++ b/src/test/java/org/apache/commons/pool3/TestBasePoolableObjectFactory.java
@@ -33,12 +33,14 @@ public class TestBasePoolableObjectFactory {
         public AtomicInteger create() {
             return new AtomicInteger();
         }
+
         @Override
-        public void destroyObject(final PooledObject<AtomicInteger> p, final DestroyMode destroyMode){
+        public void destroyObject(final PooledObject<AtomicInteger> p, final DestroyMode destroyMode) {
             if (destroyMode.equals(DestroyMode.ABANDONED)) {
                 p.getObject().incrementAndGet();
             }
         }
+
         @Override
         public PooledObject<AtomicInteger> wrap(final AtomicInteger value) {
             return new DefaultPooledObject<>(value);
@@ -56,9 +58,8 @@ public class TestBasePoolableObjectFactory {
     }
 
     /**
-     * Default destroy does nothing to underlying AtomicInt, ABANDONED mode
-     * increments the value.  Verify that destroy with no mode does default,
-     * destroy with ABANDONED mode increments.
+     * Default destroy does nothing to underlying AtomicInt, ABANDONED mode increments the value. Verify that destroy with no mode does default, destroy with
+     * ABANDONED mode increments.
      *
      * @throws RuntimeException May occur in some failure modes
      */
diff --git a/src/test/java/org/apache/commons/pool3/TestPoolUtils.java b/src/test/java/org/apache/commons/pool3/TestPoolUtils.java
index 955e716c..40a229bc 100644
--- a/src/test/java/org/apache/commons/pool3/TestPoolUtils.java
+++ b/src/test/java/org/apache/commons/pool3/TestPoolUtils.java
@@ -158,12 +158,12 @@ public class TestPoolUtils {
         assertThrows(IllegalArgumentException.class, () -> PoolUtils.checkMinIdle(null, new Object(), 1, 1),
                 "PoolUtils.checkMinIdle(KeyedObjectPool,Object,int,long) must not allow null pool.");
         try (@SuppressWarnings("unchecked")
-        final KeyedObjectPool<Object, Object, RuntimeException> pool = createProxy(KeyedObjectPool.class, (List<String>) null)) {
+            KeyedObjectPool<Object, Object, RuntimeException> pool = createProxy(KeyedObjectPool.class, (List<String>) null)) {
             assertThrows(IllegalArgumentException.class, () -> PoolUtils.checkMinIdle(pool, (Object) null, 1, 1),
                     "PoolUtils.checkMinIdle(KeyedObjectPool,Object,int,long) must not accept null keys.");
         }
         try (@SuppressWarnings("unchecked")
-        final KeyedObjectPool<Object, Object, RuntimeException> pool = createProxy(KeyedObjectPool.class, (List<String>) null)) {
+            KeyedObjectPool<Object, Object, RuntimeException> pool = createProxy(KeyedObjectPool.class, (List<String>) null)) {
             assertThrows(IllegalArgumentException.class, () -> PoolUtils.checkMinIdle(pool, new Object(), -1, 1),
                     "PoolUtils.checkMinIdle(KeyedObjectPool,Object,int,long) must not accept negative min idle values.");
         }
@@ -174,7 +174,7 @@ public class TestPoolUtils {
         // Test that the minIdle check doesn't add too many idle objects
         @SuppressWarnings("unchecked")
         final KeyedPooledObjectFactory<Object, Object, RuntimeException> kpof = createProxy(KeyedPooledObjectFactory.class, calledMethods);
-        try (final KeyedObjectPool<Object, Object, RuntimeException> kop = new GenericKeyedObjectPool<>(kpof)) {
+        try (KeyedObjectPool<Object, Object, RuntimeException> kop = new GenericKeyedObjectPool<>(kpof)) {
             PoolUtils.checkMinIdle(kop, key, 2, 100);
             Thread.sleep(400);
             assertEquals(2, kop.getNumIdle(key));
@@ -196,7 +196,7 @@ public class TestPoolUtils {
             try {
                 calledMethods.clear();
                 try (@SuppressWarnings("unchecked")
-                final KeyedObjectPool<Object, Object, RuntimeException> pool = createProxy(KeyedObjectPool.class, calledMethods)) {
+                    KeyedObjectPool<Object, Object, RuntimeException> pool = createProxy(KeyedObjectPool.class, calledMethods)) {
                     // checks minIdle immediately
                     final TimerTask task = PoolUtils.checkMinIdle(pool, key, 1, CHECK_PERIOD);
 
@@ -230,7 +230,7 @@ public class TestPoolUtils {
             afe = null;
             final List<String> calledMethods = new ArrayList<>();
             try (@SuppressWarnings("unchecked")
-            final KeyedObjectPool<String, Object, RuntimeException> pool = createProxy(KeyedObjectPool.class, calledMethods)) {
+                KeyedObjectPool<String, Object, RuntimeException> pool = createProxy(KeyedObjectPool.class, calledMethods)) {
                 final Collection<String> keys = new ArrayList<>(2);
                 keys.add("one");
                 keys.add("two");
@@ -258,13 +258,13 @@ public class TestPoolUtils {
     @Test
     public void testCheckMinIdleKeyedObjectPoolKeysNulls() {
         try (@SuppressWarnings("unchecked")
-        final KeyedObjectPool<Object, Object, RuntimeException> pool = createProxy(KeyedObjectPool.class, (List<String>) null)) {
+            KeyedObjectPool<Object, Object, RuntimeException> pool = createProxy(KeyedObjectPool.class, (List<String>) null)) {
             assertThrows(IllegalArgumentException.class, () -> PoolUtils.checkMinIdle(pool, (Collection<?>) null, 1, 1),
                     "PoolUtils.checkMinIdle(KeyedObjectPool,Collection,int,long) must not accept null keys.");
         }
 
         try (@SuppressWarnings("unchecked")
-        final KeyedObjectPool<Object, Object, RuntimeException> pool = createProxy(KeyedObjectPool.class, (List<String>) null)) {
+            KeyedObjectPool<Object, Object, RuntimeException> pool = createProxy(KeyedObjectPool.class, (List<String>) null)) {
             PoolUtils.checkMinIdle(pool, (Collection<?>) Collections.emptyList(), 1, 1);
         } catch (final IllegalArgumentException iae) {
             fail("PoolUtils.checkMinIdle(KeyedObjectPool,Collection,int,long) must accept empty lists.");
@@ -276,7 +276,7 @@ public class TestPoolUtils {
         assertThrows(IllegalArgumentException.class, () -> PoolUtils.checkMinIdle(null, 1, 1),
                 "PoolUtils.checkMinIdle(ObjectPool,,) must not allow null pool.");
         try (@SuppressWarnings("unchecked")
-        final ObjectPool<Object, RuntimeException> pool = createProxy(ObjectPool.class, (List<String>) null)) {
+            ObjectPool<Object, RuntimeException> pool = createProxy(ObjectPool.class, (List<String>) null)) {
             assertThrows(IllegalArgumentException.class, () -> PoolUtils.checkMinIdle(pool, -1, 1),
                     "PoolUtils.checkMinIdle(ObjectPool,,) must not accept negative min idle values.");
         }
@@ -286,7 +286,7 @@ public class TestPoolUtils {
         // Test that the minIdle check doesn't add too many idle objects
         @SuppressWarnings("unchecked")
         final PooledObjectFactory<Object, RuntimeException> pof = createProxy(PooledObjectFactory.class, calledMethods);
-        try (final ObjectPool<Object, RuntimeException> op = new GenericObjectPool<>(pof)) {
+        try (ObjectPool<Object, RuntimeException> op = new GenericObjectPool<>(pof)) {
             PoolUtils.checkMinIdle(op, 2, 100);
             Thread.sleep(1000);
             assertEquals(2, op.getNumIdle());
@@ -307,7 +307,7 @@ public class TestPoolUtils {
             try {
                 calledMethods.clear();
                 try (@SuppressWarnings("unchecked")
-                final ObjectPool<Object, RuntimeException> pool = createProxy(ObjectPool.class, calledMethods)) {
+                    ObjectPool<Object, RuntimeException> pool = createProxy(ObjectPool.class, calledMethods)) {
                     final TimerTask task = PoolUtils.checkMinIdle(pool, 1, CHECK_PERIOD); // checks minIdle immediately
 
                     Thread.sleep(CHECK_SLEEP_PERIOD); // will check CHECK_COUNT more times.
@@ -344,8 +344,8 @@ public class TestPoolUtils {
     @Test
     public void testErodingObjectPoolDefaultFactor() {
         try (@SuppressWarnings("unchecked")
-        final ObjectPool<Object, RuntimeException> internalPool = createProxy(ObjectPool.class, (arg0, arg1, arg2) -> null);
-                final ObjectPool<Object, RuntimeException> pool = PoolUtils.erodingPool(internalPool)) {
+             ObjectPool<Object, RuntimeException> internalPool = createProxy(ObjectPool.class, (arg0, arg1, arg2) -> null);
+             ObjectPool<Object, RuntimeException> pool = PoolUtils.erodingPool(internalPool)) {
             final String expectedToString = "ErodingObjectPool{factor=ErodingFactor{factor=1.0, idleHighWaterMark=1}, pool=" +
                     internalPool + "}";
             // The factor is not exposed, but will be printed in the toString() method
@@ -381,7 +381,7 @@ public class TestPoolUtils {
         // If the logic behind PoolUtils.erodingPool changes then this will need to be tweaked.
         final float factor = 0.01f; // about ~9 seconds until first discard
         try (@SuppressWarnings("unchecked")
-        final KeyedObjectPool<Object, Object, RuntimeException> pool = PoolUtils.erodingPool(createProxy(KeyedObjectPool.class, handler), factor, true)) {
+            KeyedObjectPool<Object, Object, RuntimeException> pool = PoolUtils.erodingPool(createProxy(KeyedObjectPool.class, handler), factor, true)) {
 
             final List<String> expectedMethods = new ArrayList<>();
             assertEquals(expectedMethods, calledMethods);
@@ -460,7 +460,7 @@ public class TestPoolUtils {
         final float factor = 0.01f; // about ~9 seconds until first discard
         final List<String> expectedMethods = new ArrayList<>();
         try (@SuppressWarnings("unchecked")
-        final KeyedObjectPool<Object, Object, RuntimeException> pool = PoolUtils.erodingPool(createProxy(KeyedObjectPool.class, handler), factor)) {
+            KeyedObjectPool<Object, Object, RuntimeException> pool = PoolUtils.erodingPool(createProxy(KeyedObjectPool.class, handler), factor)) {
 
             assertEquals(expectedMethods, calledMethods);
 
@@ -516,11 +516,9 @@ public class TestPoolUtils {
     @Test
     public void testErodingPoolKeyedObjectPoolDefaultFactor() {
         try (@SuppressWarnings("unchecked")
-        final KeyedObjectPool<Object, Object, RuntimeException> internalPool = createProxy(KeyedObjectPool.class,
-                (arg0, arg1, arg2) -> null);
-                final KeyedObjectPool<Object, Object, RuntimeException> pool = PoolUtils.erodingPool(internalPool)) {
-            final String expectedToString = "ErodingKeyedObjectPool{factor=ErodingFactor{factor=1.0, idleHighWaterMark=1}, keyedPool=" +
-                    internalPool + "}";
+            KeyedObjectPool<Object, Object, RuntimeException> internalPool = createProxy(KeyedObjectPool.class, (arg0, arg1, arg2) -> null);
+                KeyedObjectPool<Object, Object, RuntimeException> pool = PoolUtils.erodingPool(internalPool)) {
+            final String expectedToString = "ErodingKeyedObjectPool{factor=ErodingFactor{factor=1.0, idleHighWaterMark=1}, keyedPool=" + internalPool + "}";
             // The factor is not exposed, but will be printed in the toString() method
             // In this case since we didn't pass one, the default 1.0f will be printed
             assertEquals(expectedToString, pool.toString());
@@ -555,7 +553,7 @@ public class TestPoolUtils {
         final float factor = 0.01f; // about ~9 seconds until first discard
         final List<String> expectedMethods = new ArrayList<>();
         try (@SuppressWarnings("unchecked")
-        final ObjectPool<Object, RuntimeException> pool = PoolUtils.erodingPool(createProxy(ObjectPool.class, handler), factor)) {
+            ObjectPool<Object, RuntimeException> pool = PoolUtils.erodingPool(createProxy(ObjectPool.class, handler), factor)) {
 
             assertEquals(expectedMethods, calledMethods);
 
@@ -651,8 +649,8 @@ public class TestPoolUtils {
 
         final List<String> calledMethods = new ArrayList<>();
         try (@SuppressWarnings("unchecked")
-            final KeyedObjectPool<Object, Object, RuntimeException> kop = createProxy(KeyedObjectPool.class, calledMethods);
-            final KeyedObjectPool<Object, Object, RuntimeException> skop = PoolUtils.synchronizedPool(kop)) {
+            KeyedObjectPool<Object, Object, RuntimeException> kop = createProxy(KeyedObjectPool.class, calledMethods);
+            KeyedObjectPool<Object, Object, RuntimeException> skop = PoolUtils.synchronizedPool(kop)) {
             final List<String> expectedMethods = invokeEveryMethod(skop);
             assertEquals(expectedMethods, calledMethods);
         }
@@ -667,7 +665,8 @@ public class TestPoolUtils {
 
         final List<String> calledMethods = new ArrayList<>();
         try (@SuppressWarnings("unchecked")
-        final ObjectPool<Object, RuntimeException> op = createProxy(ObjectPool.class, calledMethods); final ObjectPool<Object, RuntimeException> sop = PoolUtils.synchronizedPool(op)) {
+            ObjectPool<Object, RuntimeException> op = createProxy(ObjectPool.class, calledMethods);
+                ObjectPool<Object, RuntimeException> sop = PoolUtils.synchronizedPool(op)) {
             final List<String> expectedMethods = invokeEveryMethod(sop);
             assertEquals(expectedMethods, calledMethods);
 
diff --git a/src/test/java/org/apache/commons/pool3/WaiterFactory.java b/src/test/java/org/apache/commons/pool3/WaiterFactory.java
index 29ed3453..2b75e99c 100644
--- a/src/test/java/org/apache/commons/pool3/WaiterFactory.java
+++ b/src/test/java/org/apache/commons/pool3/WaiterFactory.java
@@ -64,7 +64,7 @@ public class WaiterFactory<K> implements PooledObjectFactory<Waiter, IllegalStat
     private long activeCount;
 
     /** Count of (makes - destroys) per key since last reset */
-    private final Map<K,Integer> activeCounts = new HashMap<>();
+    private final Map<K, Integer> activeCounts = new HashMap<>();
 
     /** Maximum of (makes - destroys) - if exceeded IllegalStateException */
     private final long maxActive;  // GKOP 1.x calls this maxTotal
@@ -72,24 +72,18 @@ public class WaiterFactory<K> implements PooledObjectFactory<Waiter, IllegalStat
     /** Maximum of (makes - destroys) per key */
     private final long maxActivePerKey;  // GKOP 1.x calls this maxActive
 
-    public WaiterFactory(final long activateLatency, final long destroyLatency,
-            final long makeLatency, final long passivateLatency, final long validateLatency,
+    public WaiterFactory(final long activateLatency, final long destroyLatency, final long makeLatency, final long passivateLatency, final long validateLatency,
             final long waiterLatency) {
-        this(activateLatency, destroyLatency, makeLatency, passivateLatency,
-                validateLatency, waiterLatency, Long.MAX_VALUE, Long.MAX_VALUE, 0);
+        this(activateLatency, destroyLatency, makeLatency, passivateLatency, validateLatency, waiterLatency, Long.MAX_VALUE, Long.MAX_VALUE, 0);
     }
 
-    public WaiterFactory(final long activateLatency, final long destroyLatency,
-            final long makeLatency, final long passivateLatency, final long validateLatency,
-            final long waiterLatency,final long maxActive) {
-        this(activateLatency, destroyLatency, makeLatency, passivateLatency,
-                validateLatency, waiterLatency, maxActive, Long.MAX_VALUE, 0);
+    public WaiterFactory(final long activateLatency, final long destroyLatency, final long makeLatency, final long passivateLatency, final long validateLatency,
+            final long waiterLatency, final long maxActive) {
+        this(activateLatency, destroyLatency, makeLatency, passivateLatency, validateLatency, waiterLatency, maxActive, Long.MAX_VALUE, 0);
     }
 
-    public WaiterFactory(final long activateLatency, final long destroyLatency,
-            final long makeLatency, final long passivateLatency, final long validateLatency,
-            final long waiterLatency,final long maxActive, final long maxActivePerKey,
-            final double passivateInvalidationProbability) {
+    public WaiterFactory(final long activateLatency, final long destroyLatency, final long makeLatency, final long passivateLatency, final long validateLatency,
+            final long waiterLatency, final long maxActive, final long maxActivePerKey, final double passivateInvalidationProbability) {
         this.activateLatency = activateLatency;
         this.destroyLatency = destroyLatency;
         this.makeLatency = makeLatency;
diff --git a/src/test/java/org/apache/commons/pool3/impl/AtomicIntegerFactory.java b/src/test/java/org/apache/commons/pool3/impl/AtomicIntegerFactory.java
index 7dfc3087..71a4aaf4 100644
--- a/src/test/java/org/apache/commons/pool3/impl/AtomicIntegerFactory.java
+++ b/src/test/java/org/apache/commons/pool3/impl/AtomicIntegerFactory.java
@@ -105,4 +105,4 @@ public class AtomicIntegerFactory
     public PooledObject<AtomicInteger> wrap(final AtomicInteger integer) {
         return new DefaultPooledObject<>(integer);
     }
-}
\ No newline at end of file
+}
diff --git a/src/test/java/org/apache/commons/pool3/impl/CallStackTest.java b/src/test/java/org/apache/commons/pool3/impl/CallStackTest.java
index a625c908..7d7bd697 100644
--- a/src/test/java/org/apache/commons/pool3/impl/CallStackTest.java
+++ b/src/test/java/org/apache/commons/pool3/impl/CallStackTest.java
@@ -60,4 +60,4 @@ public class CallStackTest {
         final String stackTrace = writer.toString();
         assertTrue(stackTrace.contains(getClass().getName()));
     }
-}
\ No newline at end of file
+}
diff --git a/src/test/java/org/apache/commons/pool3/impl/DisconnectingWaiterFactory.java b/src/test/java/org/apache/commons/pool3/impl/DisconnectingWaiterFactory.java
index 4dcbd56f..9ab1dd71 100644
--- a/src/test/java/org/apache/commons/pool3/impl/DisconnectingWaiterFactory.java
+++ b/src/test/java/org/apache/commons/pool3/impl/DisconnectingWaiterFactory.java
@@ -57,7 +57,7 @@ public class DisconnectingWaiterFactory<K> extends WaiterFactory<K> {
      */
     protected static final Predicate<PooledObject<Waiter>> DEFAULT_DISCONNECTED_VALIDATION_ACTION = w -> false;
 
-    /**
+    /*
      * Blocks until connected or maxWait is exceeded.
      *
      * @throws TimeoutException if maxWait is exceeded.
diff --git a/src/test/java/org/apache/commons/pool3/impl/NoOpCallStackTest.java b/src/test/java/org/apache/commons/pool3/impl/NoOpCallStackTest.java
index 0b17c5fa..c13e3d62 100644
--- a/src/test/java/org/apache/commons/pool3/impl/NoOpCallStackTest.java
+++ b/src/test/java/org/apache/commons/pool3/impl/NoOpCallStackTest.java
@@ -32,4 +32,4 @@ public class NoOpCallStackTest {
         stack.printStackTrace(new PrintWriter(writer));
         assertEquals("", writer.toString());
     }
-}
\ No newline at end of file
+}
diff --git a/src/test/java/org/apache/commons/pool3/impl/TestAbandonedKeyedObjectPool.java b/src/test/java/org/apache/commons/pool3/impl/TestAbandonedKeyedObjectPool.java
index f202859e..c2328782 100644
--- a/src/test/java/org/apache/commons/pool3/impl/TestAbandonedKeyedObjectPool.java
+++ b/src/test/java/org/apache/commons/pool3/impl/TestAbandonedKeyedObjectPool.java
@@ -46,10 +46,10 @@ import org.junit.jupiter.api.Test;
  */
 public class TestAbandonedKeyedObjectPool {
 
-    final class ConcurrentBorrower extends Thread {
+    private final class ConcurrentBorrower extends Thread {
         private final ArrayList<PooledTestObject> borrowed;
 
-        public ConcurrentBorrower(final ArrayList<PooledTestObject> borrowed) {
+        private ConcurrentBorrower(final ArrayList<PooledTestObject> borrowed) {
             this.borrowed = borrowed;
         }
 
@@ -62,11 +62,14 @@ public class TestAbandonedKeyedObjectPool {
             }
         }
     }
-    final class ConcurrentReturner extends Thread {
+
+    private final class ConcurrentReturner extends Thread {
         private final PooledTestObject returned;
-        public ConcurrentReturner(final PooledTestObject obj) {
+
+        private ConcurrentReturner(final PooledTestObject obj) {
             returned = obj;
         }
+
         @Override
         public void run() {
             try {
@@ -83,12 +86,12 @@ public class TestAbandonedKeyedObjectPool {
         private final long destroyLatencyMillis;
         private final long validateLatencyMillis;
 
-        public SimpleFactory() {
+        private SimpleFactory() {
             destroyLatencyMillis = 0;
             validateLatencyMillis = 0;
         }
 
-        public SimpleFactory(final long destroyLatencyMillis, final long validateLatencyMillis) {
+        private SimpleFactory(final long destroyLatencyMillis, final long validateLatencyMillis) {
             this.destroyLatencyMillis = destroyLatencyMillis;
             this.validateLatencyMillis = validateLatencyMillis;
         }
@@ -163,8 +166,7 @@ public class TestAbandonedKeyedObjectPool {
         pool = null;
 
         final MBeanServer mbs = ManagementFactory.getPlatformMBeanServer();
-        final Set<ObjectName> result = mbs.queryNames(new ObjectName(
-                "org.apache.commoms.pool3:type=GenericKeyedObjectPool,*"), null);
+        final Set<ObjectName> result = mbs.queryNames(new ObjectName("org.apache.commoms.pool3:type=GenericKeyedObjectPool,*"), null);
         // There should be no registered pools at this point
         final int registeredPoolCount = result.size();
         final StringBuilder msg = new StringBuilder("Current pool is: ");
@@ -178,7 +180,7 @@ public class TestAbandonedKeyedObjectPool {
             msg.append('\n');
             mbs.unregisterMBean(name);
         }
-        assertEquals(0, registeredPoolCount,msg.toString());
+        assertEquals(0, registeredPoolCount, msg.toString());
     }
 
     /**
@@ -356,7 +358,7 @@ public class TestAbandonedKeyedObjectPool {
         // validation takes a second, evictor runs every 500 ms
         final PooledTestObject obj = pool.borrowObject(0);
         Thread.sleep(50);       // abandon obj
-        pool.returnObject(0,obj); // evictor will run during validation
+        pool.returnObject(0, obj); // evictor will run during validation
         final PooledTestObject obj2 = pool.borrowObject(0);
         assertEquals(obj, obj2);          // should get original back
         assertFalse(obj2.isDestroyed());  // and not destroyed
diff --git a/src/test/java/org/apache/commons/pool3/impl/TestAbandonedObjectPool.java b/src/test/java/org/apache/commons/pool3/impl/TestAbandonedObjectPool.java
index 9c0d2665..269bad02 100644
--- a/src/test/java/org/apache/commons/pool3/impl/TestAbandonedObjectPool.java
+++ b/src/test/java/org/apache/commons/pool3/impl/TestAbandonedObjectPool.java
@@ -54,7 +54,7 @@ final class PooledTestObject implements TrackedUse {
     private boolean abandoned;
     private boolean detached;  // destroy-abandoned "detaches"
 
-    public PooledTestObject() {
+    PooledTestObject() {
         this.hash = ATOMIC_HASH.incrementAndGet();
     }
 
@@ -115,10 +115,10 @@ final class PooledTestObject implements TrackedUse {
  */
 public class TestAbandonedObjectPool {
 
-    final class ConcurrentBorrower extends Thread {
+    private final class ConcurrentBorrower extends Thread {
         private final ArrayList<PooledTestObject> borrowed;
 
-        public ConcurrentBorrower(final ArrayList<PooledTestObject> borrowed) {
+        private ConcurrentBorrower(final ArrayList<PooledTestObject> borrowed) {
             this.borrowed = borrowed;
         }
 
@@ -131,11 +131,14 @@ public class TestAbandonedObjectPool {
             }
         }
     }
-    final class ConcurrentReturner extends Thread {
+
+    private final class ConcurrentReturner extends Thread {
         private final PooledTestObject returned;
-        public ConcurrentReturner(final PooledTestObject obj) {
+
+        private ConcurrentReturner(final PooledTestObject obj) {
             returned = obj;
         }
+
         @Override
         public void run() {
             try {
@@ -152,12 +155,12 @@ public class TestAbandonedObjectPool {
         private final long destroyLatency;
         private final long validateLatency;
 
-        public SimpleFactory() {
+        private SimpleFactory() {
             destroyLatency = 0;
             validateLatency = 0;
         }
 
-        public SimpleFactory(final long destroyLatency, final long validateLatency) {
+        private SimpleFactory(final long destroyLatency, final long validateLatency) {
             this.destroyLatency = destroyLatency;
             this.validateLatency = validateLatency;
         }
@@ -248,7 +251,7 @@ public class TestAbandonedObjectPool {
             msg.append('\n');
             mbs.unregisterMBean(name);
         }
-        assertEquals( 0, registeredPoolCount,msg.toString());
+        assertEquals(0, registeredPoolCount, msg.toString());
     }
 
     /**
diff --git a/src/test/java/org/apache/commons/pool3/impl/TestBaseGenericObjectPool.java b/src/test/java/org/apache/commons/pool3/impl/TestBaseGenericObjectPool.java
index 3208d8b0..d86fb24b 100644
--- a/src/test/java/org/apache/commons/pool3/impl/TestBaseGenericObjectPool.java
+++ b/src/test/java/org/apache/commons/pool3/impl/TestBaseGenericObjectPool.java
@@ -93,7 +93,7 @@ public class TestBaseGenericObjectPool {
     public void testEvictionTimerMultiplePools() throws InterruptedException {
         final AtomicIntegerFactory factory = new AtomicIntegerFactory();
         factory.setValidateLatency(50);
-        try (final GenericObjectPool<AtomicInteger, RuntimeException> evictingPool = new GenericObjectPool<>(factory)) {
+        try (GenericObjectPool<AtomicInteger, RuntimeException> evictingPool = new GenericObjectPool<>(factory)) {
             evictingPool.setDurationBetweenEvictionRuns(Duration.ofMillis(100));
             evictingPool.setNumTestsPerEvictionRun(5);
             evictingPool.setTestWhileIdle(true);
@@ -107,7 +107,7 @@ public class TestBaseGenericObjectPool {
             }
 
             for (int i = 0; i < 1000; i++) {
-                try (final GenericObjectPool<AtomicInteger, RuntimeException> nonEvictingPool = new GenericObjectPool<>(factory)) {
+                try (GenericObjectPool<AtomicInteger, RuntimeException> nonEvictingPool = new GenericObjectPool<>(factory)) {
                     // empty
                 }
             }
diff --git a/src/test/java/org/apache/commons/pool3/impl/TestDefaultPooledObject.java b/src/test/java/org/apache/commons/pool3/impl/TestDefaultPooledObject.java
index 64a37e96..5e44fc26 100644
--- a/src/test/java/org/apache/commons/pool3/impl/TestDefaultPooledObject.java
+++ b/src/test/java/org/apache/commons/pool3/impl/TestDefaultPooledObject.java
@@ -145,4 +145,4 @@ public class TestDefaultPooledObject {
         // We use <= instead of equal because "now" many be different when each argument is evaluated.
         assertTrue(dpo.getIdleDuration().compareTo(dpo.getActiveDuration()) <= 0);
     }
-}
\ No newline at end of file
+}
diff --git a/src/test/java/org/apache/commons/pool3/impl/TestDefaultPooledObjectInfo.java b/src/test/java/org/apache/commons/pool3/impl/TestDefaultPooledObjectInfo.java
index cf229f1f..728ae817 100644
--- a/src/test/java/org/apache/commons/pool3/impl/TestDefaultPooledObjectInfo.java
+++ b/src/test/java/org/apache/commons/pool3/impl/TestDefaultPooledObjectInfo.java
@@ -35,7 +35,7 @@ public class TestDefaultPooledObjectInfo {
         abandonedConfig.setRemoveAbandonedOnBorrow(true);
         abandonedConfig.setRemoveAbandonedTimeout(TestConstants.ONE_SECOND_DURATION);
         abandonedConfig.setLogAbandoned(true);
-        try (final GenericObjectPool<String, TestException> pool = new GenericObjectPool<>(new SimpleFactory(),
+        try (GenericObjectPool<String, TestException> pool = new GenericObjectPool<>(new SimpleFactory(),
                 new GenericObjectPoolConfig<>(), abandonedConfig)) {
 
             pool.borrowObject();
@@ -51,7 +51,7 @@ public class TestDefaultPooledObjectInfo {
 
     @Test
     public void testGetPooledObjectToString() throws Exception {
-        try (final GenericObjectPool<String, TestException> pool = new GenericObjectPool<>(new SimpleFactory())) {
+        try (GenericObjectPool<String, TestException> pool = new GenericObjectPool<>(new SimpleFactory())) {
 
             final String s1 = pool.borrowObject();
 
@@ -67,7 +67,7 @@ public class TestDefaultPooledObjectInfo {
 
     @Test
     public void testGetPooledObjectType() throws Exception {
-        try (final GenericObjectPool<String, TestException> pool = new GenericObjectPool<>(new SimpleFactory())) {
+        try (GenericObjectPool<String, TestException> pool = new GenericObjectPool<>(new SimpleFactory())) {
 
             pool.borrowObject();
 
@@ -83,7 +83,7 @@ public class TestDefaultPooledObjectInfo {
 
     @Test
     public void testTiming() throws Exception {
-        try (final GenericObjectPool<String, TestException> pool = new GenericObjectPool<>(new SimpleFactory())) {
+        try (GenericObjectPool<String, TestException> pool = new GenericObjectPool<>(new SimpleFactory())) {
 
             final long t1Millis = System.currentTimeMillis();
 
diff --git a/src/test/java/org/apache/commons/pool3/impl/TestEvictionTimer.java b/src/test/java/org/apache/commons/pool3/impl/TestEvictionTimer.java
index 38e91568..10e94c43 100644
--- a/src/test/java/org/apache/commons/pool3/impl/TestEvictionTimer.java
+++ b/src/test/java/org/apache/commons/pool3/impl/TestEvictionTimer.java
@@ -37,7 +37,7 @@ public class TestEvictionTimer {
     @Test
     public void testStartStopEvictionTimer() throws Exception {
 
-        try (final GenericObjectPool<String, RuntimeException> pool = new GenericObjectPool<>(new BasePooledObjectFactory<String, RuntimeException>() {
+        try (GenericObjectPool<String, RuntimeException> pool = new GenericObjectPool<>(new BasePooledObjectFactory<String, RuntimeException>() {
 
             @Override
             public String create() {
@@ -104,4 +104,4 @@ public class TestEvictionTimer {
             assertEquals(0, EvictionTimer.getNumTasks());
         }
     }
-}
\ No newline at end of file
+}
diff --git a/src/test/java/org/apache/commons/pool3/impl/TestGenericKeyedObjectPool.java b/src/test/java/org/apache/commons/pool3/impl/TestGenericKeyedObjectPool.java
index b1367cc3..b3350728 100644
--- a/src/test/java/org/apache/commons/pool3/impl/TestGenericKeyedObjectPool.java
+++ b/src/test/java/org/apache/commons/pool3/impl/TestGenericKeyedObjectPool.java
@@ -89,6 +89,7 @@ public class TestGenericKeyedObjectPool extends AbstractTestKeyedObjectPool {
         public Object create(final Object key) {
             return null;
         }
+
         @Override
         public PooledObject<Object> wrap(final Object value) {
             return new DefaultPooledObject<>(value);
@@ -96,16 +97,15 @@ public class TestGenericKeyedObjectPool extends AbstractTestKeyedObjectPool {
     }
 
     /**
-     * Factory that creates HashSets.  Note that this means
-     *  0) All instances are initially equal (not discernible by equals)
-     *  1) Instances are mutable and mutation can cause change in identity / hash code.
+     * Factory that creates HashSets. Note that this means 0) All instances are initially equal (not discernible by equals) 1) Instances are mutable and
+     * mutation can cause change in identity / hash code.
      */
-    private static final class HashSetFactory
-            extends BaseKeyedPooledObjectFactory<String, HashSet<String>, RuntimeException> {
+    private static final class HashSetFactory extends BaseKeyedPooledObjectFactory<String, HashSet<String>, RuntimeException> {
         @Override
         public HashSet<String> create(final String key) {
             return new HashSet<>();
         }
+
         @Override
         public PooledObject<HashSet<String>> wrap(final HashSet<String> value) {
             return new DefaultPooledObject<>(value);
@@ -115,14 +115,14 @@ public class TestGenericKeyedObjectPool extends AbstractTestKeyedObjectPool {
     /**
      * Attempts to invalidate an object, swallowing IllegalStateException.
      */
-    static class InvalidateThread implements Runnable {
+    private static class InvalidateThread implements Runnable {
 
         private final String obj;
         private final KeyedObjectPool<String, String, ? extends Exception> pool;
         private final String key;
         private boolean done;
 
-        public InvalidateThread(final KeyedObjectPool<String, String, ? extends Exception> pool, final String key, final String obj) {
+        private InvalidateThread(final KeyedObjectPool<String, String, ? extends Exception> pool, final String key, final String obj) {
             this.obj = obj;
             this.pool = pool;
             this.key = key;
@@ -146,8 +146,7 @@ public class TestGenericKeyedObjectPool extends AbstractTestKeyedObjectPool {
         }
     }
 
-    private static final class ObjectFactory
-        extends BaseKeyedPooledObjectFactory<Integer, Object, RuntimeException> {
+    private static final class ObjectFactory extends BaseKeyedPooledObjectFactory<Integer, Object, RuntimeException> {
 
         @Override
         public Object create(final Integer key) {
@@ -198,7 +197,7 @@ public class TestGenericKeyedObjectPool extends AbstractTestKeyedObjectPool {
         @Override
         public void destroyObject(final K key, final PooledObject<String> obj) throws TestException {
             doWait(destroyLatency);
-            synchronized(this) {
+            synchronized (this) {
                 activeCount--;
             }
             if (exceptionOnDestroy) {
@@ -217,11 +216,10 @@ public class TestGenericKeyedObjectPool extends AbstractTestKeyedObjectPool {
             }
             doWait(makeLatency);
             String out = null;
-            synchronized(this) {
+            synchronized (this) {
                 activeCount++;
                 if (activeCount > maxTotalPerKey) {
-                    throw new IllegalStateException(
-                        "Too many active instances: " + activeCount);
+                    throw new IllegalStateException("Too many active instances: " + activeCount);
                 }
                 out = String.valueOf(key) + String.valueOf(counter++);
             }
@@ -309,14 +307,16 @@ public class TestGenericKeyedObjectPool extends AbstractTestKeyedObjectPool {
     }
 
     /**
-     * Very simple test thread that just tries to borrow an object from
-     * the provided pool with the specified key and returns it
+     * Very simple test thread that just tries to borrow an object from the provided pool with the specified key and returns it.
+     *
+     * @param <T> Type of element pooled in the pool.
+     * @param <E> Type of exception thrown by the pool.
      */
-    static class SimpleTestThread<T, E extends Exception> implements Runnable {
+    private static class SimpleTestThread<T, E extends Exception> implements Runnable {
         private final KeyedObjectPool<String, T, E> pool;
         private final String key;
 
-        public SimpleTestThread(final KeyedObjectPool<String, T, E> pool, final String key) {
+        private SimpleTestThread(final KeyedObjectPool<String, T, E> pool, final String key) {
             this.pool = pool;
             this.key = key;
         }
@@ -333,6 +333,8 @@ public class TestGenericKeyedObjectPool extends AbstractTestKeyedObjectPool {
 
     /**
      * DefaultEvictionPolicy modified to add latency
+     *
+     * @param <T> the type of objects in the pool.
      */
     private static final class SlowEvictionPolicy<T> extends DefaultEvictionPolicy<T> {
         private final long delay;
@@ -342,19 +344,18 @@ public class TestGenericKeyedObjectPool extends AbstractTestKeyedObjectPool {
          *
          * @param delay number of ms of latency to inject in evict
          */
-        public SlowEvictionPolicy(final long delay) {
+        private SlowEvictionPolicy(final long delay) {
             this.delay = delay;
         }
 
         @Override
-        public boolean evict(final EvictionConfig config, final PooledObject<T> underTest,
-                final int idleCount) {
+        public boolean evict(final EvictionConfig config, final PooledObject<T> underTest, final int idleCount) {
             Waiter.sleepQuietly(delay);
             return super.evict(config, underTest, idleCount);
         }
     }
 
-    static class TestThread<T, E extends Exception> implements Runnable {
+    private static class TestThread<T, E extends Exception> implements Runnable {
         private final Random random = new Random();
 
         /** GKOP to hit */
@@ -376,20 +377,20 @@ public class TestGenericKeyedObjectPool extends AbstractTestKeyedObjectPool {
         private volatile boolean failed;
         private volatile Exception exception;
 
-        public TestThread(final KeyedObjectPool<String, T, E> pool) {
+        private TestThread(final KeyedObjectPool<String, T, E> pool) {
             this(pool, 100, 50, 50, true, null, null);
         }
 
-        public TestThread(final KeyedObjectPool<String, T, E> pool, final int iter) {
+        private TestThread(final KeyedObjectPool<String, T, E> pool, final int iter) {
             this(pool, iter, 50, 50, true, null, null);
         }
 
-        public TestThread(final KeyedObjectPool<String, T, E> pool, final int iter, final int delay) {
+        private TestThread(final KeyedObjectPool<String, T, E> pool, final int iter, final int delay) {
             this(pool, iter, delay, delay, true, null, null);
         }
 
-        public TestThread(final KeyedObjectPool<String, T, E> pool, final int iter, final int startDelay,
-            final int holdTime, final boolean randomDelay, final T expectedObject, final String key) {
+        private TestThread(final KeyedObjectPool<String, T, E> pool, final int iter, final int startDelay, final int holdTime, final boolean randomDelay,
+                final T expectedObject, final String key) {
             this.pool = pool;
             this.iter = iter;
             this.startDelay = startDelay;
@@ -445,8 +446,7 @@ public class TestGenericKeyedObjectPool extends AbstractTestKeyedObjectPool {
     }
 
     /*
-     * Very simple test thread that just tries to borrow an object from
-     * the provided pool with the specified key and returns it after a wait
+     * Very simple test thread that just tries to borrow an object from the provided pool with the specified key and returns it after a wait
      */
     static class WaitingTestThread<E extends Exception> extends Thread {
         private final KeyedObjectPool<String, String, E> pool;
@@ -455,12 +455,12 @@ public class TestGenericKeyedObjectPool extends AbstractTestKeyedObjectPool {
         private Throwable thrown;
 
         private long preBorrowMillis; // just before borrow
-        private long postBorrowMillis; //  borrow returned
+        private long postBorrowMillis; // borrow returned
         private long postReturnMillis; // after object was returned
         private long endedMillis;
         private String objectId;
 
-        public WaitingTestThread(final KeyedObjectPool<String, String, E> pool, final String key, final long pause) {
+        WaitingTestThread(final KeyedObjectPool<String, String, E> pool, final String key, final long pause) {
             this.pool = pool;
             this.key = key;
             this.pause = pause;
@@ -479,7 +479,7 @@ public class TestGenericKeyedObjectPool extends AbstractTestKeyedObjectPool {
                 postReturnMillis = System.currentTimeMillis();
             } catch (final Exception e) {
                 thrown = e;
-            } finally{
+            } finally {
                 endedMillis = System.currentTimeMillis();
             }
         }
@@ -491,8 +491,7 @@ public class TestGenericKeyedObjectPool extends AbstractTestKeyedObjectPool {
 
     private static final Integer KEY_TWO = Integer.valueOf(2);
 
-    private static final boolean DISPLAY_THREAD_DETAILS=
-    Boolean.getBoolean("TestGenericKeyedObjectPool.display.thread.details");
+    private static final boolean DISPLAY_THREAD_DETAILS = Boolean.getBoolean("TestGenericKeyedObjectPool.display.thread.details");
     // To pass this to a Maven test, use:
     // mvn test -DargLine="-DTestGenericKeyedObjectPool.display.thread.details=true"
     // @see https://issues.apache.org/jira/browse/SUREFIRE-121
@@ -505,7 +504,7 @@ public class TestGenericKeyedObjectPool extends AbstractTestKeyedObjectPool {
 
     private void checkEvictionOrder(final boolean lifo) throws InterruptedException, TestException {
         final SimpleFactory<Integer> intFactory = new SimpleFactory<>();
-        try (final GenericKeyedObjectPool<Integer, String, TestException> intPool = new GenericKeyedObjectPool<>(intFactory)) {
+        try (GenericKeyedObjectPool<Integer, String, TestException> intPool = new GenericKeyedObjectPool<>(intFactory)) {
             intPool.setNumTestsPerEvictionRun(2);
             intPool.setMinEvictableIdleDuration(Duration.ofMillis(100));
             intPool.setLifo(lifo);
@@ -523,8 +522,7 @@ public class TestGenericKeyedObjectPool extends AbstractTestKeyedObjectPool {
             /*
              * Initial state (Key, Object) pairs in order of age:
              *
-             * (0,0), (0,1), (0,2), (0,3), (0,4) (1,5), (1,6), (1,7), (1,8), (1,9) (2,10), (2,11), (2,12), (2,13),
-             * (2,14)
+             * (0,0), (0,1), (0,2), (0,3), (0,4) (1,5), (1,6), (1,7), (1,8), (1,9) (2,10), (2,11), (2,12), (2,13), (2,14)
              */
 
             intPool.evict(); // Kill (0,0),(0,1)
@@ -616,8 +614,7 @@ public class TestGenericKeyedObjectPool extends AbstractTestKeyedObjectPool {
 
     private void checkEvictorVisiting(final boolean lifo) throws Exception {
         VisitTrackerFactory<Integer> trackerFactory = new VisitTrackerFactory<>();
-        try (GenericKeyedObjectPool<Integer, VisitTracker<Integer>, RuntimeException> intPool = new GenericKeyedObjectPool<>(
-                trackerFactory)) {
+        try (GenericKeyedObjectPool<Integer, VisitTracker<Integer>, RuntimeException> intPool = new GenericKeyedObjectPool<>(trackerFactory)) {
             intPool.setNumTestsPerEvictionRun(2);
             intPool.setMinEvictableIdleDuration(Duration.ofMillis(-1));
             intPool.setTestWhileIdle(true);
@@ -643,10 +640,9 @@ public class TestGenericKeyedObjectPool extends AbstractTestKeyedObjectPool {
             for (int i = 0; i < 8; i++) {
                 final VisitTracker<Integer> tracker = intPool.borrowObject(KEY_ZERO);
                 if (tracker.getId() >= 4) {
-                    assertEquals( 0, tracker.getValidateCount(),"Unexpected instance visited " + tracker.getId());
+                    assertEquals(0, tracker.getValidateCount(), "Unexpected instance visited " + tracker.getId());
                 } else {
-                    assertEquals( 1,
-                            tracker.getValidateCount(),"Instance " + tracker.getId() + " visited wrong number of times.");
+                    assertEquals(1, tracker.getValidateCount(), "Instance " + tracker.getId() + " visited wrong number of times.");
                 }
             }
             // 0's are all out
@@ -681,11 +677,9 @@ public class TestGenericKeyedObjectPool extends AbstractTestKeyedObjectPool {
             for (int i = 0; i < 8; i++) {
                 final VisitTracker<Integer> tracker = intPool.borrowObject(KEY_ONE);
                 if (lifo && tracker.getId() > 1 || !lifo && tracker.getId() > 2) {
-                    assertEquals( 1,
-                            tracker.getValidateCount(),"Instance " + tracker.getId() + " visited wrong number of times.");
+                    assertEquals(1, tracker.getValidateCount(), "Instance " + tracker.getId() + " visited wrong number of times.");
                 } else {
-                    assertEquals( 2,
-                            tracker.getValidateCount(),"Instance " + tracker.getId() + " visited wrong number of times.");
+                    assertEquals(2, tracker.getValidateCount(), "Instance " + tracker.getId() + " visited wrong number of times.");
                 }
             }
         }
@@ -696,12 +690,11 @@ public class TestGenericKeyedObjectPool extends AbstractTestKeyedObjectPool {
         final Random random = new Random();
         random.setSeed(System.currentTimeMillis());
         for (int i = 0; i < smallPrimes.length; i++) {
-            for (int j = 0; j < 5; j++) {// Try the tests a few times
+            for (int j = 0; j < 5; j++) { // Try the tests a few times
                 // Can't use clear as some objects are still active so create
                 // a new pool
                 trackerFactory = new VisitTrackerFactory<>();
-                try (GenericKeyedObjectPool<Integer, VisitTracker<Integer>, RuntimeException> intPool = new GenericKeyedObjectPool<>(
-                        trackerFactory)) {
+                try (GenericKeyedObjectPool<Integer, VisitTracker<Integer>, RuntimeException> intPool = new GenericKeyedObjectPool<>(trackerFactory)) {
                     intPool.setMaxIdlePerKey(-1);
                     intPool.setMaxTotalPerKey(-1);
                     intPool.setNumTestsPerEvictionRun(smallPrimes[i]);
@@ -744,18 +737,16 @@ public class TestGenericKeyedObjectPool extends AbstractTestKeyedObjectPool {
                         tracker = intPool.borrowObject(KEY_ZERO);
                         visitCount = tracker.getValidateCount();
                         if (visitCount < cycleCount || visitCount > cycleCount + 1) {
-                            fail(formatSettings("ZERO", "runs", runs, "lifo", lifo, "i", i, "j", j, "k", k,
-                                    "visitCount", visitCount, "cycleCount", cycleCount, "totalInstances",
-                                    totalInstances, zeroLength, oneLength, twoLength));
+                            fail(formatSettings("ZERO", "runs", runs, "lifo", lifo, "i", i, "j", j, "k", k, "visitCount", visitCount, "cycleCount", cycleCount,
+                                    "totalInstances", totalInstances, zeroLength, oneLength, twoLength));
                         }
                     }
                     for (int k = 0; k < oneLength; k++) {
                         tracker = intPool.borrowObject(KEY_ONE);
                         visitCount = tracker.getValidateCount();
                         if (visitCount < cycleCount || visitCount > cycleCount + 1) {
-                            fail(formatSettings("ONE", "runs", runs, "lifo", lifo, "i", i, "j", j, "k", k, "visitCount",
-                                    visitCount, "cycleCount", cycleCount, "totalInstances", totalInstances, zeroLength,
-                                    oneLength, twoLength));
+                            fail(formatSettings("ONE", "runs", runs, "lifo", lifo, "i", i, "j", j, "k", k, "visitCount", visitCount, "cycleCount", cycleCount,
+                                    "totalInstances", totalInstances, zeroLength, oneLength, twoLength));
                         }
                     }
                     final int[] visits = new int[twoLength];
@@ -768,9 +759,8 @@ public class TestGenericKeyedObjectPool extends AbstractTestKeyedObjectPool {
                             for (int l = 0; l <= k; l++) {
                                 sb.append(visits[l]).append(' ');
                             }
-                            fail(formatSettings("TWO " + sb.toString(), "runs", runs, "lifo", lifo, "i", i, "j", j, "k",
-                                    k, "visitCount", visitCount, "cycleCount", cycleCount, "totalInstances",
-                                    totalInstances, zeroLength, oneLength, twoLength));
+                            fail(formatSettings("TWO " + sb.toString(), "runs", runs, "lifo", lifo, "i", i, "j", j, "k", k, "visitCount", visitCount,
+                                    "cycleCount", cycleCount, "totalInstances", totalInstances, zeroLength, oneLength, twoLength));
                         }
                     }
                 }
@@ -778,8 +768,9 @@ public class TestGenericKeyedObjectPool extends AbstractTestKeyedObjectPool {
         }
     }
 
-    private String formatSettings(final String title, final String s, final int i, final String s0, final boolean b0, final String s1, final int i1, final String s2, final int i2, final String s3, final int i3,
-            final String s4, final int i4, final String s5, final int i5, final String s6, final int i6, final int zeroLength, final int oneLength, final int twoLength){
+    private String formatSettings(final String title, final String s, final int i, final String s0, final boolean b0, final String s1, final int i1,
+            final String s2, final int i2, final String s3, final int i3, final String s4, final int i4, final String s5, final int i5, final String s6,
+            final int i6, final int zeroLength, final int oneLength, final int twoLength) {
         final StringBuilder sb = new StringBuilder(80);
         sb.append(title).append(' ');
         sb.append(s).append('=').append(i).append(' ');
@@ -830,15 +821,15 @@ public class TestGenericKeyedObjectPool extends AbstractTestKeyedObjectPool {
     }
 
     /**
-     * Kicks off {@code numThreads} test threads, each of which will go
-     * through {@code iterations} borrow-return cycles with random delay
-     * times &lt;= delay in between.
+     * Kicks off {@code numThreads} test threads, each of which will go through {@code iterations} borrow-return cycles with random delay times &lt;= delay in
+     * between.
      *
-     * @param <T>           Type of object in pool
-     * @param numThreads    Number of test threads
-     * @param iterations    Number of iterations for each thread
-     * @param delay         Maximum delay between iterations
-     * @param gkopPool      The keyed object pool to use
+     * @param <T>        Type of object in pool
+     * @param <E> Type of exception thrown in the pool.
+     * @param numThreads Number of test threads
+     * @param iterations Number of iterations for each thread
+     * @param delay      Maximum delay between iterations
+     * @param gkopPool   The keyed object pool to use
      */
     public <T, E extends Exception> void runTestThreads(final int numThreads, final int iterations, final int delay,
             final GenericKeyedObjectPool<String, T, E> gkopPool) {
@@ -876,9 +867,7 @@ public class TestGenericKeyedObjectPool extends AbstractTestKeyedObjectPool {
         simpleFactory = null;
 
         final MBeanServer mbs = ManagementFactory.getPlatformMBeanServer();
-        final Set<ObjectName> result = mbs.queryNames(new ObjectName(
-                "org.apache.commoms.pool3:type=GenericKeyedObjectPool,*"),
-                null);
+        final Set<ObjectName> result = mbs.queryNames(new ObjectName("org.apache.commoms.pool3:type=GenericKeyedObjectPool,*"), null);
         // There should be no registered pools at this point
         final int registeredPoolCount = result.size();
         final StringBuilder msg = new StringBuilder("Current pool is: ");
@@ -892,14 +881,14 @@ public class TestGenericKeyedObjectPool extends AbstractTestKeyedObjectPool {
             msg.append('\n');
             mbs.unregisterMBean(name);
         }
-        assertEquals( 0, registeredPoolCount, msg.toString());
+        assertEquals(0, registeredPoolCount, msg.toString());
     }
 
     @Test
     public void testAppendStats() {
         assertFalse(gkoPool.getMessageStatistics());
         assertEquals("foo", gkoPool.appendStats("foo"));
-        try (final GenericKeyedObjectPool<?, ?, TestException> pool = new GenericKeyedObjectPool<>(new SimpleFactory<>())) {
+        try (GenericKeyedObjectPool<?, ?, TestException> pool = new GenericKeyedObjectPool<>(new SimpleFactory<>())) {
             pool.setMessagesStatistics(true);
             assertNotEquals("foo", pool.appendStats("foo"));
             pool.setMessagesStatistics(false);
@@ -929,15 +918,13 @@ public class TestGenericKeyedObjectPool extends AbstractTestKeyedObjectPool {
         // If it passes it should be almost instant
         // Use 3000ms as the threshold - should avoid timing issues on most
         // (all? platforms)
-        assertTrue(endMillis - startMillis < 4000,
-                "Elapsed time: " + (endMillis - startMillis) + " should be less than 4000");
+        assertTrue(endMillis - startMillis < 4000, "Elapsed time: " + (endMillis - startMillis) + " should be less than 4000");
 
     }
 
     /*
-     * Note: This test relies on timing for correct execution. There *should* be
-     * enough margin for this to work correctly on most (all?) systems but be
-     * aware of this if you see a failure of this test.
+     * Note: This test relies on timing for correct execution. There *should* be enough margin for this to work correctly on most (all?) systems but be aware of
+     * this if you see a failure of this test.
      */
     @SuppressWarnings("rawtypes")
     @Test
@@ -988,8 +975,7 @@ public class TestGenericKeyedObjectPool extends AbstractTestKeyedObjectPool {
     }
 
     /**
-     * POOL-192
-     * Verify that clear(key) does not leak capacity.
+     * POOL-192 Verify that clear(key) does not leak capacity.
      *
      * @throws Exception May occur in some failure modes
      */
@@ -1027,7 +1013,7 @@ public class TestGenericKeyedObjectPool extends AbstractTestKeyedObjectPool {
     public void testClearOldest() throws Exception {
         // Make destroy have some latency so clearOldest takes some time
         final WaiterFactory<String> waiterFactory = new WaiterFactory<>(0, 20, 0, 0, 0, 0, 50, 5, 0);
-        try (final GenericKeyedObjectPool<String, Waiter, RuntimeException> waiterPool = new GenericKeyedObjectPool<>(waiterFactory)) {
+        try (GenericKeyedObjectPool<String, Waiter, RuntimeException> waiterPool = new GenericKeyedObjectPool<>(waiterFactory)) {
             waiterPool.setMaxTotalPerKey(5);
             waiterPool.setMaxTotal(50);
             waiterPool.setLifo(false);
@@ -1054,58 +1040,57 @@ public class TestGenericKeyedObjectPool extends AbstractTestKeyedObjectPool {
     }
 
     /**
-       * POOL-391 Verify that when clear(key) is called with reuseCapacity true,
-       * capacity freed is reused and allocated to most loaded pools.
-       *
-       * @throws Exception May occur in some failure modes
-       */
-      @Test
-      public void testClearReuseCapacity() throws Exception {
-          gkoPool.setMaxTotalPerKey(6);
-          gkoPool.setMaxTotal(6);
-          gkoPool.setMaxWait(Duration.ofSeconds(5));
-          // Create one thread to wait on "one", two on "two", three on "three"
-          final ArrayList<Thread> testThreads = new ArrayList<>();
-          testThreads.add(new Thread(new SimpleTestThread<>(gkoPool, "one")));
-          testThreads.add(new Thread(new SimpleTestThread<>(gkoPool, "two")));
-          testThreads.add(new Thread(new SimpleTestThread<>(gkoPool, "two")));
-          testThreads.add(new Thread(new SimpleTestThread<>(gkoPool, "three")));
-          testThreads.add(new Thread(new SimpleTestThread<>(gkoPool, "three")));
-          testThreads.add(new Thread(new SimpleTestThread<>(gkoPool, "three")));
-          // Borrow two each from "four", "five", "six" - using all capacity
-          final String four = gkoPool.borrowObject("four");
-          final String four2 = gkoPool.borrowObject("four");
-          final String five = gkoPool.borrowObject("five");
-          final String five2 = gkoPool.borrowObject("five");
-          final String six = gkoPool.borrowObject("six");
-          final String six2 = gkoPool.borrowObject("six");
-          Thread.sleep(100);
-          // Launch the waiters - all will be blocked waiting
-          for (final Thread t : testThreads) {
-              t.start();
-          }
-          Thread.sleep(100);
-          // Return and clear the fours - at least one "three" should get served
-          // Other should be a two or a three (three was most loaded)
-          gkoPool.returnObject("four", four);
-          gkoPool.returnObject("four", four2);
-          gkoPool.clear("four");
-          Thread.sleep(20);
-          assertTrue(!testThreads.get(3).isAlive() || !testThreads.get(4).isAlive() || !testThreads.get(5).isAlive());
-          // Now clear the fives
-          gkoPool.returnObject("five", five);
-          gkoPool.returnObject("five", five2);
-          gkoPool.clear("five");
-          Thread.sleep(20);
-          // Clear the sixes
-          gkoPool.returnObject("six", six);
-          gkoPool.returnObject("six", six2);
-          gkoPool.clear("six");
-          Thread.sleep(20);
-          for (final Thread t : testThreads) {
-              assertFalse(t.isAlive());
-          }
-      }
+     * POOL-391 Verify that when clear(key) is called with reuseCapacity true, capacity freed is reused and allocated to most loaded pools.
+     *
+     * @throws Exception May occur in some failure modes
+     */
+    @Test
+    public void testClearReuseCapacity() throws Exception {
+        gkoPool.setMaxTotalPerKey(6);
+        gkoPool.setMaxTotal(6);
+        gkoPool.setMaxWait(Duration.ofSeconds(5));
+        // Create one thread to wait on "one", two on "two", three on "three"
+        final ArrayList<Thread> testThreads = new ArrayList<>();
+        testThreads.add(new Thread(new SimpleTestThread<>(gkoPool, "one")));
+        testThreads.add(new Thread(new SimpleTestThread<>(gkoPool, "two")));
+        testThreads.add(new Thread(new SimpleTestThread<>(gkoPool, "two")));
+        testThreads.add(new Thread(new SimpleTestThread<>(gkoPool, "three")));
+        testThreads.add(new Thread(new SimpleTestThread<>(gkoPool, "three")));
+        testThreads.add(new Thread(new SimpleTestThread<>(gkoPool, "three")));
+        // Borrow two each from "four", "five", "six" - using all capacity
+        final String four = gkoPool.borrowObject("four");
+        final String four2 = gkoPool.borrowObject("four");
+        final String five = gkoPool.borrowObject("five");
+        final String five2 = gkoPool.borrowObject("five");
+        final String six = gkoPool.borrowObject("six");
+        final String six2 = gkoPool.borrowObject("six");
+        Thread.sleep(100);
+        // Launch the waiters - all will be blocked waiting
+        for (final Thread t : testThreads) {
+            t.start();
+        }
+        Thread.sleep(100);
+        // Return and clear the fours - at least one "three" should get served
+        // Other should be a two or a three (three was most loaded)
+        gkoPool.returnObject("four", four);
+        gkoPool.returnObject("four", four2);
+        gkoPool.clear("four");
+        Thread.sleep(20);
+        assertTrue(!testThreads.get(3).isAlive() || !testThreads.get(4).isAlive() || !testThreads.get(5).isAlive());
+        // Now clear the fives
+        gkoPool.returnObject("five", five);
+        gkoPool.returnObject("five", five2);
+        gkoPool.clear("five");
+        Thread.sleep(20);
+        // Clear the sixes
+        gkoPool.returnObject("six", six);
+        gkoPool.returnObject("six", six2);
+        gkoPool.clear("six");
+        Thread.sleep(20);
+        for (final Thread t : testThreads) {
+            assertFalse(t.isAlive());
+        }
+    }
 
     /**
      * POOL-391 Adapted from code in the JIRA ticket.
@@ -1125,8 +1110,7 @@ public class TestGenericKeyedObjectPool extends AbstractTestKeyedObjectPool {
                     }
 
                     @Override
-                    public void destroyObject(final Integer key, final PooledObject<Integer> p)
-                            throws InterruptedException {
+                    public void destroyObject(final Integer key, final PooledObject<Integer> p) throws InterruptedException {
                         Thread.sleep(10);
                     }
 
@@ -1182,8 +1166,7 @@ public class TestGenericKeyedObjectPool extends AbstractTestKeyedObjectPool {
         final SimpleFactory<String> factory = new SimpleFactory<>();
         // Give makeObject a little latency
         factory.setMakeLatency(200);
-        try (final GenericKeyedObjectPool<String, String, TestException> pool = new GenericKeyedObjectPool<>(factory,
-                new GenericKeyedObjectPoolConfig<>())) {
+        try (GenericKeyedObjectPool<String, String, TestException> pool = new GenericKeyedObjectPool<>(factory, new GenericKeyedObjectPoolConfig<>())) {
             final String s = pool.borrowObject("one");
             // First borrow waits on create, so wait time should be at least 200 ms
             // Allow 100ms error in clock times
@@ -1215,7 +1198,7 @@ public class TestGenericKeyedObjectPool extends AbstractTestKeyedObjectPool {
         testConcurrentBorrowAndClear(threadCount, taskCount, addCount, borrowCycles, clearCycles, useYield);
     }
 
-    /**
+    /*
      * Tests POOL-411, or least tries to reproduce the NPE, but does not.
      *
      * @throws TestException a test failure.
@@ -1278,7 +1261,8 @@ public class TestGenericKeyedObjectPool extends AbstractTestKeyedObjectPool {
     }
 
     /**
-     * See https://issues.apache.org/jira/browse/POOL-411?focusedCommentId=17741156&page=com.atlassian.jira.plugin.system.issuetabpanels%3Acomment-tabpanel#comment-17741156
+     * See https://issues.apache.org/jira/browse/POOL-411?
+     * focusedCommentId=17741156&page=com.atlassian.jira.plugin.system.issuetabpanels%3Acomment-tabpanel#comment-17741156
      *
      * @throws TestException a test failure.
      */
@@ -1295,8 +1279,7 @@ public class TestGenericKeyedObjectPool extends AbstractTestKeyedObjectPool {
     }
 
     /**
-     * POOL-231 - verify that concurrent invalidates of the same object do not
-     * corrupt pool destroyCount.
+     * POOL-231 - verify that concurrent invalidates of the same object do not corrupt pool destroyCount.
      *
      * @throws Exception May occur in some failure modes
      */
@@ -1308,7 +1291,7 @@ public class TestGenericKeyedObjectPool extends AbstractTestKeyedObjectPool {
         gkoPool.setMaxTotal(nObjects);
         gkoPool.setMaxTotalPerKey(nObjects);
         gkoPool.setMaxIdlePerKey(nObjects);
-        final String [] obj = new String[nObjects];
+        final String[] obj = new String[nObjects];
         for (int i = 0; i < nObjects; i++) {
             obj[i] = gkoPool.borrowObject(key);
         }
@@ -1352,8 +1335,7 @@ public class TestGenericKeyedObjectPool extends AbstractTestKeyedObjectPool {
     @Test
     public void testConstructorNullFactory() {
         // add dummy assert (won't be invoked because of IAE) to avoid "unused" warning
-        assertThrows(IllegalArgumentException.class,
-                () -> new GenericKeyedObjectPool<>(null));
+        assertThrows(IllegalArgumentException.class, () -> new GenericKeyedObjectPool<>(null));
     }
 
     @SuppressWarnings("deprecation")
@@ -1430,8 +1412,7 @@ public class TestGenericKeyedObjectPool extends AbstractTestKeyedObjectPool {
     }
 
     /**
-     * JIRA: POOL-270 - make sure constructor correctly sets run
-     * frequency of evictor timer.
+     * JIRA: POOL-270 - make sure constructor correctly sets run frequency of evictor timer.
      */
     @Test
     public void testContructorEvictionConfig() throws TestException {
@@ -1439,7 +1420,7 @@ public class TestGenericKeyedObjectPool extends AbstractTestKeyedObjectPool {
         config.setDurationBetweenEvictionRuns(Duration.ofMillis(500));
         config.setMinEvictableIdleDuration(Duration.ofMillis(50));
         config.setNumTestsPerEvictionRun(5);
-        try (final GenericKeyedObjectPool<String, String, TestException> p = new GenericKeyedObjectPool<>(simpleFactory, config)) {
+        try (GenericKeyedObjectPool<String, String, TestException> p = new GenericKeyedObjectPool<>(simpleFactory, config)) {
             for (int i = 0; i < 5; i++) {
                 p.addObject("one");
             }
@@ -1451,15 +1432,14 @@ public class TestGenericKeyedObjectPool extends AbstractTestKeyedObjectPool {
     }
 
     /**
-     * Verifies that when a factory's makeObject produces instances that are not
-     * discernible by equals, the pool can handle them.
+     * Verifies that when a factory's makeObject produces instances that are not discernible by equals, the pool can handle them.
      *
      * JIRA: POOL-283
      */
     @Test
     public void testEqualsIndiscernible() throws Exception {
         final HashSetFactory factory = new HashSetFactory();
-        try (final GenericKeyedObjectPool<String, HashSet<String>, RuntimeException> pool = new GenericKeyedObjectPool<>(factory,
+        try (GenericKeyedObjectPool<String, HashSet<String>, RuntimeException> pool = new GenericKeyedObjectPool<>(factory,
                 new GenericKeyedObjectPoolConfig<>())) {
             final HashSet<String> s1 = pool.borrowObject("a");
             final HashSet<String> s2 = pool.borrowObject("a");
@@ -1478,11 +1458,11 @@ public class TestGenericKeyedObjectPool extends AbstractTestKeyedObjectPool {
         gkoPool.setDurationBetweenEvictionRuns(Duration.ofMillis(500));
 
         final String[] active = new String[500];
-        for(int i=0;i<500;i++) {
+        for (int i = 0; i < 500; i++) {
             active[i] = gkoPool.borrowObject("");
         }
-        for(int i=0;i<500;i++) {
-            gkoPool.returnObject("",active[i]);
+        for (int i = 0; i < 500; i++) {
+            gkoPool.returnObject("", active[i]);
         }
 
         Waiter.sleepQuietly(1000L);
@@ -1490,33 +1470,33 @@ public class TestGenericKeyedObjectPool extends AbstractTestKeyedObjectPool {
         Waiter.sleepQuietly(600L);
         assertTrue(gkoPool.getNumIdle("") < 400, "Should be less than 400 idle, found " + gkoPool.getNumIdle(""));
         Waiter.sleepQuietly(600L);
-        assertTrue(gkoPool.getNumIdle("") < 300,"Should be less than 300 idle, found " + gkoPool.getNumIdle(""));
+        assertTrue(gkoPool.getNumIdle("") < 300, "Should be less than 300 idle, found " + gkoPool.getNumIdle(""));
         Waiter.sleepQuietly(600L);
         assertTrue(gkoPool.getNumIdle("") < 200, "Should be less than 200 idle, found " + gkoPool.getNumIdle(""));
         Waiter.sleepQuietly(600L);
-        assertTrue(gkoPool.getNumIdle("") < 100 , "Should be less than 100 idle, found " + gkoPool.getNumIdle(""));
+        assertTrue(gkoPool.getNumIdle("") < 100, "Should be less than 100 idle, found " + gkoPool.getNumIdle(""));
         Waiter.sleepQuietly(600L);
-        assertEquals(0,gkoPool.getNumIdle(""),"Should be zero idle, found " + gkoPool.getNumIdle(""));
+        assertEquals(0, gkoPool.getNumIdle(""), "Should be zero idle, found " + gkoPool.getNumIdle(""));
 
-        for(int i=0;i<500;i++) {
+        for (int i = 0; i < 500; i++) {
             active[i] = gkoPool.borrowObject("");
         }
-        for(int i=0;i<500;i++) {
-            gkoPool.returnObject("",active[i]);
+        for (int i = 0; i < 500; i++) {
+            gkoPool.returnObject("", active[i]);
         }
 
         Waiter.sleepQuietly(1000L);
-        assertTrue(gkoPool.getNumIdle("") < 500,"Should be less than 500 idle, found " + gkoPool.getNumIdle(""));
+        assertTrue(gkoPool.getNumIdle("") < 500, "Should be less than 500 idle, found " + gkoPool.getNumIdle(""));
         Waiter.sleepQuietly(600L);
-        assertTrue(gkoPool.getNumIdle("") < 400,"Should be less than 400 idle, found " + gkoPool.getNumIdle(""));
+        assertTrue(gkoPool.getNumIdle("") < 400, "Should be less than 400 idle, found " + gkoPool.getNumIdle(""));
         Waiter.sleepQuietly(600L);
-        assertTrue(gkoPool.getNumIdle("") < 300,"Should be less than 300 idle, found " + gkoPool.getNumIdle(""));
+        assertTrue(gkoPool.getNumIdle("") < 300, "Should be less than 300 idle, found " + gkoPool.getNumIdle(""));
         Waiter.sleepQuietly(600L);
-        assertTrue(gkoPool.getNumIdle("") < 200,"Should be less than 200 idle, found " + gkoPool.getNumIdle(""));
+        assertTrue(gkoPool.getNumIdle("") < 200, "Should be less than 200 idle, found " + gkoPool.getNumIdle(""));
         Waiter.sleepQuietly(600L);
-        assertTrue(gkoPool.getNumIdle("") < 100,"Should be less than 100 idle, found " + gkoPool.getNumIdle(""));
+        assertTrue(gkoPool.getNumIdle("") < 100, "Should be less than 100 idle, found " + gkoPool.getNumIdle(""));
         Waiter.sleepQuietly(600L);
-        assertEquals(0,gkoPool.getNumIdle(""),"Should be zero idle, found " + gkoPool.getNumIdle(""));
+        assertEquals(0, gkoPool.getNumIdle(""), "Should be zero idle, found " + gkoPool.getNumIdle(""));
     }
 
     @Test
@@ -1565,8 +1545,7 @@ public class TestGenericKeyedObjectPool extends AbstractTestKeyedObjectPool {
     }
 
     /**
-     * Test to make sure evictor visits least recently used objects first,
-     * regardless of FIFO/LIFO
+     * Test to make sure evictor visits least recently used objects first, regardless of FIFO/LIFO
      *
      * JIRA: POOL-86
      *
@@ -1613,8 +1592,7 @@ public class TestGenericKeyedObjectPool extends AbstractTestKeyedObjectPool {
     }
 
     /**
-     * Verifies that the evictor visits objects in expected order
-     * and frequency.
+     * Verifies that the evictor visits objects in expected order and frequency.
      *
      * @throws Exception May occur in some failure modes
      */
@@ -1706,7 +1684,7 @@ public class TestGenericKeyedObjectPool extends AbstractTestKeyedObjectPool {
         final String obj = gkoPool.borrowObject("one");
         simpleFactory.setThrowExceptionOnPassivate(true);
         gkoPool.returnObject("one", obj);
-        assertEquals(0,gkoPool.getNumIdle());
+        assertEquals(0, gkoPool.getNumIdle());
         gkoPool.close();
     }
 
@@ -1718,14 +1696,14 @@ public class TestGenericKeyedObjectPool extends AbstractTestKeyedObjectPool {
         gkoPool.addObject(key); // "key0"
         gkoPool.addObject(key); // "key1"
         gkoPool.addObject(key); // "key2"
-        assertEquals( "key0", gkoPool.borrowObject(key),"Oldest");
-        assertEquals( "key1", gkoPool.borrowObject(key),"Middle");
-        assertEquals( "key2", gkoPool.borrowObject(key),"Youngest");
+        assertEquals("key0", gkoPool.borrowObject(key), "Oldest");
+        assertEquals("key1", gkoPool.borrowObject(key), "Middle");
+        assertEquals("key2", gkoPool.borrowObject(key), "Youngest");
         final String s = gkoPool.borrowObject(key);
-        assertEquals( "key3", s,"new-3");
+        assertEquals("key3", s, "new-3");
         gkoPool.returnObject(key, s);
-        assertEquals( s, gkoPool.borrowObject(key),"returned");
-        assertEquals( "key4", gkoPool.borrowObject(key),"new-4");
+        assertEquals(s, gkoPool.borrowObject(key), "returned");
+        assertEquals("key4", gkoPool.borrowObject(key), "new-4");
     }
 
     @Test
@@ -1757,7 +1735,7 @@ public class TestGenericKeyedObjectPool extends AbstractTestKeyedObjectPool {
     @Test
     public void testInvalidateFreesCapacity() throws TestException, InterruptedException {
         final SimpleFactory<String> factory = new SimpleFactory<>();
-        try (final GenericKeyedObjectPool<String, String, TestException> pool = new GenericKeyedObjectPool<>(factory)) {
+        try (GenericKeyedObjectPool<String, String, TestException> pool = new GenericKeyedObjectPool<>(factory)) {
             pool.setMaxTotalPerKey(2);
             pool.setMaxWait(Duration.ofMillis(500));
             // Borrow an instance and hold if for 5 seconds
@@ -1784,10 +1762,10 @@ public class TestGenericKeyedObjectPool extends AbstractTestKeyedObjectPool {
         gkoPool.setMaxWait(Duration.ofMillis(500));
         final Thread borrower = new Thread(new SimpleTestThread<>(gkoPool, "two"));
         final String obj = gkoPool.borrowObject("one");
-        borrower.start();  // Will block
-        Thread.sleep(100);  // Make sure borrower has started
-        gkoPool.invalidateObject("one", obj);  // Should free capacity to serve the other key
-        Thread.sleep(20);  // Should have been served by now
+        borrower.start(); // Will block
+        Thread.sleep(100); // Make sure borrower has started
+        gkoPool.invalidateObject("one", obj); // Should free capacity to serve the other key
+        Thread.sleep(20); // Should have been served by now
         assertFalse(borrower.isAlive());
     }
 
@@ -1811,9 +1789,7 @@ public class TestGenericKeyedObjectPool extends AbstractTestKeyedObjectPool {
      * @throws Exception May occur in some failure modes
      */
     @Test
-    public void testInvalidateWaiting()
-            throws Exception {
-
+    public void testInvalidateWaiting() throws Exception {
         final GenericKeyedObjectPoolConfig<Object> config = new GenericKeyedObjectPoolConfig<>();
         config.setMaxTotal(2);
         config.setBlockWhenExhausted(true);
@@ -1825,7 +1801,7 @@ public class TestGenericKeyedObjectPool extends AbstractTestKeyedObjectPool {
         config.setTestWhileIdle(true);
         config.setDurationBetweenEvictionRuns(Duration.ofMillis(-1));
 
-        try (final GenericKeyedObjectPool<Integer, Object, RuntimeException> pool = new GenericKeyedObjectPool<>(new ObjectFactory(), config)) {
+        try (GenericKeyedObjectPool<Integer, Object, RuntimeException> pool = new GenericKeyedObjectPool<>(new ObjectFactory(), config)) {
 
             // Allocate both objects with this thread
             pool.borrowObject(Integer.valueOf(1)); // object1
@@ -1857,7 +1833,7 @@ public class TestGenericKeyedObjectPool extends AbstractTestKeyedObjectPool {
 
             pool.invalidateObject(Integer.valueOf(1), object2);
 
-            assertTrue(signal.tryAcquire(2, TimeUnit.SECONDS),"Call to invalidateObject did not unblock pool waiters.");
+            assertTrue(signal.tryAcquire(2, TimeUnit.SECONDS), "Call to invalidateObject did not unblock pool waiters.");
 
             if (result.get() != null) {
                 throw new AssertionError(result.get());
@@ -1885,14 +1861,14 @@ public class TestGenericKeyedObjectPool extends AbstractTestKeyedObjectPool {
         gkoPool.addObject(key); // "key0"
         gkoPool.addObject(key); // "key1"
         gkoPool.addObject(key); // "key2"
-        assertEquals( "key2", gkoPool.borrowObject(key),"Youngest");
-        assertEquals( "key1", gkoPool.borrowObject(key),"Middle");
-        assertEquals( "key0", gkoPool.borrowObject(key),"Oldest");
+        assertEquals("key2", gkoPool.borrowObject(key), "Youngest");
+        assertEquals("key1", gkoPool.borrowObject(key), "Middle");
+        assertEquals("key0", gkoPool.borrowObject(key), "Oldest");
         final String s = gkoPool.borrowObject(key);
-        assertEquals( "key3", s,"new-3");
+        assertEquals("key3", s, "new-3");
         gkoPool.returnObject(key, s);
-        assertEquals( s, gkoPool.borrowObject(key),"returned");
-        assertEquals( "key4", gkoPool.borrowObject(key),"new-4");
+        assertEquals(s, gkoPool.borrowObject(key), "returned");
+        assertEquals("key4", gkoPool.borrowObject(key), "new-4");
     }
 
     /**
@@ -1932,7 +1908,7 @@ public class TestGenericKeyedObjectPool extends AbstractTestKeyedObjectPool {
     @Test
     public void testMakeObjectException() throws Exception {
         final SimpleFactory<String> factory = new SimpleFactory<>();
-        try (final GenericKeyedObjectPool<String, String, TestException> pool = new GenericKeyedObjectPool<>(factory)) {
+        try (GenericKeyedObjectPool<String, String, TestException> pool = new GenericKeyedObjectPool<>(factory)) {
             pool.setMaxTotalPerKey(1);
             pool.setBlockWhenExhausted(false);
             factory.exceptionOnCreate = true;
@@ -1951,7 +1927,7 @@ public class TestGenericKeyedObjectPool extends AbstractTestKeyedObjectPool {
         final WaiterFactory<String> waiterFactory = new WaiterFactory<>(0, 20, 0, 0, 0, 0, 8, 5, 0);
         // TODO Fix this. Can't use local pool since runTestThreads uses the
         // protected pool field
-        try (final GenericKeyedObjectPool<String, Waiter, RuntimeException> waiterPool = new GenericKeyedObjectPool<>(waiterFactory)) {
+        try (GenericKeyedObjectPool<String, Waiter, RuntimeException> waiterPool = new GenericKeyedObjectPool<>(waiterFactory)) {
             waiterPool.setMaxTotalPerKey(5);
             waiterPool.setMaxTotal(8);
             waiterPool.setTestOnBorrow(true);
@@ -1967,26 +1943,26 @@ public class TestGenericKeyedObjectPool extends AbstractTestKeyedObjectPool {
         gkoPool.setMaxTotalPerKey(100);
         gkoPool.setMaxIdlePerKey(8);
         final String[] active = new String[100];
-        for(int i=0;i<100;i++) {
+        for (int i = 0; i < 100; i++) {
             active[i] = gkoPool.borrowObject("");
         }
-        assertEquals(100,gkoPool.getNumActive(""));
-        assertEquals(0,gkoPool.getNumIdle(""));
-        for(int i=0;i<100;i++) {
-            gkoPool.returnObject("",active[i]);
-            assertEquals(99 - i,gkoPool.getNumActive(""));
-            assertEquals(i < 8 ? i+1 : 8,gkoPool.getNumIdle(""));
+        assertEquals(100, gkoPool.getNumActive(""));
+        assertEquals(0, gkoPool.getNumIdle(""));
+        for (int i = 0; i < 100; i++) {
+            gkoPool.returnObject("", active[i]);
+            assertEquals(99 - i, gkoPool.getNumActive(""));
+            assertEquals(i < 8 ? i + 1 : 8, gkoPool.getNumIdle(""));
         }
 
-        for(int i=0;i<100;i++) {
+        for (int i = 0; i < 100; i++) {
             active[i] = gkoPool.borrowObject("a");
         }
-        assertEquals(100,gkoPool.getNumActive("a"));
-        assertEquals(0,gkoPool.getNumIdle("a"));
-        for(int i=0;i<100;i++) {
-            gkoPool.returnObject("a",active[i]);
-            assertEquals(99 - i,gkoPool.getNumActive("a"));
-            assertEquals(i < 8 ? i+1 : 8,gkoPool.getNumIdle("a"));
+        assertEquals(100, gkoPool.getNumActive("a"));
+        assertEquals(0, gkoPool.getNumIdle("a"));
+        for (int i = 0; i < 100; i++) {
+            gkoPool.returnObject("a", active[i]);
+            assertEquals(99 - i, gkoPool.getNumActive("a"));
+            assertEquals(i < 8 ? i + 1 : 8, gkoPool.getNumIdle("a"));
         }
 
         // total number of idle instances is twice maxIdle
@@ -2207,11 +2183,11 @@ public class TestGenericKeyedObjectPool extends AbstractTestKeyedObjectPool {
         int failed = 0;
         for (final WaitingTestThread<TestException> element : wtt) {
             element.join();
-            if (element.thrown != null){
+            if (element.thrown != null) {
                 failed++;
             }
         }
-        if (DISPLAY_THREAD_DETAILS || wtt.length/2 != failed){
+        if (DISPLAY_THREAD_DETAILS || wtt.length / 2 != failed) {
             System.out.println(
                     "MaxWait: " + maxWait +
                     " HoldTime: " + holdTime +
@@ -2232,7 +2208,7 @@ public class TestGenericKeyedObjectPool extends AbstractTestKeyedObjectPool {
                         );
             }
         }
-        assertEquals(wtt.length/2,failed,"Expected half the threads to fail");
+        assertEquals(wtt.length / 2, failed, "Expected half the threads to fail");
     }
 
     @Test
@@ -2289,8 +2265,7 @@ public class TestGenericKeyedObjectPool extends AbstractTestKeyedObjectPool {
         final String key = "A";
 
         gkoPool.preparePool(key);
-        assertEquals(5, gkoPool.getNumIdle(), "Should be 5 idle, found " +
-                gkoPool.getNumIdle());
+        assertEquals(5, gkoPool.getNumIdle(), "Should be 5 idle, found " + gkoPool.getNumIdle());
 
         Waiter.sleepQuietly(150L);
         assertEquals(5, gkoPool.getNumIdle(), "Should be 5 idle, found " + gkoPool.getNumIdle());
@@ -2300,28 +2275,28 @@ public class TestGenericKeyedObjectPool extends AbstractTestKeyedObjectPool {
         Waiter.sleepQuietly(150L);
         assertEquals(5, gkoPool.getNumIdle(), "Should be 5 idle, found " + gkoPool.getNumIdle());
 
-        for(int i=0 ; i<5 ; i++) {
+        for (int i = 0; i < 5; i++) {
             active[i] = gkoPool.borrowObject(key);
         }
 
         Waiter.sleepQuietly(150L);
         assertEquals(5, gkoPool.getNumIdle(), "Should be 5 idle, found " + gkoPool.getNumIdle());
 
-        for(int i=0 ; i<5 ; i++) {
+        for (int i = 0; i < 5; i++) {
             gkoPool.returnObject(key, active[i]);
         }
 
         Waiter.sleepQuietly(150L);
         assertEquals(10, gkoPool.getNumIdle(), "Should be 10 idle, found " + gkoPool.getNumIdle());
 
-        for(int i=0 ; i<10 ; i++) {
+        for (int i = 0; i < 10; i++) {
             active[i] = gkoPool.borrowObject(key);
         }
 
         Waiter.sleepQuietly(150L);
         assertEquals(0, gkoPool.getNumIdle(), "Should be 0 idle, found " + gkoPool.getNumIdle());
 
-        for(int i=0 ; i<10 ; i++) {
+        for (int i = 0; i < 10; i++) {
             gkoPool.returnObject(key, active[i]);
         }
 
@@ -2362,7 +2337,7 @@ public class TestGenericKeyedObjectPool extends AbstractTestKeyedObjectPool {
     @Test
     public void testMultipleReturn() throws Exception {
         final WaiterFactory<String> factory = new WaiterFactory<>(0, 0, 0, 0, 0, 0);
-        try (final GenericKeyedObjectPool<String, Waiter, RuntimeException> pool = new GenericKeyedObjectPool<>(factory)) {
+        try (GenericKeyedObjectPool<String, Waiter, RuntimeException> pool = new GenericKeyedObjectPool<>(factory)) {
             pool.setTestOnReturn(true);
             final Waiter waiter = pool.borrowObject("a");
             pool.returnObject("a", waiter);
@@ -2388,7 +2363,7 @@ public class TestGenericKeyedObjectPool extends AbstractTestKeyedObjectPool {
     @Test
     public void testMutable() throws Exception {
         final HashSetFactory factory = new HashSetFactory();
-        try (final GenericKeyedObjectPool<String, HashSet<String>, RuntimeException> pool = new GenericKeyedObjectPool<>(factory,
+        try (GenericKeyedObjectPool<String, HashSet<String>, RuntimeException> pool = new GenericKeyedObjectPool<>(factory,
                 new GenericKeyedObjectPoolConfig<>())) {
             final HashSet<String> s1 = pool.borrowObject("a");
             final HashSet<String> s2 = pool.borrowObject("a");
@@ -2405,8 +2380,8 @@ public class TestGenericKeyedObjectPool extends AbstractTestKeyedObjectPool {
         gkoPool.setMaxTotalPerKey(-1);
         gkoPool.setBlockWhenExhausted(false);
         final String obj = gkoPool.borrowObject("");
-        assertEquals("0",obj);
-        gkoPool.returnObject("",obj);
+        assertEquals("0", obj);
+        gkoPool.returnObject("", obj);
     }
 
     /**
@@ -2422,7 +2397,7 @@ public class TestGenericKeyedObjectPool extends AbstractTestKeyedObjectPool {
             DisconnectingWaiterFactory.DEFAULT_DISCONNECTED_VALIDATION_ACTION
         );
         // @formatter:on
-        try (final GenericKeyedObjectPool<String, Waiter, RuntimeException> pool = new GenericKeyedObjectPool<>(factory)) {
+        try (GenericKeyedObjectPool<String, Waiter, RuntimeException> pool = new GenericKeyedObjectPool<>(factory)) {
             final String key = "one";
             pool.setTestOnBorrow(true);
             pool.setMaxTotal(-1);
@@ -2438,57 +2413,57 @@ public class TestGenericKeyedObjectPool extends AbstractTestKeyedObjectPool {
     @Test
     @Timeout(value = 60_000, unit = TimeUnit.MILLISECONDS)
     public void testNumActiveNumIdle2() throws Exception {
-        assertEquals(0,gkoPool.getNumActive());
-        assertEquals(0,gkoPool.getNumIdle());
-        assertEquals(0,gkoPool.getNumActive("A"));
-        assertEquals(0,gkoPool.getNumIdle("A"));
-        assertEquals(0,gkoPool.getNumActive("B"));
-        assertEquals(0,gkoPool.getNumIdle("B"));
+        assertEquals(0, gkoPool.getNumActive());
+        assertEquals(0, gkoPool.getNumIdle());
+        assertEquals(0, gkoPool.getNumActive("A"));
+        assertEquals(0, gkoPool.getNumIdle("A"));
+        assertEquals(0, gkoPool.getNumActive("B"));
+        assertEquals(0, gkoPool.getNumIdle("B"));
 
         final String objA0 = gkoPool.borrowObject("A");
         final String objB0 = gkoPool.borrowObject("B");
 
-        assertEquals(2,gkoPool.getNumActive());
-        assertEquals(0,gkoPool.getNumIdle());
-        assertEquals(1,gkoPool.getNumActive("A"));
-        assertEquals(0,gkoPool.getNumIdle("A"));
-        assertEquals(1,gkoPool.getNumActive("B"));
-        assertEquals(0,gkoPool.getNumIdle("B"));
+        assertEquals(2, gkoPool.getNumActive());
+        assertEquals(0, gkoPool.getNumIdle());
+        assertEquals(1, gkoPool.getNumActive("A"));
+        assertEquals(0, gkoPool.getNumIdle("A"));
+        assertEquals(1, gkoPool.getNumActive("B"));
+        assertEquals(0, gkoPool.getNumIdle("B"));
 
         final String objA1 = gkoPool.borrowObject("A");
         final String objB1 = gkoPool.borrowObject("B");
 
-        assertEquals(4,gkoPool.getNumActive());
-        assertEquals(0,gkoPool.getNumIdle());
-        assertEquals(2,gkoPool.getNumActive("A"));
-        assertEquals(0,gkoPool.getNumIdle("A"));
-        assertEquals(2,gkoPool.getNumActive("B"));
-        assertEquals(0,gkoPool.getNumIdle("B"));
+        assertEquals(4, gkoPool.getNumActive());
+        assertEquals(0, gkoPool.getNumIdle());
+        assertEquals(2, gkoPool.getNumActive("A"));
+        assertEquals(0, gkoPool.getNumIdle("A"));
+        assertEquals(2, gkoPool.getNumActive("B"));
+        assertEquals(0, gkoPool.getNumIdle("B"));
 
-        gkoPool.returnObject("A",objA0);
-        gkoPool.returnObject("B",objB0);
+        gkoPool.returnObject("A", objA0);
+        gkoPool.returnObject("B", objB0);
 
-        assertEquals(2,gkoPool.getNumActive());
-        assertEquals(2,gkoPool.getNumIdle());
-        assertEquals(1,gkoPool.getNumActive("A"));
-        assertEquals(1,gkoPool.getNumIdle("A"));
-        assertEquals(1,gkoPool.getNumActive("B"));
-        assertEquals(1,gkoPool.getNumIdle("B"));
+        assertEquals(2, gkoPool.getNumActive());
+        assertEquals(2, gkoPool.getNumIdle());
+        assertEquals(1, gkoPool.getNumActive("A"));
+        assertEquals(1, gkoPool.getNumIdle("A"));
+        assertEquals(1, gkoPool.getNumActive("B"));
+        assertEquals(1, gkoPool.getNumIdle("B"));
 
-        gkoPool.returnObject("A",objA1);
-        gkoPool.returnObject("B",objB1);
+        gkoPool.returnObject("A", objA1);
+        gkoPool.returnObject("B", objB1);
 
-        assertEquals(0,gkoPool.getNumActive());
-        assertEquals(4,gkoPool.getNumIdle());
-        assertEquals(0,gkoPool.getNumActive("A"));
-        assertEquals(2,gkoPool.getNumIdle("A"));
-        assertEquals(0,gkoPool.getNumActive("B"));
-        assertEquals(2,gkoPool.getNumIdle("B"));
+        assertEquals(0, gkoPool.getNumActive());
+        assertEquals(4, gkoPool.getNumIdle());
+        assertEquals(0, gkoPool.getNumActive("A"));
+        assertEquals(2, gkoPool.getNumIdle("A"));
+        assertEquals(0, gkoPool.getNumActive("B"));
+        assertEquals(2, gkoPool.getNumIdle("B"));
     }
 
     @Test
     public void testReturnObjectThrowsIllegalStateException() {
-        try (final GenericKeyedObjectPool<String, String, TestException> pool = new GenericKeyedObjectPool<>(new SimpleFactory<>())) {
+        try (GenericKeyedObjectPool<String, String, TestException> pool = new GenericKeyedObjectPool<>(new SimpleFactory<>())) {
             assertThrows(IllegalStateException.class,
                     () ->  pool.returnObject("Foo", "Bar"));
         }
@@ -2536,7 +2511,7 @@ public class TestGenericKeyedObjectPool extends AbstractTestKeyedObjectPool {
         final SimpleFactory<String> factory = new SimpleFactory<>();
         factory.setValidateLatency(100);
         factory.setValid(true); // Validation always succeeds
-        try (final GenericKeyedObjectPool<String, String, TestException> pool = new GenericKeyedObjectPool<>(factory)) {
+        try (GenericKeyedObjectPool<String, String, TestException> pool = new GenericKeyedObjectPool<>(factory)) {
             pool.setMaxWait(Duration.ofMillis(1000));
             pool.setTestWhileIdle(true);
             pool.setMaxTotalPerKey(2);
@@ -2667,7 +2642,7 @@ public void testValidateOnCreateFailure() throws Exception {
         final SimpleFactory<String> factory = new SimpleFactory<>();
         factory.setValid(false); // Validate will always fail
         factory.setValidationEnabled(true);
-        try (final GenericKeyedObjectPool<String, String, TestException> pool = new GenericKeyedObjectPool<>(factory)) {
+        try (GenericKeyedObjectPool<String, String, TestException> pool = new GenericKeyedObjectPool<>(factory)) {
             pool.setMaxTotalPerKey(2);
             pool.setMaxWait(Duration.ofMillis(1500));
             pool.setTestOnReturn(true);
diff --git a/src/test/java/org/apache/commons/pool3/impl/TestGenericObjectPool.java b/src/test/java/org/apache/commons/pool3/impl/TestGenericObjectPool.java
index caa3afff..a730a44c 100644
--- a/src/test/java/org/apache/commons/pool3/impl/TestGenericObjectPool.java
+++ b/src/test/java/org/apache/commons/pool3/impl/TestGenericObjectPool.java
@@ -74,9 +74,9 @@ public class TestGenericObjectPool extends TestBaseObjectPool {
 
     private final class ConcurrentBorrowAndEvictThread extends Thread {
         private final boolean borrow;
-        public String obj;
+        private String obj;
 
-        public ConcurrentBorrowAndEvictThread(final boolean borrow) {
+        private ConcurrentBorrowAndEvictThread(final boolean borrow) {
             this.borrow = borrow;
         }
 
@@ -159,7 +159,7 @@ public class TestGenericObjectPool extends TestBaseObjectPool {
 
         private final GenericObjectPool<T, E> pool;
 
-        public EvictionThread(final GenericObjectPool<T, E> pool) {
+        private EvictionThread(final GenericObjectPool<T, E> pool) {
             this.pool = pool;
         }
 
@@ -200,7 +200,7 @@ public class TestGenericObjectPool extends TestBaseObjectPool {
         private final ObjectPool<String, ? extends Exception> pool;
         private boolean done;
 
-        public InvalidateThread(final ObjectPool<String, ? extends Exception> pool, final String obj) {
+        InvalidateThread(final ObjectPool<String, ? extends Exception> pool, final String obj) {
             this.obj = obj;
             this.pool = pool;
         }
@@ -487,29 +487,29 @@ public class TestGenericObjectPool extends TestBaseObjectPool {
         private volatile boolean failed;
         private volatile Throwable error;
 
-        public TestThread(final ObjectPool<T, E> pool) {
+        private TestThread(final ObjectPool<T, E> pool) {
             this(pool, 100, 50, true, null);
         }
 
-        public TestThread(final ObjectPool<T, E> pool, final int iter) {
+        private TestThread(final ObjectPool<T, E> pool, final int iter) {
             this(pool, iter, 50, true, null);
         }
 
-        public TestThread(final ObjectPool<T, E> pool, final int iter, final int delay) {
+        private TestThread(final ObjectPool<T, E> pool, final int iter, final int delay) {
             this(pool, iter, delay, true, null);
         }
 
-        public TestThread(final ObjectPool<T, E> pool, final int iter, final int delay,
+        private TestThread(final ObjectPool<T, E> pool, final int iter, final int delay,
                 final boolean randomDelay) {
             this(pool, iter, delay, randomDelay, null);
         }
 
-        public TestThread(final ObjectPool<T, E> pool, final int iter, final int delay,
+        private TestThread(final ObjectPool<T, E> pool, final int iter, final int delay,
                 final boolean randomDelay, final Object obj) {
             this(pool, iter, delay, delay, randomDelay, obj);
         }
 
-        public TestThread(final ObjectPool<T, E> pool, final int iter, final int startDelay,
+        private TestThread(final ObjectPool<T, E> pool, final int iter, final int startDelay,
                 final int holdTime, final boolean randomDelay, final Object obj) {
             this.pool = pool;
             this.iter = iter;
@@ -580,7 +580,7 @@ public class TestGenericObjectPool extends TestBaseObjectPool {
         private long endedMillis;
         private String objectId;
 
-        public WaitingTestThread(final GenericObjectPool<String, E> pool, final long pause) {
+        WaitingTestThread(final GenericObjectPool<String, E> pool, final long pause) {
             this.pool = pool;
             this.pause = pause;
             this.thrown = null;
@@ -604,13 +604,12 @@ public class TestGenericObjectPool extends TestBaseObjectPool {
         }
     }
 
-    private static final boolean DISPLAY_THREAD_DETAILS = Boolean
-            .getBoolean("TestGenericObjectPool.display.thread.details");
+    private static final boolean DISPLAY_THREAD_DETAILS = Boolean.getBoolean("TestGenericObjectPool.display.thread.details");
+
     // To pass this to a Maven test, use:
     // mvn test -DargLine="-DTestGenericObjectPool.display.thread.details=true"
     // @see https://issues.apache.org/jira/browse/SUREFIRE-121
-
-    protected GenericObjectPool<String, TestException> genericObjectPool;
+    private GenericObjectPool<String, TestException> genericObjectPool;
 
     private SimpleFactory simpleFactory;
 
@@ -893,13 +892,10 @@ public class TestGenericObjectPool extends TestBaseObjectPool {
         return new GenericObjectPool<>(fac);
     }
 
-    /**
-     * Kicks off <numThreads> test threads, each of which will go through
-     * <iterations> borrow-return cycles with random delay times <= delay
-     * in between.
+    /*
+     * Kicks off numThreads test threads, each of which will go through iterations borrow-return cycles with random delay times <= delay in between.
      */
-    private <T, E extends Exception> void runTestThreads(final int numThreads, final int iterations, final int delay,
-            final GenericObjectPool<T, E> testPool) {
+    private <T, E extends Exception> void runTestThreads(final int numThreads, final int iterations, final int delay, final GenericObjectPool<T, E> testPool) {
         final TestThread<T, E>[] threads = new TestThread[numThreads];
         for (int i = 0; i < numThreads; i++) {
             threads[i] = new TestThread<>(testPool, iterations, delay);
@@ -1006,7 +1002,7 @@ public class TestGenericObjectPool extends TestBaseObjectPool {
     public void testAppendStats() {
         assertFalse(genericObjectPool.getMessageStatistics());
         assertEquals("foo", genericObjectPool.appendStats("foo"));
-        try (final GenericObjectPool<?, TestException> pool = new GenericObjectPool<>(new SimpleFactory())) {
+        try (GenericObjectPool<?, TestException> pool = new GenericObjectPool<>(new SimpleFactory())) {
             pool.setMessagesStatistics(true);
             assertNotEquals("foo", pool.appendStats("foo"));
             pool.setMessagesStatistics(false);
@@ -1072,7 +1068,7 @@ public class TestGenericObjectPool extends TestBaseObjectPool {
     @Test/* maxWaitMillis x2 + padding */
     @Timeout(value = 1200, unit = TimeUnit.MILLISECONDS)
     public void testBorrowObjectOverrideMaxWaitLarge() throws Exception {
-        try (final GenericObjectPool<String, InterruptedException> pool = new GenericObjectPool<>(createSlowObjectFactory(Duration.ofSeconds(60)))) {
+        try (GenericObjectPool<String, InterruptedException> pool = new GenericObjectPool<>(createSlowObjectFactory(Duration.ofSeconds(60)))) {
             pool.setMaxTotal(1);
             pool.setMaxWait(Duration.ofMillis(1_000)); // large
             pool.setBlockWhenExhausted(false);
@@ -1095,7 +1091,7 @@ public class TestGenericObjectPool extends TestBaseObjectPool {
     @Test/* maxWaitMillis x2 + padding */
     @Timeout(value = 1200, unit = TimeUnit.MILLISECONDS)
     public void testBorrowObjectOverrideMaxWaitSmall() throws Exception {
-        try (final GenericObjectPool<String, InterruptedException> pool = new GenericObjectPool<>(createSlowObjectFactory(Duration.ofSeconds(60)))) {
+        try (GenericObjectPool<String, InterruptedException> pool = new GenericObjectPool<>(createSlowObjectFactory(Duration.ofSeconds(60)))) {
             pool.setMaxTotal(1);
             pool.setMaxWait(Duration.ofMillis(1)); // small
             pool.setBlockWhenExhausted(false);
@@ -1217,7 +1213,7 @@ public class TestGenericObjectPool extends TestBaseObjectPool {
         final SimpleFactory factory = new SimpleFactory();
         // Give makeObject a little latency
         factory.setMakeLatency(200);
-        try (final GenericObjectPool<String, TestException> pool = new GenericObjectPool<>(factory,
+        try (GenericObjectPool<String, TestException> pool = new GenericObjectPool<>(factory,
                 new GenericObjectPoolConfig<>())) {
             final String s = pool.borrowObject();
             // First borrow waits on create, so wait time should be at least 200 ms
@@ -1236,7 +1232,7 @@ public class TestGenericObjectPool extends TestBaseObjectPool {
     @Test
     @Timeout(value = 60000, unit = TimeUnit.MILLISECONDS)
     public void testCloseMultiplePools1() {
-        try (final GenericObjectPool<String, TestException> genericObjectPool2 = new GenericObjectPool<>(
+        try (GenericObjectPool<String, TestException> genericObjectPool2 = new GenericObjectPool<>(
                 simpleFactory)) {
             genericObjectPool.setDurationBetweenEvictionRuns(TestConstants.ONE_MILLISECOND_DURATION);
             genericObjectPool2.setDurationBetweenEvictionRuns(TestConstants.ONE_MILLISECOND_DURATION);
@@ -1247,7 +1243,7 @@ public class TestGenericObjectPool extends TestBaseObjectPool {
     @Test
     @Timeout(value = 60000, unit = TimeUnit.MILLISECONDS)
     public void testCloseMultiplePools2() throws Exception {
-        try (final GenericObjectPool<String, TestException> genericObjectPool2 = new GenericObjectPool<>(
+        try (GenericObjectPool<String, TestException> genericObjectPool2 = new GenericObjectPool<>(
                 simpleFactory)) {
             // Ensure eviction takes a long time, during which time EvictionTimer.executor's
             // queue is empty
@@ -1439,7 +1435,7 @@ public class TestGenericObjectPool extends TestBaseObjectPool {
     @Test
     public void testEqualsIndiscernible() throws Exception {
         final HashSetFactory factory = new HashSetFactory();
-        try (final GenericObjectPool<HashSet<String>, RuntimeException> pool = new GenericObjectPool<>(factory,
+        try (GenericObjectPool<HashSet<String>, RuntimeException> pool = new GenericObjectPool<>(factory,
                 new GenericObjectPoolConfig<>())) {
             final HashSet<String> s1 = pool.borrowObject();
             final HashSet<String> s2 = pool.borrowObject();
@@ -1452,7 +1448,7 @@ public class TestGenericObjectPool extends TestBaseObjectPool {
     public void testErrorFactoryDoesNotBlockThreads() throws Exception {
 
         final CreateErrorFactory factory = new CreateErrorFactory();
-        try (final GenericObjectPool<String, InterruptedException> createFailFactoryPool = new GenericObjectPool<>(
+        try (GenericObjectPool<String, InterruptedException> createFailFactoryPool = new GenericObjectPool<>(
                 factory)) {
 
             createFailFactoryPool.setMaxTotal(1);
@@ -1595,7 +1591,7 @@ public class TestGenericObjectPool extends TestBaseObjectPool {
     @Timeout(value = 60000, unit = TimeUnit.MILLISECONDS)
     public void testEvictionInvalid() throws Exception {
 
-        try (final GenericObjectPool<Object, RuntimeException> invalidFactoryPool = new GenericObjectPool<>(
+        try (GenericObjectPool<Object, RuntimeException> invalidFactoryPool = new GenericObjectPool<>(
                 new InvalidFactory())) {
 
             invalidFactoryPool.setMaxIdle(1);
@@ -1708,7 +1704,7 @@ public class TestGenericObjectPool extends TestBaseObjectPool {
         final class TimeTest extends BasePooledObjectFactory<TimeTest, RuntimeException> {
             private final long createTimeMillis;
 
-            public TimeTest() {
+            TimeTest() {
                 createTimeMillis = System.currentTimeMillis();
             }
 
@@ -1727,7 +1723,7 @@ public class TestGenericObjectPool extends TestBaseObjectPool {
             }
         }
 
-        try (final GenericObjectPool<TimeTest, RuntimeException> timePool = new GenericObjectPool<>(new TimeTest())) {
+        try (GenericObjectPool<TimeTest, RuntimeException> timePool = new GenericObjectPool<>(new TimeTest())) {
 
             timePool.setMaxIdle(5);
             timePool.setMaxTotal(5);
@@ -1896,7 +1892,7 @@ public class TestGenericObjectPool extends TestBaseObjectPool {
     public void testFailingFactoryDoesNotBlockThreads() throws Exception {
 
         final CreateFailFactory factory = new CreateFailFactory();
-        try (final GenericObjectPool<String, InterruptedException> createFailFactoryPool = new GenericObjectPool<>(
+        try (GenericObjectPool<String, InterruptedException> createFailFactoryPool = new GenericObjectPool<>(
                 factory)) {
 
             createFailFactoryPool.setMaxTotal(1);
@@ -1961,7 +1957,7 @@ public class TestGenericObjectPool extends TestBaseObjectPool {
 
     @Test
     public void testGetFactoryType_DefaultPooledObjectFactory() {
-        try (final GenericObjectPool<String, RuntimeException> pool = new GenericObjectPool<>(
+        try (GenericObjectPool<String, RuntimeException> pool = new GenericObjectPool<>(
                 createDefaultPooledObjectFactory())) {
             assertNotNull(pool.getFactoryType());
         }
@@ -1969,7 +1965,7 @@ public class TestGenericObjectPool extends TestBaseObjectPool {
 
     @Test
     public void testGetFactoryType_NullPooledObjectFactory() {
-        try (final GenericObjectPool<String, RuntimeException> pool = new GenericObjectPool<>(
+        try (GenericObjectPool<String, RuntimeException> pool = new GenericObjectPool<>(
                 createNullPooledObjectFactory())) {
             assertNotNull(pool.getFactoryType());
         }
@@ -1977,7 +1973,7 @@ public class TestGenericObjectPool extends TestBaseObjectPool {
 
     @Test
     public void testGetFactoryType_PoolUtilsSynchronizedDefaultPooledFactory() {
-        try (final GenericObjectPool<String, RuntimeException> pool = new GenericObjectPool<>(
+        try (GenericObjectPool<String, RuntimeException> pool = new GenericObjectPool<>(
                 PoolUtils.synchronizedPooledFactory(createDefaultPooledObjectFactory()))) {
             assertNotNull(pool.getFactoryType());
         }
@@ -1985,7 +1981,7 @@ public class TestGenericObjectPool extends TestBaseObjectPool {
 
     @Test
     public void testGetFactoryType_PoolUtilsSynchronizedNullPooledFactory() {
-        try (final GenericObjectPool<String, RuntimeException> pool = new GenericObjectPool<>(
+        try (GenericObjectPool<String, RuntimeException> pool = new GenericObjectPool<>(
                 PoolUtils.synchronizedPooledFactory(createNullPooledObjectFactory()))) {
             assertNotNull(pool.getFactoryType());
         }
@@ -1993,7 +1989,7 @@ public class TestGenericObjectPool extends TestBaseObjectPool {
 
     @Test
     public void testGetFactoryType_SynchronizedDefaultPooledObjectFactory() {
-        try (final GenericObjectPool<String, RuntimeException> pool = new GenericObjectPool<>(
+        try (GenericObjectPool<String, RuntimeException> pool = new GenericObjectPool<>(
                 new TestSynchronizedPooledObjectFactory<>(createDefaultPooledObjectFactory()))) {
             assertNotNull(pool.getFactoryType());
         }
@@ -2001,7 +1997,7 @@ public class TestGenericObjectPool extends TestBaseObjectPool {
 
     @Test
     public void testGetFactoryType_SynchronizedNullPooledObjectFactory() {
-        try (final GenericObjectPool<String, RuntimeException> pool = new GenericObjectPool<>(
+        try (GenericObjectPool<String, RuntimeException> pool = new GenericObjectPool<>(
                 new TestSynchronizedPooledObjectFactory<>(createNullPooledObjectFactory()))) {
             assertNotNull(pool.getFactoryType());
         }
@@ -2009,7 +2005,7 @@ public class TestGenericObjectPool extends TestBaseObjectPool {
 
     @Test
     public void testGetStatsString() {
-        try (final GenericObjectPool<String, RuntimeException> pool = new GenericObjectPool<>(
+        try (GenericObjectPool<String, RuntimeException> pool = new GenericObjectPool<>(
                 new TestSynchronizedPooledObjectFactory<>(createNullPooledObjectFactory()))) {
             assertNotNull(pool.getStatsString());
         }
@@ -2027,7 +2023,7 @@ public class TestGenericObjectPool extends TestBaseObjectPool {
     @Test
     public void testInvalidateFreesCapacity() throws Exception {
         final SimpleFactory factory = new SimpleFactory();
-        try (final GenericObjectPool<String, TestException> pool = new GenericObjectPool<>(factory)) {
+        try (GenericObjectPool<String, TestException> pool = new GenericObjectPool<>(factory)) {
             pool.setMaxTotal(2);
             pool.setMaxWait(Duration.ofMillis(500));
             // Borrow an instance and hold if for 5 seconds
@@ -2063,7 +2059,7 @@ public class TestGenericObjectPool extends TestBaseObjectPool {
 
         final GenericObjectPoolConfig<String> config = new GenericObjectPoolConfig<>();
         config.setJmxEnabled(false);
-        try (final GenericObjectPool<String, TestException> poolWithoutJmx = new GenericObjectPool<>(simpleFactory,
+        try (GenericObjectPool<String, TestException> poolWithoutJmx = new GenericObjectPool<>(simpleFactory,
                 config)) {
             assertNull(poolWithoutJmx.getJmxName());
             config.setJmxEnabled(true);
@@ -2071,7 +2067,7 @@ public class TestGenericObjectPool extends TestBaseObjectPool {
         }
 
         config.setJmxNameBase(null);
-        try (final GenericObjectPool<String, TestException> poolWithDefaultJmxNameBase = new GenericObjectPool<>(
+        try (GenericObjectPool<String, TestException> poolWithDefaultJmxNameBase = new GenericObjectPool<>(
                 simpleFactory, config)) {
             assertNotNull(poolWithDefaultJmxNameBase.getJmxName());
         }
@@ -2529,7 +2525,7 @@ public class TestGenericObjectPool extends TestBaseObjectPool {
     @Test
     public void testMultipleReturn() throws Exception {
         final WaiterFactory<String> factory = new WaiterFactory<>(0, 0, 0, 0, 0, 0);
-        try (final GenericObjectPool<Waiter, IllegalStateException> pool = new GenericObjectPool<>(factory)) {
+        try (GenericObjectPool<Waiter, IllegalStateException> pool = new GenericObjectPool<>(factory)) {
             pool.setTestOnReturn(true);
             final Waiter waiter = pool.borrowObject();
             pool.returnObject(waiter);
@@ -2549,7 +2545,7 @@ public class TestGenericObjectPool extends TestBaseObjectPool {
     // POOL-248
     @Test
     public void testMultipleReturnOfSameObject() throws Exception {
-        try (final GenericObjectPool<String, TestException> pool = new GenericObjectPool<>(simpleFactory,
+        try (GenericObjectPool<String, TestException> pool = new GenericObjectPool<>(simpleFactory,
                 new GenericObjectPoolConfig<>())) {
 
             assertEquals(0, pool.getNumActive());
@@ -2582,7 +2578,7 @@ public class TestGenericObjectPool extends TestBaseObjectPool {
     @Test
     public void testMutable() throws Exception {
         final HashSetFactory factory = new HashSetFactory();
-        try (final GenericObjectPool<HashSet<String>, RuntimeException> pool = new GenericObjectPool<>(factory,
+        try (GenericObjectPool<HashSet<String>, RuntimeException> pool = new GenericObjectPool<>(factory,
                 new GenericObjectPoolConfig<>())) {
             final HashSet<String> s1 = pool.borrowObject();
             final HashSet<String> s2 = pool.borrowObject();
@@ -2613,7 +2609,7 @@ public class TestGenericObjectPool extends TestBaseObjectPool {
         final int delay = 1;
         final int iterations = 1000;
         final AtomicIntegerFactory factory = new AtomicIntegerFactory();
-        try (final GenericObjectPool<AtomicInteger, RuntimeException> pool = new GenericObjectPool<>(factory)) {
+        try (GenericObjectPool<AtomicInteger, RuntimeException> pool = new GenericObjectPool<>(factory)) {
             pool.setMaxTotal(maxTotal);
             pool.setMaxIdle(maxTotal);
             pool.setTestOnBorrow(true);
@@ -2685,11 +2681,12 @@ public class TestGenericObjectPool extends TestBaseObjectPool {
         assertEquals(1, genericObjectPool.getNumIdle());
     }
 
-    @Test/* maxWaitMillis x2 + padding */
+    @Test /* maxWaitMillis x2 + padding */
     @Timeout(value = 1200, unit = TimeUnit.MILLISECONDS)
     public void testReturnBorrowObjectWithingMaxWaitDuration() throws Exception {
         final Duration maxWaitDuration = Duration.ofMillis(500);
-        try (final GenericObjectPool<String, InterruptedException> createSlowObjectFactoryPool = new GenericObjectPool<>(createSlowObjectFactory(Duration.ofSeconds(60)))) {
+        try (GenericObjectPool<String, InterruptedException> createSlowObjectFactoryPool = new GenericObjectPool<>(
+                createSlowObjectFactory(Duration.ofSeconds(60)))) {
             createSlowObjectFactoryPool.setMaxTotal(1);
             createSlowObjectFactoryPool.setMaxWait(maxWaitDuration);
             // thread1 tries creating a slow object to make pool full.
@@ -2708,7 +2705,8 @@ public class TestGenericObjectPool extends TestBaseObjectPool {
     @Timeout(value = 1200, unit = TimeUnit.MILLISECONDS)
     public void testReturnBorrowObjectWithingMaxWaitMillis() throws Exception {
         final long maxWaitMillis = 500;
-        try (final GenericObjectPool<String, InterruptedException> createSlowObjectFactoryPool = new GenericObjectPool<>(createSlowObjectFactory(Duration.ofSeconds(60)))) {
+        try (GenericObjectPool<String, InterruptedException> createSlowObjectFactoryPool = new GenericObjectPool<>(
+                createSlowObjectFactory(Duration.ofSeconds(60)))) {
             createSlowObjectFactoryPool.setMaxTotal(1);
             createSlowObjectFactoryPool.setMaxWait(Duration.ofMillis(maxWaitMillis));
             // thread1 tries creating a slow object to make pool full.
@@ -3006,7 +3004,7 @@ public class TestGenericObjectPool extends TestBaseObjectPool {
         final SimpleFactory factory = new SimpleFactory();
         factory.setValid(false); // Validate will always fail
         factory.setValidationEnabled(true);
-        try (final GenericObjectPool<String, TestException> pool = new GenericObjectPool<>(factory)) {
+        try (GenericObjectPool<String, TestException> pool = new GenericObjectPool<>(factory)) {
             pool.setMaxTotal(2);
             pool.setMaxWait(Duration.ofMillis(1500));
             pool.setTestOnReturn(true);
diff --git a/src/test/java/org/apache/commons/pool3/impl/TestGenericObjectPoolClassLoaders.java b/src/test/java/org/apache/commons/pool3/impl/TestGenericObjectPoolClassLoaders.java
index 54a3f9f0..6d175dce 100644
--- a/src/test/java/org/apache/commons/pool3/impl/TestGenericObjectPoolClassLoaders.java
+++ b/src/test/java/org/apache/commons/pool3/impl/TestGenericObjectPoolClassLoaders.java
@@ -78,10 +78,10 @@ public class TestGenericObjectPoolClassLoaders {
 
         final ClassLoader savedClassloader = Thread.currentThread().getContextClassLoader();
 
-        try (final CustomClassLoader cl1 = new CustomClassLoader(1)) {
+        try (CustomClassLoader cl1 = new CustomClassLoader(1)) {
             Thread.currentThread().setContextClassLoader(cl1);
             final CustomClassLoaderObjectFactory factory1 = new CustomClassLoaderObjectFactory(1);
-            try (final GenericObjectPool<URL, IllegalStateException> pool1 = new GenericObjectPool<>(factory1)) {
+            try (GenericObjectPool<URL, IllegalStateException> pool1 = new GenericObjectPool<>(factory1)) {
                 pool1.setMinIdle(1);
                 pool1.setDurationBetweenEvictionRuns(Duration.ofMillis(100));
                 int counter = 0;
@@ -91,10 +91,10 @@ public class TestGenericObjectPoolClassLoaders {
                 }
                 assertEquals(1, pool1.getNumIdle(), "Wrong number of idle objects in pool1");
 
-                try (final CustomClassLoader cl2 = new CustomClassLoader(2)) {
+                try (CustomClassLoader cl2 = new CustomClassLoader(2)) {
                     Thread.currentThread().setContextClassLoader(cl2);
                     final CustomClassLoaderObjectFactory factory2 = new CustomClassLoaderObjectFactory(2);
-                    try (final GenericObjectPool<URL, IllegalStateException> pool2 = new GenericObjectPool<>(factory2)) {
+                    try (GenericObjectPool<URL, IllegalStateException> pool2 = new GenericObjectPool<>(factory2)) {
                         pool2.setMinIdle(1);
 
                         pool2.addObject();
diff --git a/src/test/java/org/apache/commons/pool3/impl/TestGenericObjectPoolFactoryCreateFailure.java b/src/test/java/org/apache/commons/pool3/impl/TestGenericObjectPoolFactoryCreateFailure.java
index f40417b8..cf04c75b 100644
--- a/src/test/java/org/apache/commons/pool3/impl/TestGenericObjectPoolFactoryCreateFailure.java
+++ b/src/test/java/org/apache/commons/pool3/impl/TestGenericObjectPoolFactoryCreateFailure.java
@@ -140,4 +140,4 @@ public class TestGenericObjectPoolFactoryCreateFailure {
         }
 
     }
-}
\ No newline at end of file
+}
diff --git a/src/test/java/org/apache/commons/pool3/impl/TestResilientPooledObjectFactory.java b/src/test/java/org/apache/commons/pool3/impl/TestResilientPooledObjectFactory.java
index 3d3cc371..cef6341a 100644
--- a/src/test/java/org/apache/commons/pool3/impl/TestResilientPooledObjectFactory.java
+++ b/src/test/java/org/apache/commons/pool3/impl/TestResilientPooledObjectFactory.java
@@ -30,14 +30,14 @@ import org.junit.jupiter.api.Test;
 public class TestResilientPooledObjectFactory {
     @Test
     public void testTransientFailure() throws Exception {
-        FailingFactory ff = new FailingFactory();
-        // Make the factory fail with exception immmmediately on make
+        final FailingFactory ff = new FailingFactory();
+        // Make the factory fail with exception immediately on make
         ff.setHang(false);
         ff.setSilentFail(false);
-        ResilientPooledObjectFactory<String, Exception> rf = new ResilientPooledObjectFactory<String, Exception>(ff,
+        final ResilientPooledObjectFactory<String, Exception> rf = new ResilientPooledObjectFactory<>(ff,
                 5, Duration.ofMillis(100), Duration.ofMinutes(10), Duration.ofMillis(100));
         // Create a pool with a max size of 2, using the resilient factory
-        GenericObjectPool<String, Exception> pool = new GenericObjectPool<>(rf);
+        final GenericObjectPool<String, Exception> pool = new GenericObjectPool<>(rf);
         pool.setMaxTotal(2);
         pool.setBlockWhenExhausted(true);
         pool.setTestOnReturn(true);
@@ -47,22 +47,22 @@ public class TestResilientPooledObjectFactory {
         // Base factory is up
         assertTrue(rf.isUp());
         // Check out a couple of objects
-        String s1 = pool.borrowObject();
-        String s2 = pool.borrowObject();
+        final String s1 = pool.borrowObject();
+        final String s2 = pool.borrowObject();
         // Start a borrower that will wait
         new Thread() {
             @Override
             public void run() {
                 try {
                     pool.borrowObject();
-                } catch (Exception e) {
+                } catch (final Exception e) {
                 }
             }
         }.start();
         // Wait for the borrower to join wait queue
         try {
             Thread.sleep(200);
-        } catch (InterruptedException e) {
+        } catch (final InterruptedException e) {
         }
 
         // Crash the base factory
@@ -79,7 +79,7 @@ public class TestResilientPooledObjectFactory {
         // validation destroy
         try {
             Thread.sleep(100);
-        } catch (InterruptedException e) {
+        } catch (final InterruptedException e) {
         }
         assertFalse(rf.isUp());
         // Adder should be running, but failing
@@ -93,7 +93,7 @@ public class TestResilientPooledObjectFactory {
         // Wait for the adder to succeed
         try {
             Thread.sleep(100);
-        } catch (InterruptedException e) {
+        } catch (final InterruptedException e) {
         }
         // Pool should have no waiters
         assertTrue(pool.getNumWaiters() == 0);
@@ -106,7 +106,7 @@ public class TestResilientPooledObjectFactory {
         // Wait for monitor to run
         try {
             Thread.sleep(200);
-        } catch (InterruptedException e) {
+        } catch (final InterruptedException e) {
         }
         // rf should be up now
         assertTrue(rf.isUp());
@@ -120,13 +120,13 @@ public class TestResilientPooledObjectFactory {
 
     @Test
     public void testNulls() throws Exception {
-        FailingFactory ff = new FailingFactory();
-        // Make the factory fail with exception immmmediately on make
+        final FailingFactory ff = new FailingFactory();
+        // Make the factory fail with exception immediately on make
         ff.setSilentFail(true);
-        ResilientPooledObjectFactory<String, Exception> rf = new ResilientPooledObjectFactory<String, Exception>(ff,
+        final ResilientPooledObjectFactory<String, Exception> rf = new ResilientPooledObjectFactory<>(ff,
                 5, Duration.ofMillis(50), Duration.ofMinutes(10), Duration.ofMillis(50));
         // Create a pool with a max size of 2, using the resilient factory
-        GenericObjectPool<String, Exception> pool = new GenericObjectPool<>(rf);
+        final GenericObjectPool<String, Exception> pool = new GenericObjectPool<>(rf);
         pool.setMaxTotal(2);
         pool.setBlockWhenExhausted(true);
         pool.setTestOnReturn(true);
@@ -145,7 +145,7 @@ public class TestResilientPooledObjectFactory {
                 try {
                     final String s = pool.borrowObject();
                     pool.returnObject(s);
-                } catch (Exception e) {
+                } catch (final Exception e) {
                 }
             }
         }.start();
@@ -155,7 +155,7 @@ public class TestResilientPooledObjectFactory {
                 try {
                     final String s = pool.borrowObject();
                     pool.returnObject(s);
-                } catch (Exception e) {
+                } catch (final Exception e) {
                 }
             }
         }.start();
@@ -163,7 +163,7 @@ public class TestResilientPooledObjectFactory {
         // Wait for the borrowers to get in the queue
         try {
             Thread.sleep(50);
-        } catch (InterruptedException e) {
+        } catch (final InterruptedException e) {
         }
         pool.returnObject(s1);
         pool.returnObject(s2);
@@ -173,7 +173,7 @@ public class TestResilientPooledObjectFactory {
         // validation destroy
         try {
             Thread.sleep(200);
-        } catch (InterruptedException e) {
+        } catch (final InterruptedException e) {
         }
         assertFalse(rf.isUp());
         // Restart the factory
@@ -181,7 +181,7 @@ public class TestResilientPooledObjectFactory {
         // Wait for the adder to succeed
         try {
             Thread.sleep(200);
-        } catch (InterruptedException e) {
+        } catch (final InterruptedException e) {
         }
         // Pool should have no waiters
         assertEquals(0, pool.getNumWaiters());
@@ -189,7 +189,7 @@ public class TestResilientPooledObjectFactory {
         // Wait for monitor to run
         try {
             Thread.sleep(200);
-        } catch (InterruptedException e) {
+        } catch (final InterruptedException e) {
         }
         // Monitor and adder should be stopped by pool close
         assertFalse(rf.isAdderRunning());
@@ -198,13 +198,13 @@ public class TestResilientPooledObjectFactory {
 
     @Test
     public void testAdderStartStop() throws Exception {
-        FailingFactory ff = new FailingFactory();
-        // Make the factory fail with exception immmmediately on make
+        final FailingFactory ff = new FailingFactory();
+        // Make the factory fail with exception immediately on make
         ff.setSilentFail(true);
-        ResilientPooledObjectFactory<String, Exception> rf = new ResilientPooledObjectFactory<String, Exception>(ff,
+        final ResilientPooledObjectFactory<String, Exception> rf = new ResilientPooledObjectFactory<>(ff,
                 5, Duration.ofMillis(200), Duration.ofMinutes(10), Duration.ofMillis(20));
         // Create a pool with a max size of 2, using the resilient factory
-        GenericObjectPool<String, Exception> pool = new GenericObjectPool<>(rf);
+        final GenericObjectPool<String, Exception> pool = new GenericObjectPool<>(rf);
         pool.setMaxTotal(2);
         pool.setBlockWhenExhausted(true);
         pool.setTestOnReturn(true);
@@ -219,26 +219,26 @@ public class TestResilientPooledObjectFactory {
             public void run() {
                 try {
                     final String s = pool.borrowObject();
-                } catch (Exception e) {
+                } catch (final Exception e) {
                 }
             }
         }.start();
         // Wait for the borrower to get in the queue
         try {
             Thread.sleep(50);
-        } catch (InterruptedException e) {
+        } catch (final InterruptedException e) {
         }
         // Crash the base factory
         ff.crash();
         // Return object will create capacity in the pool
         try {
             pool.returnObject(s1);
-        } catch (Exception e) {
+        } catch (final Exception e) {
         }
         // Wait for the adder to run
         try {
             Thread.sleep(100);
-        } catch (InterruptedException e) {
+        } catch (final InterruptedException e) {
         }
         // Adder should be running
         assertTrue(rf.isAdderRunning());
@@ -247,7 +247,7 @@ public class TestResilientPooledObjectFactory {
         // Wait for the adder to succeed
         try {
             Thread.sleep(200);
-        } catch (InterruptedException e) {
+        } catch (final InterruptedException e) {
         }
         // Pool should have no waiters
         assertEquals(0, pool.getNumWaiters());
@@ -262,7 +262,7 @@ public class TestResilientPooledObjectFactory {
         // Wait for the monitor to run
         try {
             Thread.sleep(200);
-        } catch (InterruptedException e) {
+        } catch (final InterruptedException e) {
         }
         assertTrue(rf.isUp());
         // Adder should be stopped
@@ -271,12 +271,12 @@ public class TestResilientPooledObjectFactory {
 
     @Test
     public void testIsMonitorRunning() throws Exception {
-        FailingFactory ff = new FailingFactory();
-        // Make the factory fail with exception immmmediately on make
+        final FailingFactory ff = new FailingFactory();
+        // Make the factory fail with exception immediately on make
         ff.setSilentFail(true);
-        ResilientPooledObjectFactory<String, Exception> rf = new ResilientPooledObjectFactory<String, Exception>(ff,
+        final ResilientPooledObjectFactory<String, Exception> rf = new ResilientPooledObjectFactory<>(ff,
                 5, Duration.ofMillis(200), Duration.ofMinutes(10), Duration.ofMillis(20));
-        GenericObjectPool<String, Exception> pool = new GenericObjectPool<>(rf);
+        final GenericObjectPool<String, Exception> pool = new GenericObjectPool<>(rf);
         rf.setPool(pool);
         rf.startMonitor();
         assertTrue(rf.isMonitorRunning());
@@ -287,15 +287,15 @@ public class TestResilientPooledObjectFactory {
         // Wait for monitor to run so it can kill itself
         try {
             Thread.sleep(200);
-        } catch (InterruptedException e) {
+        } catch (final InterruptedException e) {
         }
         assertFalse(rf.isMonitorRunning());
     }
 
     @Test
     public void testConstructorWithDefaults() {
-        FailingFactory ff = new FailingFactory();
-        ResilientPooledObjectFactory<String, Exception> rf = new ResilientPooledObjectFactory<String, Exception>(ff);
+        final FailingFactory ff = new FailingFactory();
+        final ResilientPooledObjectFactory<String, Exception> rf = new ResilientPooledObjectFactory<>(ff);
         assertFalse(rf.isMonitorRunning());
         assertFalse(rf.isAdderRunning());
         assertEquals(ResilientPooledObjectFactory.getDefaultLogSize(), rf.getLogSize());
@@ -312,14 +312,15 @@ public class TestResilientPooledObjectFactory {
      * Factory that suffers outages and fails in configurable ways when it is down.
      */
     class FailingFactory implements PooledObjectFactory<String, Exception> {
-        /** Wheter or not the factory is up */
+
+        /** Whether or not the factory is up */
         private boolean up = true;
 
         /** Whether or not to fail silently */
         private boolean silentFail = true;
 
         /** Whether or not to hang */
-        private boolean hang = false;
+        private boolean hang;
 
         public void crash() {
             this.up = false;
@@ -329,18 +330,18 @@ public class TestResilientPooledObjectFactory {
             this.up = true;
         }
 
-        public void setSilentFail(boolean silentFail) {
+        public void setSilentFail(final boolean silentFail) {
             this.silentFail = silentFail;
         }
 
-        public void setHang(boolean hang) {
+        public void setHang(final boolean hang) {
             this.hang = hang;
         }
 
         @Override
         public PooledObject<String> makeObject() throws Exception {
             if (up) {
-                return new DefaultPooledObject<String>(UUID.randomUUID().toString());
+                return new DefaultPooledObject<>(UUID.randomUUID().toString());
             }
             if (!silentFail) {
                 throw new Exception("makeObject failed");
@@ -349,7 +350,7 @@ public class TestResilientPooledObjectFactory {
                 while (!up) {
                     try {
                         Thread.sleep(1000);
-                    } catch (InterruptedException e) {
+                    } catch (final InterruptedException e) {
                     }
                 }
             }
@@ -357,20 +358,20 @@ public class TestResilientPooledObjectFactory {
         }
 
         @Override
-        public void destroyObject(PooledObject<String> p) throws Exception {
+        public void destroyObject(final PooledObject<String> p) throws Exception {
         }
 
         @Override
-        public boolean validateObject(PooledObject<String> p) {
+        public boolean validateObject(final PooledObject<String> p) {
             return up;
         }
 
         @Override
-        public void activateObject(PooledObject<String> p) throws Exception {
+        public void activateObject(final PooledObject<String> p) throws Exception {
         }
 
         @Override
-        public void passivateObject(PooledObject<String> p) throws Exception {
+        public void passivateObject(final PooledObject<String> p) throws Exception {
         }
     }
-}
\ No newline at end of file
+}
diff --git a/src/test/java/org/apache/commons/pool3/impl/TestSoftRefOutOfMemory.java b/src/test/java/org/apache/commons/pool3/impl/TestSoftRefOutOfMemory.java
index 0499da7c..00905507 100644
--- a/src/test/java/org/apache/commons/pool3/impl/TestSoftRefOutOfMemory.java
+++ b/src/test/java/org/apache/commons/pool3/impl/TestSoftRefOutOfMemory.java
@@ -59,7 +59,7 @@ public class TestSoftRefOutOfMemory {
 
         private final OomeTrigger trigger;
 
-        public OomeFactory(final OomeTrigger trigger) {
+        OomeFactory(final OomeTrigger trigger) {
             this.trigger = trigger;
         }
 
@@ -265,4 +265,4 @@ public class TestSoftRefOutOfMemory {
 
         assertEquals(1, pool.getNumIdle());
     }
-}
\ No newline at end of file
+}
diff --git a/src/test/java/org/apache/commons/pool3/impl/TestSynchronizedPooledObjectFactory.java b/src/test/java/org/apache/commons/pool3/impl/TestSynchronizedPooledObjectFactory.java
index 0d045fde..a75a5e8a 100644
--- a/src/test/java/org/apache/commons/pool3/impl/TestSynchronizedPooledObjectFactory.java
+++ b/src/test/java/org/apache/commons/pool3/impl/TestSynchronizedPooledObjectFactory.java
@@ -26,111 +26,110 @@ import org.apache.commons.pool3.PooledObjectFactory;
 /**
  * Copies PoolUtil's private static final class SynchronizedPooledObjectFactory.
  *
- * A fully synchronized PooledObjectFactory that wraps a PooledObjectFactory and
- * synchronizes access to the wrapped factory methods.
+ * A fully synchronized PooledObjectFactory that wraps a PooledObjectFactory and synchronizes access to the wrapped factory methods.
  * <p>
- * <strong>Note:</strong> This should not be used on pool implementations that already
- * provide proper synchronization such as the pools provided in the Commons Pool
- * library.
+ * <strong>Note:</strong> This should not be used on pool implementations that already provide proper synchronization such as the pools provided in the Commons
+ * Pool library.
  * </p>
+ *
+ * @param <T> Type of element managed in this factory.
+ * @param <E> Type of exception thrown in this factory.
  */
 final class TestSynchronizedPooledObjectFactory<T, E extends Exception> implements PooledObjectFactory<T, E> {
 
-	/** Synchronization lock */
-	private final WriteLock writeLock = new ReentrantReadWriteLock().writeLock();
+    /** Synchronization lock */
+    private final WriteLock writeLock = new ReentrantReadWriteLock().writeLock();
 
-	/** Wrapped factory */
-	private final PooledObjectFactory<T, E> factory;
+    /** Wrapped factory */
+    private final PooledObjectFactory<T, E> factory;
 
-	/**
-	 * Constructs a SynchronizedPoolableObjectFactory wrapping the given factory.
-	 *
-	 * @param factory
-	 *            underlying factory to wrap
-	 * @throws IllegalArgumentException
-	 *             if the factory is null
-	 */
-	TestSynchronizedPooledObjectFactory(final PooledObjectFactory<T, E> factory) throws IllegalArgumentException {
-		if (factory == null) {
-			throw new IllegalArgumentException("factory must not be null.");
-		}
-		this.factory = factory;
-	}
+    /**
+     * Constructs a SynchronizedPoolableObjectFactory wrapping the given factory.
+     *
+     * @param factory underlying factory to wrap
+     * @throws IllegalArgumentException if the factory is null
+     */
+    TestSynchronizedPooledObjectFactory(final PooledObjectFactory<T, E> factory) throws IllegalArgumentException {
+        if (factory == null) {
+            throw new IllegalArgumentException("factory must not be null.");
+        }
+        this.factory = factory;
+    }
 
-	/**
-	 * {@inheritDoc}
-	 */
-	@Override
-	public void activateObject(final PooledObject<T> p) throws E {
-		writeLock.lock();
-		try {
-			factory.activateObject(p);
-		} finally {
-			writeLock.unlock();
-		}
-	}
+    /**
+     * {@inheritDoc}
+     */
+    @Override
+    public void activateObject(final PooledObject<T> p) throws E {
+        writeLock.lock();
+        try {
+            factory.activateObject(p);
+        } finally {
+            writeLock.unlock();
+        }
+    }
 
-	/**
-	 * {@inheritDoc}
-	 */
-	@Override
-	public void destroyObject(final PooledObject<T> p) throws E {
-		writeLock.lock();
-		try {
-			factory.destroyObject(p);
-		} finally {
-			writeLock.unlock();
-		}
-	}
+    /**
+     * {@inheritDoc}
+     */
+    @Override
+    public void destroyObject(final PooledObject<T> p) throws E {
+        writeLock.lock();
+        try {
+            factory.destroyObject(p);
+        } finally {
+            writeLock.unlock();
+        }
+    }
 
-	/**
-	 * {@inheritDoc}
-	 */
-	@Override
-	public PooledObject<T> makeObject() throws E {
-		writeLock.lock();
-		try {
-			return factory.makeObject();
-		} finally {
-			writeLock.unlock();
-		}
-	}
+    /**
+     * {@inheritDoc}
+     */
+    @Override
+    public PooledObject<T> makeObject() throws E {
+        writeLock.lock();
+        try {
+            return factory.makeObject();
+        } finally {
+            writeLock.unlock();
+        }
+    }
 
-	/**
-	 * {@inheritDoc}
-	 */
-	@Override
-	public void passivateObject(final PooledObject<T> p) throws E {
-		writeLock.lock();
-		try {
-			factory.passivateObject(p);
-		} finally {
-			writeLock.unlock();
-		}
-	}
+    /**
+     * {@inheritDoc}
+     */
+    @Override
+    public void passivateObject(final PooledObject<T> p) throws E {
+        writeLock.lock();
+        try {
+            factory.passivateObject(p);
+        } finally {
+            writeLock.unlock();
+        }
+    }
 
-	/**
-	 * {@inheritDoc}
-	 */
-	@Override
-	public String toString() {
-		final StringBuilder sb = new StringBuilder();
-		sb.append("SynchronizedPoolableObjectFactory");
-		sb.append("{factory=").append(factory);
-		sb.append('}');
-		return sb.toString();
-	}
+    /**
+     * {@inheritDoc}
+     */
+    @Override
+    public String toString() {
+        final StringBuilder sb = new StringBuilder();
+        sb.append("SynchronizedPoolableObjectFactory");
+        sb.append("{factory=").append(factory);
+        sb.append('}');
+        return sb.toString();
+    }
 
-	/**
-	 * {@inheritDoc}
-	 */
-	@Override
-	public boolean validateObject(final PooledObject<T> p) {
-		writeLock.lock();
-		try {
-			return factory.validateObject(p);
-		} finally {
-			writeLock.unlock();
-		}
-	}
+    /**
+     * {@inheritDoc}
+     */
+    @Override
+    public boolean validateObject(final PooledObject<T> p) {
+        writeLock.lock();
+        try {
+            return factory.validateObject(p);
+        } finally {
+            writeLock.unlock();
+        }
+    }
 }
diff --git a/src/test/java/org/apache/commons/pool3/performance/PerformanceTest.java b/src/test/java/org/apache/commons/pool3/performance/PerformanceTest.java
index 6cadf317..f913edd9 100644
--- a/src/test/java/org/apache/commons/pool3/performance/PerformanceTest.java
+++ b/src/test/java/org/apache/commons/pool3/performance/PerformanceTest.java
@@ -91,12 +91,13 @@ public class PerformanceTest {
         }
     }
     }
+
     private static final class TaskStats {
-        public int waiting;
-        public int complete;
-        public long totalBorrowNanos;
-        public long totalReturnNanos;
-        public int nrSamples;
+        private int waiting;
+        private int complete;
+        private long totalBorrowNanos;
+        private long totalReturnNanos;
+        private int nrSamples;
     }
 
     public static void main(final String[] args) {
@@ -133,7 +134,9 @@ public class PerformanceTest {
         this.nrIterations = iterations;
 
         final SleepingObjectFactory factory = new SleepingObjectFactory();
-        if (logLevel >= 4) { factory.setDebug(true); }
+        if (logLevel >= 4) {
+            factory.setDebug(true);
+        }
         pool = new GenericObjectPool<>(factory);
         pool.setMaxTotal(maxTotal);
         pool.setMaxIdle(maxIdle);
@@ -158,13 +161,19 @@ public class PerformanceTest {
             e.printStackTrace();
         }
 
-        if (logLevel >= 1) { System.out.println("started"); }
+        if (logLevel >= 1) {
+            System.out.println("started");
+        }
         Thread.yield();
 
-        if (logLevel >= 1) { System.out.println("go"); }
+        if (logLevel >= 1) {
+            System.out.println("go");
+        }
         Thread.yield();
 
-        if (logLevel >= 1) { System.out.println("finish"); }
+        if (logLevel >= 1) {
+            System.out.println("finish");
+        }
 
         final TaskStats aggregate = new TaskStats();
         if (futures != null) {
diff --git a/src/test/java/org/apache/commons/pool3/pool407/AbstractPool407Factory.java b/src/test/java/org/apache/commons/pool3/pool407/AbstractPool407Factory.java
index 6406383b..d53a5a51 100644
--- a/src/test/java/org/apache/commons/pool3/pool407/AbstractPool407Factory.java
+++ b/src/test/java/org/apache/commons/pool3/pool407/AbstractPool407Factory.java
@@ -28,6 +28,8 @@ public abstract class AbstractPool407Factory extends BasePooledObjectFactory<Poo
     /**
      * Tests whether the subclass relies on the Pool's implementation of makeObject(). If the subclass returns false, then it implements makeObject(), in which
      * case makeObject() returns a bad object like null or a null wrapper.
+     *
+     * @return whether the subclass relies on the Pool's implementation of makeObject().
      */
     abstract boolean isDefaultMakeObject();
 
diff --git a/src/test/java/org/apache/commons/pool3/pool407/KeyedPool407NormalFactory.java b/src/test/java/org/apache/commons/pool3/pool407/KeyedPool407NormalFactory.java
index 00a8653c..15783dee 100644
--- a/src/test/java/org/apache/commons/pool3/pool407/KeyedPool407NormalFactory.java
+++ b/src/test/java/org/apache/commons/pool3/pool407/KeyedPool407NormalFactory.java
@@ -34,7 +34,8 @@ public final class KeyedPool407NormalFactory extends AbstractKeyedPool407Factory
     @Override
     public KeyedPool407Fixture create(final String key) {
         // This is key to the test, creation failed and returns null for instance see
-        // https://github.com/openhab/openhab-core/blob/main/bundles/org.openhab.core.io.transport.modbus/src/main/java/org/openhab/core/io/transport/modbus/internal/pooling/ModbusSlaveConnectionFactoryImpl.java#L163
+        // https://github.com/openhab/openhab-core/blob/main/bundles/org.openhab.core.io.transport.modbus/
+        // src/main/java/org/openhab/core/io/transport/modbus/internal/pooling/ModbusSlaveConnectionFactoryImpl.java#L163
         // the test passes when this returns new Pool407Fixture();
         return fixture;
     }
diff --git a/src/test/java/org/apache/commons/pool3/pool407/KeyedPool407Test.java b/src/test/java/org/apache/commons/pool3/pool407/KeyedPool407Test.java
index ab3f9a3c..9ef77615 100644
--- a/src/test/java/org/apache/commons/pool3/pool407/KeyedPool407Test.java
+++ b/src/test/java/org/apache/commons/pool3/pool407/KeyedPool407Test.java
@@ -37,7 +37,7 @@ public class KeyedPool407Test extends AbstractPool407Test {
     private static final class KeyedPool407RoundtripRunnable implements Runnable {
         private final KeyedPool407 pool;
 
-        public KeyedPool407RoundtripRunnable(final KeyedPool407 pool) {
+        KeyedPool407RoundtripRunnable(final KeyedPool407 pool) {
             this.pool = pool;
         }
 
@@ -56,7 +56,8 @@ public class KeyedPool407Test extends AbstractPool407Test {
 
     private static final String KEY = "key";
 
-    protected void assertShutdown(final ExecutorService executor, final Duration poolConfigMaxWait, final AbstractKeyedPool407Factory factory) throws InterruptedException {
+    protected void assertShutdown(final ExecutorService executor, final Duration poolConfigMaxWait, final AbstractKeyedPool407Factory factory)
+            throws InterruptedException {
         // Old note: This never finishes when the factory makes nulls because two threads are stuck forever
         // If a factory always returns a null object or a null poolable object, then we will wait forever.
         // This would also be true is object validation always fails.
@@ -72,7 +73,7 @@ public class KeyedPool407Test extends AbstractPool407Test {
 
     private void test(final AbstractKeyedPool407Factory factory, final int poolSize, final Duration poolConfigMaxWait) throws InterruptedException {
         final ExecutorService executor = Executors.newFixedThreadPool(poolSize);
-        try (final KeyedPool407 pool = new KeyedPool407(factory, poolConfigMaxWait)) {
+        try (KeyedPool407 pool = new KeyedPool407(factory, poolConfigMaxWait)) {
             // Start 'poolSize' threads that try to borrow a Pool407Fixture with the same key
             for (int i = 0; i < poolSize; i++) {
                 executor.execute(new KeyedPool407RoundtripRunnable(pool));
diff --git a/src/test/java/org/apache/commons/pool3/pool407/Pool407NormalFactory.java b/src/test/java/org/apache/commons/pool3/pool407/Pool407NormalFactory.java
index d62079cc..e93381dc 100644
--- a/src/test/java/org/apache/commons/pool3/pool407/Pool407NormalFactory.java
+++ b/src/test/java/org/apache/commons/pool3/pool407/Pool407NormalFactory.java
@@ -37,7 +37,8 @@ public final class Pool407NormalFactory extends AbstractPool407Factory {
         //
         // Old note:
         // This is key to the test, creation failed and returns null for instance see
-        // https://github.com/openhab/openhab-core/blob/main/bundles/org.openhab.core.io.transport.modbus/src/main/java/org/openhab/core/io/transport/modbus/internal/pooling/ModbusSlaveConnectionFactoryImpl.java#L163
+        // https://github.com/openhab/openhab-core/blob/main/bundles/org.openhab.core.io.transport.modbus/
+        // src/main/java/org/openhab/core/io/transport/modbus/internal/pooling/ModbusSlaveConnectionFactoryImpl.java#L163
         // the test passes when this returns new Pool407Fixture();
         return fixture;
     }
diff --git a/src/test/java/org/apache/commons/pool3/pool407/Pool407Test.java b/src/test/java/org/apache/commons/pool3/pool407/Pool407Test.java
index 9dade557..68ed173e 100644
--- a/src/test/java/org/apache/commons/pool3/pool407/Pool407Test.java
+++ b/src/test/java/org/apache/commons/pool3/pool407/Pool407Test.java
@@ -37,7 +37,7 @@ public class Pool407Test extends AbstractPool407Test {
     private static final class Pool407RoundtripRunnable implements Runnable {
         private final Pool407 pool;
 
-        public Pool407RoundtripRunnable(final Pool407 pool) {
+        Pool407RoundtripRunnable(final Pool407 pool) {
             this.pool = pool;
         }
 
@@ -54,7 +54,8 @@ public class Pool407Test extends AbstractPool407Test {
         }
     }
 
-    protected void assertShutdown(final ExecutorService executor, final Duration poolConfigMaxWait, final AbstractPool407Factory factory) throws InterruptedException {
+    protected void assertShutdown(final ExecutorService executor, final Duration poolConfigMaxWait, final AbstractPool407Factory factory)
+            throws InterruptedException {
         // Old note: This never finishes when the factory makes nulls because two threads are stuck forever
         // If a factory always returns a null object or a null poolable object, then we will wait forever.
         // This would also be true is object validation always fails.
@@ -70,7 +71,7 @@ public class Pool407Test extends AbstractPool407Test {
 
     private void test(final AbstractPool407Factory factory, final int poolSize, final Duration poolConfigMaxWait) throws InterruptedException {
         final ExecutorService executor = Executors.newFixedThreadPool(poolSize);
-        try (final Pool407 pool = new Pool407(factory, poolConfigMaxWait)) {
+        try (Pool407 pool = new Pool407(factory, poolConfigMaxWait)) {
             // Start 'poolSize' threads that try to borrow a Pool407Fixture with the same key
             for (int i = 0; i < poolSize; i++) {
                 executor.execute(new Pool407RoundtripRunnable(pool));