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 bd89c9d2 Use JUnit 5 convention for test method visibility bd89c9d2 is described below commit bd89c9d23679983738c353f27f51868473abb131 Author: Gary D. Gregory <garydgreg...@gmail.com> AuthorDate: Sat Jun 7 18:22:54 2025 -0400 Use JUnit 5 convention for test method visibility --- .../commons/pool3/AbstractTestKeyedObjectPool.java | 30 ++-- .../commons/pool3/AbstractTestObjectPool.java | 16 +- .../java/org/apache/commons/pool3/PoolTest.java | 2 +- .../pool3/TestBaseKeyedPooledObjectFactory.java | 2 +- .../apache/commons/pool3/TestBaseObjectPool.java | 18 +-- .../pool3/TestBasePoolableObjectFactory.java | 4 +- .../org/apache/commons/pool3/TestPoolUtils.java | 32 ++-- .../org/apache/commons/pool3/TestTrackedUse.java | 2 +- .../apache/commons/pool3/impl/CallStackTest.java | 4 +- .../commons/pool3/impl/NoOpCallStackTest.java | 2 +- .../pool3/impl/TestAbandonedKeyedObjectPool.java | 16 +- .../pool3/impl/TestAbandonedObjectPool.java | 16 +- .../pool3/impl/TestBaseGenericObjectPool.java | 10 +- .../commons/pool3/impl/TestCallStackUtils.java | 2 +- .../pool3/impl/TestDefaultPooledObject.java | 10 +- .../pool3/impl/TestDefaultPooledObjectInfo.java | 8 +- .../commons/pool3/impl/TestEvictionConfig.java | 4 +- .../commons/pool3/impl/TestEvictionTimer.java | 2 +- .../pool3/impl/TestGenericKeyedObjectPool.java | 132 ++++++++-------- .../commons/pool3/impl/TestGenericObjectPool.java | 166 ++++++++++----------- .../impl/TestGenericObjectPoolClassLoaders.java | 2 +- .../TestGenericObjectPoolFactoryCreateFailure.java | 2 +- .../pool3/impl/TestLinkedBlockingDeque.java | 80 +++++----- .../commons/pool3/impl/TestPoolImplUtils.java | 12 +- .../pool3/impl/TestPooledSoftReference.java | 4 +- .../impl/TestResilientPooledObjectFactory.java | 10 +- .../commons/pool3/impl/TestSoftRefOutOfMemory.java | 8 +- .../commons/pool3/pool407/KeyedPool407Test.java | 12 +- .../apache/commons/pool3/pool407/Pool407Test.java | 12 +- .../proxy/AbstractTestProxiedKeyedObjectPool.java | 12 +- .../pool3/proxy/AbstractTestProxiedObjectPool.java | 16 +- 31 files changed, 324 insertions(+), 324 deletions(-) diff --git a/src/test/java/org/apache/commons/pool3/AbstractTestKeyedObjectPool.java b/src/test/java/org/apache/commons/pool3/AbstractTestKeyedObjectPool.java index 944b1bea..31410e50 100644 --- a/src/test/java/org/apache/commons/pool3/AbstractTestKeyedObjectPool.java +++ b/src/test/java/org/apache/commons/pool3/AbstractTestKeyedObjectPool.java @@ -235,7 +235,7 @@ public abstract class AbstractTestKeyedObjectPool { } @Test - public void testBaseAddObject() { + void testBaseAddObject() { try { pool = makeEmptyPool(3); } catch (final UnsupportedOperationException uoe) { @@ -271,7 +271,7 @@ public abstract class AbstractTestKeyedObjectPool { } @Test - public void testBaseBorrow() { + void testBaseBorrow() { try { pool = makeEmptyPool(3); } catch (final UnsupportedOperationException uoe) { @@ -289,7 +289,7 @@ public abstract class AbstractTestKeyedObjectPool { } @Test - public void testBaseBorrowReturn() { + void testBaseBorrowReturn() { try { pool = makeEmptyPool(3); } catch (final UnsupportedOperationException uoe) { @@ -328,7 +328,7 @@ public abstract class AbstractTestKeyedObjectPool { } @Test - public void testBaseClear() { + void testBaseClear() { try { pool = makeEmptyPool(3); } catch (final UnsupportedOperationException uoe) { @@ -354,7 +354,7 @@ public abstract class AbstractTestKeyedObjectPool { } @Test - public void testBaseInvalidateObject() { + void testBaseInvalidateObject() { try { pool = makeEmptyPool(3); } catch (final UnsupportedOperationException uoe) { @@ -377,7 +377,7 @@ public abstract class AbstractTestKeyedObjectPool { } @Test - public void testBaseNumActiveNumIdle() { + void testBaseNumActiveNumIdle() { try { pool = makeEmptyPool(3); } catch (final UnsupportedOperationException uoe) { @@ -406,7 +406,7 @@ public abstract class AbstractTestKeyedObjectPool { } @Test - public void testBaseNumActiveNumIdle2() { + void testBaseNumActiveNumIdle2() { try { pool = makeEmptyPool(6); } catch (final UnsupportedOperationException uoe) { @@ -465,7 +465,7 @@ public abstract class AbstractTestKeyedObjectPool { } @Test - public void testClosedPoolBehavior() { + void testClosedPoolBehavior() { final KeyedObjectPool<Object, Object, RuntimeException> pool; try { pool = makeEmptyPool(new TestFactory()); @@ -498,7 +498,7 @@ public abstract class AbstractTestKeyedObjectPool { } @Test - public void testKPOFAddObjectUsage() { + void testKPOFAddObjectUsage() { final FailingKeyedPooledObjectFactory factory = new FailingKeyedPooledObjectFactory(); final KeyedObjectPool<Object, Object, PrivateException> pool; try { @@ -536,7 +536,7 @@ public abstract class AbstractTestKeyedObjectPool { } @Test - public void testKPOFBorrowObjectUsages() { + void testKPOFBorrowObjectUsages() { final FailingKeyedPooledObjectFactory factory = new FailingKeyedPooledObjectFactory(); final KeyedObjectPool<Object, Object, PrivateException> pool; try { @@ -607,7 +607,7 @@ public abstract class AbstractTestKeyedObjectPool { } @Test - public void testKPOFClearUsages() { + void testKPOFClearUsages() { final FailingKeyedPooledObjectFactory factory = new FailingKeyedPooledObjectFactory(); final KeyedObjectPool<Object, Object, PrivateException> pool; try { @@ -630,7 +630,7 @@ public abstract class AbstractTestKeyedObjectPool { } @Test - public void testKPOFCloseUsages() { + void testKPOFCloseUsages() { final FailingKeyedPooledObjectFactory factory = new FailingKeyedPooledObjectFactory(); final KeyedObjectPool<Object, Object, PrivateException> pool; try { @@ -653,7 +653,7 @@ public abstract class AbstractTestKeyedObjectPool { } @Test - public void testKPOFInvalidateObjectUsages() throws InterruptedException { + void testKPOFInvalidateObjectUsages() throws InterruptedException { final FailingKeyedPooledObjectFactory factory = new FailingKeyedPooledObjectFactory(); final KeyedObjectPool<Object, Object, PrivateException> pool; try { @@ -686,7 +686,7 @@ public abstract class AbstractTestKeyedObjectPool { } @Test - public void testKPOFReturnObjectUsages() { + void testKPOFReturnObjectUsages() { final FailingKeyedPooledObjectFactory factory = new FailingKeyedPooledObjectFactory(); final KeyedObjectPool<Object, Object, PrivateException> pool; try { @@ -744,7 +744,7 @@ public abstract class AbstractTestKeyedObjectPool { } @Test - public void testToString() { + void testToString() { final FailingKeyedPooledObjectFactory factory = new FailingKeyedPooledObjectFactory(); try (KeyedObjectPool<Object, Object, PrivateException> pool = makeEmptyPool(factory)) { pool.toString(); diff --git a/src/test/java/org/apache/commons/pool3/AbstractTestObjectPool.java b/src/test/java/org/apache/commons/pool3/AbstractTestObjectPool.java index 12325271..2c19bab3 100644 --- a/src/test/java/org/apache/commons/pool3/AbstractTestObjectPool.java +++ b/src/test/java/org/apache/commons/pool3/AbstractTestObjectPool.java @@ -70,7 +70,7 @@ public abstract class AbstractTestObjectPool { protected abstract <E extends Exception> ObjectPool<Object, E> makeEmptyPool(PooledObjectFactory<Object, E> factory) throws UnsupportedOperationException; @Test - public void testClosedPoolBehavior() throws Exception { + void testClosedPoolBehavior() throws Exception { final ObjectPool<Object, PrivateException> pool; try { pool = makeEmptyPool(new MethodCallPoolableObjectFactory()); @@ -112,7 +112,7 @@ public abstract class AbstractTestObjectPool { } @Test - public void testPOFAddObjectUsage() throws Exception { + void testPOFAddObjectUsage() throws Exception { final MethodCallPoolableObjectFactory factory = new MethodCallPoolableObjectFactory(); final ObjectPool<Object, PrivateException> pool; try { @@ -163,7 +163,7 @@ public abstract class AbstractTestObjectPool { } @Test - public void testPOFBorrowObjectUsages() throws Exception { + void testPOFBorrowObjectUsages() throws Exception { final MethodCallPoolableObjectFactory factory = new MethodCallPoolableObjectFactory(); final ObjectPool<Object, PrivateException> pool; try { @@ -233,7 +233,7 @@ public abstract class AbstractTestObjectPool { } @Test - public void testPOFClearUsages() throws Exception { + void testPOFClearUsages() throws Exception { final MethodCallPoolableObjectFactory factory = new MethodCallPoolableObjectFactory(); final ObjectPool<Object, PrivateException> pool; try { @@ -256,7 +256,7 @@ public abstract class AbstractTestObjectPool { } @Test - public void testPOFCloseUsages() throws Exception { + void testPOFCloseUsages() throws Exception { final MethodCallPoolableObjectFactory factory = new MethodCallPoolableObjectFactory(); ObjectPool<Object, PrivateException> pool; try { @@ -283,7 +283,7 @@ public abstract class AbstractTestObjectPool { } @Test - public void testPOFInvalidateObjectUsages() throws Exception { + void testPOFInvalidateObjectUsages() throws Exception { final MethodCallPoolableObjectFactory factory = new MethodCallPoolableObjectFactory(); final ObjectPool<Object, PrivateException> pool; try { @@ -316,7 +316,7 @@ public abstract class AbstractTestObjectPool { } @Test - public void testPOFReturnObjectUsages() throws Exception { + void testPOFReturnObjectUsages() throws Exception { final MethodCallPoolableObjectFactory factory = new MethodCallPoolableObjectFactory(); final ObjectPool<Object, PrivateException> pool; try { @@ -376,7 +376,7 @@ public abstract class AbstractTestObjectPool { } @Test - public void testToString() { + void testToString() { final ObjectPool<Object, PrivateException> pool; try { pool = makeEmptyPool(new MethodCallPoolableObjectFactory()); diff --git a/src/test/java/org/apache/commons/pool3/PoolTest.java b/src/test/java/org/apache/commons/pool3/PoolTest.java index 867f0884..4029f814 100644 --- a/src/test/java/org/apache/commons/pool3/PoolTest.java +++ b/src/test/java/org/apache/commons/pool3/PoolTest.java @@ -72,7 +72,7 @@ public class PoolTest { private static final Duration EVICTION_DURATION = Duration.ofMillis(100); @Test - public void testPool() { + void testPool() { final GenericObjectPoolConfig<Foo> poolConfig = new GenericObjectPoolConfig<>(); poolConfig.setTestWhileIdle(true /* testWhileIdle */); final PooledFooFactory pooledFooFactory = new PooledFooFactory(); diff --git a/src/test/java/org/apache/commons/pool3/TestBaseKeyedPooledObjectFactory.java b/src/test/java/org/apache/commons/pool3/TestBaseKeyedPooledObjectFactory.java index 38b60824..e469930c 100644 --- a/src/test/java/org/apache/commons/pool3/TestBaseKeyedPooledObjectFactory.java +++ b/src/test/java/org/apache/commons/pool3/TestBaseKeyedPooledObjectFactory.java @@ -38,7 +38,7 @@ public class TestBaseKeyedPooledObjectFactory { } @Test - public void testDefaultMethods() { + void testDefaultMethods() { final KeyedPooledObjectFactory<Object, Object, RuntimeException> factory = new TestFactory(); factory.activateObject("key", null); // a no-op diff --git a/src/test/java/org/apache/commons/pool3/TestBaseObjectPool.java b/src/test/java/org/apache/commons/pool3/TestBaseObjectPool.java index f3c609bb..d3a1b0a5 100644 --- a/src/test/java/org/apache/commons/pool3/TestBaseObjectPool.java +++ b/src/test/java/org/apache/commons/pool3/TestBaseObjectPool.java @@ -92,7 +92,7 @@ public class TestBaseObjectPool extends AbstractTestObjectPool { } @Test - public void testBaseAddObject() { + void testBaseAddObject() { try { pool = makeEmptyPool(3); } catch (final UnsupportedOperationException e) { @@ -119,7 +119,7 @@ public class TestBaseObjectPool extends AbstractTestObjectPool { } @Test - public void testBaseBorrow() { + void testBaseBorrow() { try { pool = makeEmptyPool(3); } catch (final UnsupportedOperationException e) { @@ -132,7 +132,7 @@ public class TestBaseObjectPool extends AbstractTestObjectPool { } @Test - public void testBaseBorrowReturn() { + void testBaseBorrowReturn() { try { pool = makeEmptyPool(3); } catch (final UnsupportedOperationException e) { @@ -171,7 +171,7 @@ public class TestBaseObjectPool extends AbstractTestObjectPool { } @Test - public void testBaseClear() { + void testBaseClear() { try { pool = makeEmptyPool(3); } catch (final UnsupportedOperationException e) { @@ -196,7 +196,7 @@ public class TestBaseObjectPool extends AbstractTestObjectPool { } @Test - public void testBaseClosePool() { + void testBaseClosePool() { try { pool = makeEmptyPool(3); } catch (final UnsupportedOperationException e) { @@ -210,7 +210,7 @@ public class TestBaseObjectPool extends AbstractTestObjectPool { } @Test - public void testBaseInvalidateObject() { + void testBaseInvalidateObject() { try { pool = makeEmptyPool(3); } catch (final UnsupportedOperationException e) { @@ -232,7 +232,7 @@ public class TestBaseObjectPool extends AbstractTestObjectPool { } @Test - public void testBaseNumActiveNumIdle() { + void testBaseNumActiveNumIdle() { try { pool = makeEmptyPool(3); } catch (final UnsupportedOperationException e) { @@ -256,7 +256,7 @@ public class TestBaseObjectPool extends AbstractTestObjectPool { } @Test - public void testClose() { + void testClose() { @SuppressWarnings("resource") final ObjectPool<Object, RuntimeException> pool = new TestObjectPool(); @@ -265,7 +265,7 @@ public class TestBaseObjectPool extends AbstractTestObjectPool { } @Test - public void testUnsupportedOperations() { + void testUnsupportedOperations() { if (!getClass().equals(TestBaseObjectPool.class)) { return; // skip redundant tests } diff --git a/src/test/java/org/apache/commons/pool3/TestBasePoolableObjectFactory.java b/src/test/java/org/apache/commons/pool3/TestBasePoolableObjectFactory.java index e494785a..2c6ddd85 100644 --- a/src/test/java/org/apache/commons/pool3/TestBasePoolableObjectFactory.java +++ b/src/test/java/org/apache/commons/pool3/TestBasePoolableObjectFactory.java @@ -48,7 +48,7 @@ public class TestBasePoolableObjectFactory { } @Test - public void testDefaultMethods() { + void testDefaultMethods() { final PooledObjectFactory<AtomicInteger, RuntimeException> factory = new TestFactory(); factory.activateObject(null); // a no-op @@ -64,7 +64,7 @@ public class TestBasePoolableObjectFactory { * @throws RuntimeException May occur in some failure modes */ @Test - public void testDestroyModes() { + void testDestroyModes() { final PooledObjectFactory<AtomicInteger, RuntimeException> factory = new TestFactory(); final PooledObject<AtomicInteger> pooledObj = factory.makeObject(); final AtomicInteger obj = pooledObj.getObject(); diff --git a/src/test/java/org/apache/commons/pool3/TestPoolUtils.java b/src/test/java/org/apache/commons/pool3/TestPoolUtils.java index 1f48fecd..26398da8 100644 --- a/src/test/java/org/apache/commons/pool3/TestPoolUtils.java +++ b/src/test/java/org/apache/commons/pool3/TestPoolUtils.java @@ -154,7 +154,7 @@ public class TestPoolUtils { } @Test - public void testCheckMinIdleKeyedObjectPool() throws InterruptedException { + void testCheckMinIdleKeyedObjectPool() throws InterruptedException { assertThrows(IllegalArgumentException.class, () -> PoolUtils.checkMinIdle(null, new Object(), 1, 1), "PoolUtils.checkMinIdle(KeyedObjectPool,Object,int,long) must not allow null pool."); try (@SuppressWarnings("unchecked") @@ -222,7 +222,7 @@ public class TestPoolUtils { } @Test - public void testCheckMinIdleKeyedObjectPoolKeys() throws InterruptedException { + void testCheckMinIdleKeyedObjectPoolKeys() throws InterruptedException { // Because this isn't deterministic and you can get false failures, try more than once. AssertionFailedError afe = null; int triesLeft = 3; @@ -256,7 +256,7 @@ public class TestPoolUtils { } @Test - public void testCheckMinIdleKeyedObjectPoolKeysNulls() { + void testCheckMinIdleKeyedObjectPoolKeysNulls() { try (@SuppressWarnings("unchecked") KeyedObjectPool<Object, Object, RuntimeException> pool = createProxy(KeyedObjectPool.class, (List<String>) null)) { assertThrows(IllegalArgumentException.class, () -> PoolUtils.checkMinIdle(pool, (Collection<?>) null, 1, 1), @@ -272,7 +272,7 @@ public class TestPoolUtils { } @Test - public void testCheckMinIdleObjectPool() throws InterruptedException { + void testCheckMinIdleObjectPool() throws InterruptedException { assertThrows(IllegalArgumentException.class, () -> PoolUtils.checkMinIdle(null, 1, 1), "PoolUtils.checkMinIdle(ObjectPool,,) must not allow null pool."); try (@SuppressWarnings("unchecked") @@ -332,7 +332,7 @@ public class TestPoolUtils { } @Test - public void testCheckRethrow() { + void testCheckRethrow() { assertDoesNotThrow(() -> PoolUtils.checkRethrow(new Exception()), "PoolUtils.checkRethrow(Throwable) must rethrow only ThreadDeath and VirtualMachineError."); assertThrows(ThreadDeath.class, () -> PoolUtils.checkRethrow(new ThreadDeath()), @@ -342,7 +342,7 @@ public class TestPoolUtils { } @Test - public void testErodingObjectPoolDefaultFactor() { + void testErodingObjectPoolDefaultFactor() { try (@SuppressWarnings("unchecked") ObjectPool<Object, RuntimeException> internalPool = createProxy(ObjectPool.class, (arg0, arg1, arg2) -> null); ObjectPool<Object, RuntimeException> pool = PoolUtils.erodingPool(internalPool)) { @@ -355,7 +355,7 @@ public class TestPoolUtils { } @Test - public void testErodingPerKeyKeyedObjectPool() throws InterruptedException { + void testErodingPerKeyKeyedObjectPool() throws InterruptedException { assertThrows(IllegalArgumentException.class, () -> PoolUtils.erodingPool((KeyedObjectPool<Object, Object, RuntimeException>) null, 1f, true), "PoolUtils.erodingPool(KeyedObjectPool) must not allow a null pool."); @@ -427,7 +427,7 @@ public class TestPoolUtils { } @Test - public void testErodingPoolKeyedObjectPool() throws InterruptedException { + void testErodingPoolKeyedObjectPool() throws InterruptedException { assertThrows(IllegalArgumentException.class, () -> PoolUtils.erodingPool((KeyedObjectPool<Object, Object, RuntimeException>) null), "PoolUtils.erodingPool(KeyedObjectPool) must not allow a null pool."); @@ -514,7 +514,7 @@ public class TestPoolUtils { } @Test - public void testErodingPoolKeyedObjectPoolDefaultFactor() { + void testErodingPoolKeyedObjectPoolDefaultFactor() { try (@SuppressWarnings("unchecked") KeyedObjectPool<Object, Object, RuntimeException> internalPool = createProxy(KeyedObjectPool.class, (arg0, arg1, arg2) -> null); KeyedObjectPool<Object, Object, RuntimeException> pool = PoolUtils.erodingPool(internalPool)) { @@ -526,7 +526,7 @@ public class TestPoolUtils { } @Test - public void testErodingPoolObjectPool() throws InterruptedException { + void testErodingPoolObjectPool() throws InterruptedException { assertThrows(IllegalArgumentException.class, () -> PoolUtils.erodingPool((ObjectPool<Object, RuntimeException>) null), "PoolUtils.erodingPool(ObjectPool) must not allow a null pool."); @@ -605,12 +605,12 @@ public class TestPoolUtils { } @Test - public void testJavaBeanInstantiation() { + void testJavaBeanInstantiation() { assertNotNull(new PoolUtils()); } @Test - public void testSynchronizedPoolableFactoryKeyedPooledObjectFactory() { + void testSynchronizedPoolableFactoryKeyedPooledObjectFactory() { assertThrows(IllegalArgumentException.class, () -> PoolUtils.synchronizedKeyedPooledFactory((KeyedPooledObjectFactory<Object, Object, RuntimeException>) null), "PoolUtils.synchronizedPoolableFactory(KeyedPooledObjectFactory) must not allow a null factory."); @@ -627,7 +627,7 @@ public class TestPoolUtils { } @Test - public void testSynchronizedPoolableFactoryPoolableObjectFactory() throws Exception { + void testSynchronizedPoolableFactoryPoolableObjectFactory() throws Exception { assertThrows(IllegalArgumentException.class, () -> PoolUtils.synchronizedPooledFactory((PooledObjectFactory<Object, Exception>) null), "PoolUtils.synchronizedPoolableFactory(PoolableObjectFactory) must not allow a null factory."); @@ -643,7 +643,7 @@ public class TestPoolUtils { } @Test - public void testSynchronizedPoolKeyedObjectPool() { + void testSynchronizedPoolKeyedObjectPool() { assertThrows(IllegalArgumentException.class, () -> PoolUtils.synchronizedPool((KeyedObjectPool<Object, Object, RuntimeException>) null), "PoolUtils.synchronizedPool(KeyedObjectPool) must not allow a null pool."); @@ -659,7 +659,7 @@ public class TestPoolUtils { } @Test - public void testSynchronizedPoolObjectPool() { + void testSynchronizedPoolObjectPool() { assertThrows(IllegalArgumentException.class, () -> PoolUtils.synchronizedPool((ObjectPool<Object, RuntimeException>) null), "PoolUtils.synchronizedPool(ObjectPool) must not allow a null pool."); @@ -678,7 +678,7 @@ public class TestPoolUtils { * Tests the {@link PoolUtils} timer holder. */ @Test - public void testTimerHolder() { + void testTimerHolder() { final PoolUtils.TimerHolder h = new PoolUtils.TimerHolder(); assertNotNull(h); assertNotNull(PoolUtils.TimerHolder.MIN_IDLE_TIMER); diff --git a/src/test/java/org/apache/commons/pool3/TestTrackedUse.java b/src/test/java/org/apache/commons/pool3/TestTrackedUse.java index 142d5f44..cbb940ce 100644 --- a/src/test/java/org/apache/commons/pool3/TestTrackedUse.java +++ b/src/test/java/org/apache/commons/pool3/TestTrackedUse.java @@ -35,7 +35,7 @@ public class TestTrackedUse { } @Test - public void testDefaultGetLastUsedInstant() { + void testDefaultGetLastUsedInstant() { assertEquals(Instant.ofEpochMilli(1), new DefaultTrackedUse().getLastUsedInstant()); } } 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 dda16bca..10be006c 100644 --- a/src/test/java/org/apache/commons/pool3/impl/CallStackTest.java +++ b/src/test/java/org/apache/commons/pool3/impl/CallStackTest.java @@ -44,7 +44,7 @@ public class CallStackTest { @ParameterizedTest @MethodSource("data") - public void testPrintClearedStackTraceIsNoOp(final CallStack stack) { + void testPrintClearedStackTraceIsNoOp(final CallStack stack) { stack.fillInStackTrace(); stack.clear(); stack.printStackTrace(new PrintWriter(writer)); @@ -54,7 +54,7 @@ public class CallStackTest { @ParameterizedTest @MethodSource("data") - public void testPrintFilledStackTrace(final CallStack stack) { + void testPrintFilledStackTrace(final CallStack stack) { stack.fillInStackTrace(); stack.printStackTrace(new PrintWriter(writer)); final String stackTrace = writer.toString(); 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 2feaee23..704c683f 100644 --- a/src/test/java/org/apache/commons/pool3/impl/NoOpCallStackTest.java +++ b/src/test/java/org/apache/commons/pool3/impl/NoOpCallStackTest.java @@ -25,7 +25,7 @@ import org.junit.jupiter.api.Test; public class NoOpCallStackTest { @Test - public void testPrintStackTraceIsNoOp() { + void testPrintStackTraceIsNoOp() { final CallStack stack = NoOpCallStack.INSTANCE; stack.fillInStackTrace(); final StringWriter writer = new StringWriter(); 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 213240e8..1fbd77c2 100644 --- a/src/test/java/org/apache/commons/pool3/impl/TestAbandonedKeyedObjectPool.java +++ b/src/test/java/org/apache/commons/pool3/impl/TestAbandonedKeyedObjectPool.java @@ -190,7 +190,7 @@ public class TestAbandonedKeyedObjectPool { * @throws InterruptedException May occur in some failure modes */ @Test - public void testAbandonedInvalidate() throws InterruptedException { + void testAbandonedInvalidate() throws InterruptedException { abandonedConfig = new AbandonedConfig(); abandonedConfig.setRemoveAbandonedOnMaintenance(true); abandonedConfig.setRemoveAbandonedTimeout(Duration.ofMillis(2000)); @@ -229,7 +229,7 @@ public class TestAbandonedKeyedObjectPool { * @throws Exception May occur in some failure modes */ @Test - public void testAbandonedReturn() throws Exception { + void testAbandonedReturn() throws Exception { abandonedConfig = new AbandonedConfig(); abandonedConfig.setRemoveAbandonedOnBorrow(true); abandonedConfig.setRemoveAbandonedTimeout(TestConstants.ONE_SECOND_DURATION); @@ -264,7 +264,7 @@ public class TestAbandonedKeyedObjectPool { * @throws Exception May occur in some failure modes */ @Test - public void testConcurrentInvalidation() throws Exception { + void testConcurrentInvalidation() throws Exception { final int POOL_SIZE = 30; pool.setMaxTotalPerKey(POOL_SIZE); pool.setMaxIdlePerKey(POOL_SIZE); @@ -305,7 +305,7 @@ public class TestAbandonedKeyedObjectPool { assertEquals(0, pool.getNumActive(), "numActive should have been 0, was " + pool.getNumActive()); } - public void testDestroyModeAbandoned() throws Exception { + void testDestroyModeAbandoned() throws Exception { abandonedConfig = new AbandonedConfig(); abandonedConfig.setRemoveAbandonedOnMaintenance(true); abandonedConfig.setRemoveAbandonedTimeout(TestConstants.ONE_SECOND_DURATION); @@ -321,7 +321,7 @@ public class TestAbandonedKeyedObjectPool { assertTrue(obj.isDetached()); } - public void testDestroyModeNormal() throws Exception { + void testDestroyModeNormal() throws Exception { abandonedConfig = new AbandonedConfig(); pool.close(); // Unregister pool created by setup pool = new GenericKeyedObjectPool<>(new SimpleFactory(0, 0)); @@ -339,7 +339,7 @@ public class TestAbandonedKeyedObjectPool { * @throws Exception May occur in some failure modes */ @Test - public void testRemoveAbandonedWhileReturning() throws Exception { + void testRemoveAbandonedWhileReturning() throws Exception { abandonedConfig = new AbandonedConfig(); abandonedConfig.setRemoveAbandonedOnMaintenance(true); abandonedConfig.setRemoveAbandonedTimeout(TestConstants.ONE_SECOND_DURATION); @@ -368,7 +368,7 @@ public class TestAbandonedKeyedObjectPool { * JIRA: POOL-300 */ @Test - public void testStackTrace() throws Exception { + void testStackTrace() throws Exception { abandonedConfig.setRemoveAbandonedOnMaintenance(true); abandonedConfig.setLogAbandoned(true); abandonedConfig.setRemoveAbandonedTimeout(TestConstants.ONE_SECOND_DURATION); @@ -395,7 +395,7 @@ public class TestAbandonedKeyedObjectPool { * @throws Exception May occur in some failure modes */ @Test - public void testWhenExhaustedBlock() throws Exception { + void testWhenExhaustedBlock() throws Exception { abandonedConfig.setRemoveAbandonedOnMaintenance(true); pool.setAbandonedConfig(abandonedConfig); pool.setDurationBetweenEvictionRuns(Duration.ofMillis(500)); 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 ac95b74c..f1390da6 100644 --- a/src/test/java/org/apache/commons/pool3/impl/TestAbandonedObjectPool.java +++ b/src/test/java/org/apache/commons/pool3/impl/TestAbandonedObjectPool.java @@ -261,7 +261,7 @@ public class TestAbandonedObjectPool { * @throws Exception May occur in some failure modes */ @Test - public void testAbandonedInvalidate() throws Exception { + void testAbandonedInvalidate() throws Exception { abandonedConfig = new AbandonedConfig(); abandonedConfig.setRemoveAbandonedOnMaintenance(true); abandonedConfig.setRemoveAbandonedTimeout(TestConstants.ONE_SECOND_DURATION); @@ -293,7 +293,7 @@ public class TestAbandonedObjectPool { * @throws Exception May occur in some failure modes */ @Test - public void testAbandonedReturn() throws Exception { + void testAbandonedReturn() throws Exception { abandonedConfig = new AbandonedConfig(); abandonedConfig.setRemoveAbandonedOnBorrow(true); abandonedConfig.setRemoveAbandonedTimeout(TestConstants.ONE_SECOND_DURATION); @@ -328,7 +328,7 @@ public class TestAbandonedObjectPool { * @throws Exception May occur in some failure modes */ @Test - public void testConcurrentInvalidation() throws Exception { + void testConcurrentInvalidation() throws Exception { final int POOL_SIZE = 30; pool.setMaxTotal(POOL_SIZE); pool.setMaxIdle(POOL_SIZE); @@ -369,7 +369,7 @@ public class TestAbandonedObjectPool { assertEquals(0, pool.getNumActive(), "numActive should have been 0, was " + pool.getNumActive()); } - public void testDestroyModeAbandoned() throws Exception { + void testDestroyModeAbandoned() throws Exception { abandonedConfig = new AbandonedConfig(); abandonedConfig.setRemoveAbandonedOnMaintenance(true); abandonedConfig.setRemoveAbandonedTimeout(TestConstants.ONE_SECOND_DURATION); @@ -385,7 +385,7 @@ public class TestAbandonedObjectPool { assertTrue(obj.isDetached()); } - public void testDestroyModeNormal() throws Exception { + void testDestroyModeNormal() throws Exception { abandonedConfig = new AbandonedConfig(); pool.close(); // Unregister pool created by setup pool = new GenericObjectPool<>(new SimpleFactory(0, 0)); @@ -403,7 +403,7 @@ public class TestAbandonedObjectPool { * @throws Exception May occur in some failure modes */ @Test - public void testRemoveAbandonedWhileReturning() throws Exception { + void testRemoveAbandonedWhileReturning() throws Exception { abandonedConfig = new AbandonedConfig(); abandonedConfig.setRemoveAbandonedOnMaintenance(true); abandonedConfig.setRemoveAbandonedTimeout(TestConstants.ONE_SECOND_DURATION); @@ -432,7 +432,7 @@ public class TestAbandonedObjectPool { * JIRA: POOL-300 */ @Test - public void testStackTrace() throws Exception { + void testStackTrace() throws Exception { abandonedConfig.setRemoveAbandonedOnMaintenance(true); abandonedConfig.setLogAbandoned(true); abandonedConfig.setRemoveAbandonedTimeout(TestConstants.ONE_SECOND_DURATION); @@ -463,7 +463,7 @@ public class TestAbandonedObjectPool { * @throws Exception May occur in some failure modes */ @Test - public void testWhenExhaustedBlock() throws Exception { + void testWhenExhaustedBlock() throws Exception { abandonedConfig.setRemoveAbandonedOnMaintenance(true); pool.setAbandonedConfig(abandonedConfig); pool.setDurationBetweenEvictionRuns(Duration.ofMillis(500)); 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 6fe8668d..87f7d797 100644 --- a/src/test/java/org/apache/commons/pool3/impl/TestBaseGenericObjectPool.java +++ b/src/test/java/org/apache/commons/pool3/impl/TestBaseGenericObjectPool.java @@ -58,7 +58,7 @@ public class TestBaseGenericObjectPool { } @Test - public void testActiveTimeStatistics() { + void testActiveTimeStatistics() { for (int i = 0; i < 99; i++) { // must be < MEAN_TIMING_STATS_CACHE_SIZE pool.updateStatsReturn(Duration.ofMillis(i)); } @@ -66,7 +66,7 @@ public class TestBaseGenericObjectPool { } @Test - public void testBorrowWaitStatistics() { + void testBorrowWaitStatistics() { final DefaultPooledObject<String> p = (DefaultPooledObject<String>) factory.makeObject(); pool.updateStatsBorrow(p, Duration.ofMillis(10)); pool.updateStatsBorrow(p, Duration.ofMillis(20)); @@ -76,7 +76,7 @@ public class TestBaseGenericObjectPool { assertEquals(30, pool.getMaxBorrowWaitTimeMillis(), 0); } - public void testBorrowWaitStatisticsMax() { + void testBorrowWaitStatisticsMax() { final DefaultPooledObject<String> p = (DefaultPooledObject<String>) factory.makeObject(); assertEquals(0, pool.getMaxBorrowWaitTimeMillis(), Double.MIN_VALUE); pool.updateStatsBorrow(p, Duration.ZERO); @@ -90,7 +90,7 @@ public class TestBaseGenericObjectPool { } @Test - public void testEvictionTimerMultiplePools() throws InterruptedException { + void testEvictionTimerMultiplePools() throws InterruptedException { final AtomicIntegerFactory factory = new AtomicIntegerFactory(); factory.setValidateLatency(50); try (GenericObjectPool<AtomicInteger, RuntimeException> evictingPool = new GenericObjectPool<>(factory)) { @@ -124,7 +124,7 @@ public class TestBaseGenericObjectPool { @SuppressWarnings("resource") // pools closed in finally block @Test @Timeout(value = 10_000, unit = TimeUnit.MILLISECONDS) - public void testJMXRegistrationLatency() { + void testJMXRegistrationLatency() { final int numPools = 1000; final MBeanServer mbs = ManagementFactory.getPlatformMBeanServer(); final ArrayList<GenericObjectPool<Waiter, IllegalStateException>> pools = new ArrayList<>(); diff --git a/src/test/java/org/apache/commons/pool3/impl/TestCallStackUtils.java b/src/test/java/org/apache/commons/pool3/impl/TestCallStackUtils.java index cc7e273d..6df0d483 100644 --- a/src/test/java/org/apache/commons/pool3/impl/TestCallStackUtils.java +++ b/src/test/java/org/apache/commons/pool3/impl/TestCallStackUtils.java @@ -44,7 +44,7 @@ public class TestCallStackUtils { } @Test - public void testNewCallStack3() { + void testNewCallStack3() { assertNewCallStack(CallStackUtils.newCallStack(MESSAGE_FORMAT, false, false)); assertNewCallStack(CallStackUtils.newCallStack(MESSAGE_FORMAT, false, true)); } 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 32d2978d..19d87bce 100644 --- a/src/test/java/org/apache/commons/pool3/impl/TestDefaultPooledObject.java +++ b/src/test/java/org/apache/commons/pool3/impl/TestDefaultPooledObject.java @@ -43,7 +43,7 @@ public class TestDefaultPooledObject { * @throws Exception May occur in some failure modes */ @Test - public void testGetIdleTimeMillis() throws Exception { + void testGetIdleTimeMillis() throws Exception { final DefaultPooledObject<Object> dpo = new DefaultPooledObject<>(new Object()); final AtomicBoolean negativeIdleTimeReturned = new AtomicBoolean(); final ExecutorService executor = Executors.newFixedThreadPool(Runtime.getRuntime().availableProcessors() * 3); @@ -88,7 +88,7 @@ public class TestDefaultPooledObject { } @Test - public void testInitialStateActiveDuration() throws InterruptedException { + void testInitialStateActiveDuration() throws InterruptedException { final PooledObject<Object> dpo = new DefaultPooledObject<>(new Object()); // Sleep MUST be "long enough" to test that we are not returning a negative time. // Need an API in Java 8 to get the clock granularity. @@ -104,7 +104,7 @@ public class TestDefaultPooledObject { } @Test - public void testInitialStateCreateInstant() { + void testInitialStateCreateInstant() { final PooledObject<Object> dpo = new DefaultPooledObject<>(new Object()); // In the initial state, all instants are the creation instant: last borrow, last use, last return. @@ -119,7 +119,7 @@ public class TestDefaultPooledObject { } @Test - public void testInitialStateDuration() throws InterruptedException { + void testInitialStateDuration() throws InterruptedException { final PooledObject<Object> dpo = new DefaultPooledObject<>(new Object()); final Duration duration1 = dpo.getFullDuration(); assertNotNull(duration1); @@ -133,7 +133,7 @@ public class TestDefaultPooledObject { } @Test - public void testInitialStateIdleDuration() throws InterruptedException { + void testInitialStateIdleDuration() throws InterruptedException { final PooledObject<Object> dpo = new DefaultPooledObject<>(new Object()); // Sleep MUST be "long enough" to test that we are not returning a negative time. Thread.sleep(200); 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 5fb31a96..50005ae2 100644 --- a/src/test/java/org/apache/commons/pool3/impl/TestDefaultPooledObjectInfo.java +++ b/src/test/java/org/apache/commons/pool3/impl/TestDefaultPooledObjectInfo.java @@ -29,7 +29,7 @@ import org.junit.jupiter.api.Test; public class TestDefaultPooledObjectInfo { @Test - public void testGetLastBorrowTrace() throws Exception { + void testGetLastBorrowTrace() throws Exception { final AbandonedConfig abandonedConfig = new AbandonedConfig(); abandonedConfig.setRemoveAbandonedOnBorrow(true); @@ -50,7 +50,7 @@ public class TestDefaultPooledObjectInfo { } @Test - public void testGetPooledObjectToString() throws Exception { + void testGetPooledObjectToString() throws Exception { try (GenericObjectPool<String, TestException> pool = new GenericObjectPool<>(new SimpleFactory())) { final String s1 = pool.borrowObject(); @@ -66,7 +66,7 @@ public class TestDefaultPooledObjectInfo { } @Test - public void testGetPooledObjectType() throws Exception { + void testGetPooledObjectType() throws Exception { try (GenericObjectPool<String, TestException> pool = new GenericObjectPool<>(new SimpleFactory())) { pool.borrowObject(); @@ -82,7 +82,7 @@ public class TestDefaultPooledObjectInfo { } @Test - public void testTiming() throws Exception { + void testTiming() throws Exception { 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/TestEvictionConfig.java b/src/test/java/org/apache/commons/pool3/impl/TestEvictionConfig.java index c2bb37ed..a20835c3 100644 --- a/src/test/java/org/apache/commons/pool3/impl/TestEvictionConfig.java +++ b/src/test/java/org/apache/commons/pool3/impl/TestEvictionConfig.java @@ -29,7 +29,7 @@ import org.junit.jupiter.api.Test; public class TestEvictionConfig { @Test - public void testConstructor1s() { + void testConstructor1s() { final EvictionConfig config = new EvictionConfig(Duration.ofMillis(1), Duration.ofMillis(1), 1); assertEquals(1, config.getIdleEvictDuration().toMillis()); assertEquals(1, config.getIdleSoftEvictDuration().toMillis()); @@ -39,7 +39,7 @@ public class TestEvictionConfig { } @Test - public void testConstructorZerosDurations() { + void testConstructorZerosDurations() { final EvictionConfig config = new EvictionConfig(Duration.ZERO, Duration.ZERO, 0); assertEquals(Long.MAX_VALUE, config.getIdleEvictDuration().toMillis()); assertEquals(Long.MAX_VALUE, config.getIdleSoftEvictDuration().toMillis()); 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 d6d04082..7ec66915 100644 --- a/src/test/java/org/apache/commons/pool3/impl/TestEvictionTimer.java +++ b/src/test/java/org/apache/commons/pool3/impl/TestEvictionTimer.java @@ -35,7 +35,7 @@ import org.junit.jupiter.api.Test; public class TestEvictionTimer { @Test - public void testStartStopEvictionTimer() throws Exception { + void testStartStopEvictionTimer() throws Exception { try (GenericObjectPool<String, RuntimeException> pool = new GenericObjectPool<>(new BasePooledObjectFactory<String, RuntimeException>() { 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 3740ebfa..0a069d8d 100644 --- a/src/test/java/org/apache/commons/pool3/impl/TestGenericKeyedObjectPool.java +++ b/src/test/java/org/apache/commons/pool3/impl/TestGenericKeyedObjectPool.java @@ -885,7 +885,7 @@ public class TestGenericKeyedObjectPool extends AbstractTestKeyedObjectPool { } @Test - public void testAppendStats() { + void testAppendStats() { assertFalse(gkoPool.getMessageStatistics()); assertEquals("foo", gkoPool.appendStats("foo")); try (GenericKeyedObjectPool<?, ?, TestException> pool = new GenericKeyedObjectPool<>(new SimpleFactory<>())) { @@ -898,7 +898,7 @@ public class TestGenericKeyedObjectPool extends AbstractTestKeyedObjectPool { @Test @Timeout(value = 60_000, unit = TimeUnit.MILLISECONDS) - public void testBlockedKeyDoesNotBlockPool() throws Exception { + void testBlockedKeyDoesNotBlockPool() throws Exception { gkoPool.setBlockWhenExhausted(true); gkoPool.setMaxWait(Duration.ofMillis(5000)); gkoPool.setMaxTotalPerKey(1); @@ -929,7 +929,7 @@ public class TestGenericKeyedObjectPool extends AbstractTestKeyedObjectPool { @SuppressWarnings("rawtypes") @Test @Timeout(value = 60_000, unit = TimeUnit.MILLISECONDS) - public void testBorrowObjectFairness() throws Exception { + void testBorrowObjectFairness() throws Exception { final int numThreads = 40; final int maxTotal = 40; @@ -981,7 +981,7 @@ public class TestGenericKeyedObjectPool extends AbstractTestKeyedObjectPool { */ @Test @Timeout(value = 60_000, unit = TimeUnit.MILLISECONDS) - public void testClear() throws Exception { + void testClear() throws Exception { gkoPool.setMaxTotal(2); gkoPool.setMaxTotalPerKey(2); gkoPool.setBlockWhenExhausted(false); @@ -1010,7 +1010,7 @@ public class TestGenericKeyedObjectPool extends AbstractTestKeyedObjectPool { */ @Test @Timeout(value = 60_000, unit = TimeUnit.MILLISECONDS) - public void testClearOldest() throws Exception { + 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 (GenericKeyedObjectPool<String, Waiter, RuntimeException> waiterPool = new GenericKeyedObjectPool<>(waiterFactory)) { @@ -1045,7 +1045,7 @@ public class TestGenericKeyedObjectPool extends AbstractTestKeyedObjectPool { * @throws Exception May occur in some failure modes */ @Test - public void testClearReuseCapacity() throws Exception { + void testClearReuseCapacity() throws Exception { gkoPool.setMaxTotalPerKey(6); gkoPool.setMaxTotal(6); gkoPool.setMaxWait(Duration.ofSeconds(5)); @@ -1097,7 +1097,7 @@ public class TestGenericKeyedObjectPool extends AbstractTestKeyedObjectPool { */ @Test @Timeout(value = 10000, unit = TimeUnit.MILLISECONDS) - public void testClearUnblocksWaiters() throws Exception { + void testClearUnblocksWaiters() throws Exception { final GenericKeyedObjectPoolConfig<Integer> config = new GenericKeyedObjectPoolConfig<>(); config.setMaxTotalPerKey(1); config.setMaxTotal(1); @@ -1162,7 +1162,7 @@ public class TestGenericKeyedObjectPool extends AbstractTestKeyedObjectPool { // POOL-259 @Test - public void testClientWaitStats() throws TestException { + void testClientWaitStats() throws TestException { final SimpleFactory<String> factory = new SimpleFactory<>(); // Give makeObject a little latency factory.setMakeLatency(200); @@ -1187,7 +1187,7 @@ public class TestGenericKeyedObjectPool extends AbstractTestKeyedObjectPool { * @throws TestException a test failure. */ @Test - public void testConcurrentBorrowAndClear() throws TestException { + void testConcurrentBorrowAndClear() throws TestException { final int threadCount = 64; final int taskCount = 64; final int addCount = 1; @@ -1267,7 +1267,7 @@ public class TestGenericKeyedObjectPool extends AbstractTestKeyedObjectPool { * @throws TestException a test failure. */ @Test - public void testConcurrentBorrowAndClear_JiraComment17741156() throws TestException { + void testConcurrentBorrowAndClear_JiraComment17741156() throws TestException { final int threadCount = 2; final int taskCount = 2; final int addCount = 1; @@ -1284,7 +1284,7 @@ public class TestGenericKeyedObjectPool extends AbstractTestKeyedObjectPool { * @throws Exception May occur in some failure modes */ @Test - public void testConcurrentInvalidate() throws Exception { + void testConcurrentInvalidate() throws Exception { // Get allObjects and idleObjects loaded with some instances final int nObjects = 1000; final String key = "one"; @@ -1333,7 +1333,7 @@ public class TestGenericKeyedObjectPool extends AbstractTestKeyedObjectPool { } @Test - public void testConstructorNullFactory() { + void testConstructorNullFactory() { // add dummy assert (won't be invoked because of IAE) to avoid "unused" warning assertThrows(IllegalArgumentException.class, () -> new GenericKeyedObjectPool<>(null)); } @@ -1341,7 +1341,7 @@ public class TestGenericKeyedObjectPool extends AbstractTestKeyedObjectPool { @SuppressWarnings("deprecation") @Test @Timeout(value = 60_000, unit = TimeUnit.MILLISECONDS) - public void testConstructors() { + void testConstructors() { // Make constructor arguments all different from defaults final int maxTotalPerKey = 1; @@ -1415,7 +1415,7 @@ public class TestGenericKeyedObjectPool extends AbstractTestKeyedObjectPool { * JIRA: POOL-270 - make sure constructor correctly sets run frequency of evictor timer. */ @Test - public void testContructorEvictionConfig() throws TestException { + void testContructorEvictionConfig() throws TestException { final GenericKeyedObjectPoolConfig<String> config = new GenericKeyedObjectPoolConfig<>(); config.setDurationBetweenEvictionRuns(Duration.ofMillis(500)); config.setMinEvictableIdleDuration(Duration.ofMillis(50)); @@ -1437,7 +1437,7 @@ public class TestGenericKeyedObjectPool extends AbstractTestKeyedObjectPool { * JIRA: POOL-283 */ @Test - public void testEqualsIndiscernible() throws Exception { + void testEqualsIndiscernible() throws Exception { final HashSetFactory factory = new HashSetFactory(); try (GenericKeyedObjectPool<String, HashSet<String>, RuntimeException> pool = new GenericKeyedObjectPool<>(factory, new GenericKeyedObjectPoolConfig<>())) { @@ -1450,7 +1450,7 @@ public class TestGenericKeyedObjectPool extends AbstractTestKeyedObjectPool { @Test @Timeout(value = 60_000, unit = TimeUnit.MILLISECONDS) - public void testEviction() throws Exception { + void testEviction() throws Exception { gkoPool.setMaxIdlePerKey(500); gkoPool.setMaxTotalPerKey(500); gkoPool.setNumTestsPerEvictionRun(100); @@ -1501,7 +1501,7 @@ public class TestGenericKeyedObjectPool extends AbstractTestKeyedObjectPool { @Test @Timeout(value = 60_000, unit = TimeUnit.MILLISECONDS) - public void testEviction2() throws Exception { + void testEviction2() throws Exception { gkoPool.setMaxIdlePerKey(500); gkoPool.setMaxTotalPerKey(500); gkoPool.setNumTestsPerEvictionRun(100); @@ -1553,14 +1553,14 @@ public class TestGenericKeyedObjectPool extends AbstractTestKeyedObjectPool { */ @Test @Timeout(value = 60_000, unit = TimeUnit.MILLISECONDS) - public void testEvictionOrder() throws Exception { + void testEvictionOrder() throws Exception { checkEvictionOrder(false); checkEvictionOrder(true); } // POOL-326 @Test - public void testEvictorClearOldestRace() throws Exception { + void testEvictorClearOldestRace() throws Exception { gkoPool.setMinEvictableIdleDuration(Duration.ofMillis(100)); gkoPool.setNumTestsPerEvictionRun(1); @@ -1598,14 +1598,14 @@ public class TestGenericKeyedObjectPool extends AbstractTestKeyedObjectPool { */ @Test @Timeout(value = 60_000, unit = TimeUnit.MILLISECONDS) - public void testEvictorVisiting() throws Exception { + void testEvictorVisiting() throws Exception { checkEvictorVisiting(true); checkEvictorVisiting(false); } @Test @Timeout(value = 60_000, unit = TimeUnit.MILLISECONDS) - public void testExceptionInValidationDuringEviction() throws Exception { + void testExceptionInValidationDuringEviction() throws Exception { gkoPool.setMaxIdlePerKey(1); gkoPool.setMinEvictableIdleDuration(Duration.ZERO); gkoPool.setTestWhileIdle(true); @@ -1621,7 +1621,7 @@ public class TestGenericKeyedObjectPool extends AbstractTestKeyedObjectPool { @Test @Timeout(value = 60_000, unit = TimeUnit.MILLISECONDS) - public void testExceptionOnActivateDuringBorrow() throws Exception { + void testExceptionOnActivateDuringBorrow() throws Exception { final String obj1 = gkoPool.borrowObject("one"); final String obj2 = gkoPool.borrowObject("one"); gkoPool.returnObject("one", obj1); @@ -1649,7 +1649,7 @@ public class TestGenericKeyedObjectPool extends AbstractTestKeyedObjectPool { @Test @Timeout(value = 60_000, unit = TimeUnit.MILLISECONDS) - public void testExceptionOnDestroyDuringBorrow() throws Exception { + void testExceptionOnDestroyDuringBorrow() throws Exception { simpleFactory.setThrowExceptionOnDestroy(true); simpleFactory.setValidationEnabled(true); gkoPool.setTestOnBorrow(true); @@ -1664,7 +1664,7 @@ public class TestGenericKeyedObjectPool extends AbstractTestKeyedObjectPool { @Test @Timeout(value = 60_000, unit = TimeUnit.MILLISECONDS) - public void testExceptionOnDestroyDuringReturn() throws Exception { + void testExceptionOnDestroyDuringReturn() throws Exception { simpleFactory.setThrowExceptionOnDestroy(true); simpleFactory.setValidationEnabled(true); gkoPool.setTestOnReturn(true); @@ -1680,7 +1680,7 @@ public class TestGenericKeyedObjectPool extends AbstractTestKeyedObjectPool { @Test @Timeout(value = 60_000, unit = TimeUnit.MILLISECONDS) - public void testExceptionOnPassivateDuringReturn() throws Exception { + void testExceptionOnPassivateDuringReturn() throws Exception { final String obj = gkoPool.borrowObject("one"); simpleFactory.setThrowExceptionOnPassivate(true); gkoPool.returnObject("one", obj); @@ -1690,7 +1690,7 @@ public class TestGenericKeyedObjectPool extends AbstractTestKeyedObjectPool { @Test @Timeout(value = 60_000, unit = TimeUnit.MILLISECONDS) - public void testFIFO() throws Exception { + void testFIFO() throws Exception { gkoPool.setLifo(false); final String key = "key"; gkoPool.addObject(key); // "key0" @@ -1708,7 +1708,7 @@ public class TestGenericKeyedObjectPool extends AbstractTestKeyedObjectPool { @Test @Timeout(value = 60, unit = TimeUnit.SECONDS) - public void testGetKeys() throws Exception { + void testGetKeys() throws Exception { gkoPool.addObject("one"); assertEquals(1, gkoPool.getKeys().size()); gkoPool.addObject("two"); @@ -1720,7 +1720,7 @@ public class TestGenericKeyedObjectPool extends AbstractTestKeyedObjectPool { } @Test - public void testGetStatsString() { + void testGetStatsString() { assertNotNull(gkoPool.getStatsString()); } @@ -1733,7 +1733,7 @@ public class TestGenericKeyedObjectPool extends AbstractTestKeyedObjectPool { * @throws Exception May occur in some failure modes */ @Test - public void testInvalidateFreesCapacity() throws TestException, InterruptedException { + void testInvalidateFreesCapacity() throws TestException, InterruptedException { final SimpleFactory<String> factory = new SimpleFactory<>(); try (GenericKeyedObjectPool<String, String, TestException> pool = new GenericKeyedObjectPool<>(factory)) { pool.setMaxTotalPerKey(2); @@ -1757,7 +1757,7 @@ public class TestGenericKeyedObjectPool extends AbstractTestKeyedObjectPool { } @Test - public void testInvalidateFreesCapacityForOtherKeys() throws Exception { + void testInvalidateFreesCapacityForOtherKeys() throws Exception { gkoPool.setMaxTotal(1); gkoPool.setMaxWait(Duration.ofMillis(500)); final Thread borrower = new Thread(new SimpleTestThread<>(gkoPool, "two")); @@ -1770,13 +1770,13 @@ public class TestGenericKeyedObjectPool extends AbstractTestKeyedObjectPool { } @Test - public void testInvalidateMissingKey() throws Exception { + void testInvalidateMissingKey() throws Exception { assertThrows(IllegalStateException.class, () -> gkoPool.invalidateObject("UnknownKey", "Ignored")); } @ParameterizedTest @EnumSource(DestroyMode.class) - public void testInvalidateMissingKeyForDestroyMode(final DestroyMode destroyMode) throws Exception { + void testInvalidateMissingKeyForDestroyMode(final DestroyMode destroyMode) throws Exception { assertThrows(IllegalStateException.class, () -> gkoPool.invalidateObject("UnknownKey", "Ignored", destroyMode)); } @@ -1789,7 +1789,7 @@ public class TestGenericKeyedObjectPool extends AbstractTestKeyedObjectPool { * @throws Exception May occur in some failure modes */ @Test - public void testInvalidateWaiting() throws Exception { + void testInvalidateWaiting() throws Exception { final GenericKeyedObjectPoolConfig<Object> config = new GenericKeyedObjectPoolConfig<>(); config.setMaxTotal(2); config.setBlockWhenExhausted(true); @@ -1846,7 +1846,7 @@ public class TestGenericKeyedObjectPool extends AbstractTestKeyedObjectPool { */ @Test @Timeout(value = 60_000, unit = TimeUnit.MILLISECONDS) - public void testJmxRegistration() { + void testJmxRegistration() { final ObjectName oname = gkoPool.getJmxName(); final MBeanServer mbs = ManagementFactory.getPlatformMBeanServer(); final Set<ObjectName> result = mbs.queryNames(oname, null); @@ -1855,7 +1855,7 @@ public class TestGenericKeyedObjectPool extends AbstractTestKeyedObjectPool { @Test @Timeout(value = 60_000, unit = TimeUnit.MILLISECONDS) - public void testLIFO() throws Exception { + void testLIFO() throws Exception { gkoPool.setLifo(true); final String key = "key"; gkoPool.addObject(key); // "key0" @@ -1879,7 +1879,7 @@ public class TestGenericKeyedObjectPool extends AbstractTestKeyedObjectPool { */ @Test @Timeout(value = 60_000, unit = TimeUnit.MILLISECONDS) - public void testLivenessPerKey() throws Exception { + void testLivenessPerKey() throws Exception { gkoPool.setMaxIdlePerKey(3); gkoPool.setMaxTotal(3); gkoPool.setMaxTotalPerKey(3); @@ -1906,7 +1906,7 @@ public class TestGenericKeyedObjectPool extends AbstractTestKeyedObjectPool { * @throws Exception May occur in some failure modes */ @Test - public void testMakeObjectException() throws Exception { + void testMakeObjectException() throws Exception { final SimpleFactory<String> factory = new SimpleFactory<>(); try (GenericKeyedObjectPool<String, String, TestException> pool = new GenericKeyedObjectPool<>(factory)) { pool.setMaxTotalPerKey(1); @@ -1923,7 +1923,7 @@ public class TestGenericKeyedObjectPool extends AbstractTestKeyedObjectPool { */ @Test @Timeout(value = 200000, unit = TimeUnit.MILLISECONDS) - public void testMaxActivePerKeyExceeded() { + void testMaxActivePerKeyExceeded() { 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 @@ -1939,7 +1939,7 @@ public class TestGenericKeyedObjectPool extends AbstractTestKeyedObjectPool { @Test @Timeout(value = 60_000, unit = TimeUnit.MILLISECONDS) - public void testMaxIdle() throws Exception { + void testMaxIdle() throws Exception { gkoPool.setMaxTotalPerKey(100); gkoPool.setMaxIdlePerKey(8); final String[] active = new String[100]; @@ -1975,7 +1975,7 @@ public class TestGenericKeyedObjectPool extends AbstractTestKeyedObjectPool { @Test @Timeout(value = 60_000, unit = TimeUnit.MILLISECONDS) - public void testMaxTotal() throws Exception { + void testMaxTotal() throws Exception { gkoPool.setMaxTotalPerKey(2); gkoPool.setMaxTotal(3); gkoPool.setBlockWhenExhausted(false); @@ -2018,7 +2018,7 @@ public class TestGenericKeyedObjectPool extends AbstractTestKeyedObjectPool { */ @Test @Timeout(value = 60_000, unit = TimeUnit.MILLISECONDS) - public void testMaxTotalInvariant() { + void testMaxTotalInvariant() { final int maxTotal = 15; simpleFactory.setEvenValid(false); // Every other validation fails simpleFactory.setDestroyLatency(100); // Destroy takes 100 ms @@ -2033,7 +2033,7 @@ public class TestGenericKeyedObjectPool extends AbstractTestKeyedObjectPool { @Test @Timeout(value = 60_000, unit = TimeUnit.MILLISECONDS) - public void testMaxTotalLRU() throws Exception { + void testMaxTotalLRU() throws Exception { gkoPool.setMaxTotalPerKey(2); gkoPool.setMaxTotal(3); @@ -2084,7 +2084,7 @@ public class TestGenericKeyedObjectPool extends AbstractTestKeyedObjectPool { @Test @Timeout(value = 60_000, unit = TimeUnit.MILLISECONDS) - public void testMaxTotalPerKey() throws Exception { + void testMaxTotalPerKey() throws Exception { gkoPool.setMaxTotalPerKey(3); gkoPool.setBlockWhenExhausted(false); @@ -2096,7 +2096,7 @@ public class TestGenericKeyedObjectPool extends AbstractTestKeyedObjectPool { @Test @Timeout(value = 60_000, unit = TimeUnit.MILLISECONDS) - public void testMaxTotalPerKeyZero() { + void testMaxTotalPerKeyZero() { gkoPool.setMaxTotalPerKey(0); gkoPool.setBlockWhenExhausted(false); @@ -2110,7 +2110,7 @@ public class TestGenericKeyedObjectPool extends AbstractTestKeyedObjectPool { * JIRA: POOL-310 */ @Test - public void testMaxTotalWithThreads() throws Exception { + void testMaxTotalWithThreads() throws Exception { gkoPool.setMaxTotalPerKey(2); gkoPool.setMaxTotal(1); @@ -2146,7 +2146,7 @@ public class TestGenericKeyedObjectPool extends AbstractTestKeyedObjectPool { @Test @Timeout(value = 60_000, unit = TimeUnit.MILLISECONDS) - public void testMaxTotalZero() { + void testMaxTotalZero() { gkoPool.setMaxTotal(0); gkoPool.setBlockWhenExhausted(false); @@ -2163,7 +2163,7 @@ public class TestGenericKeyedObjectPool extends AbstractTestKeyedObjectPool { */ @Test @Timeout(value = 60_000, unit = TimeUnit.MILLISECONDS) - public void testMaxWaitMultiThreaded() throws Exception { + void testMaxWaitMultiThreaded() throws Exception { final long maxWait = 500; // wait for connection final long holdTime = 4 * maxWait; // how long to hold connection final int keyCount = 4; // number of different keys @@ -2213,7 +2213,7 @@ public class TestGenericKeyedObjectPool extends AbstractTestKeyedObjectPool { @Test @Timeout(value = 60_000, unit = TimeUnit.MILLISECONDS) - public void testMinIdle() throws Exception { + void testMinIdle() throws Exception { gkoPool.setMaxIdlePerKey(500); gkoPool.setMinIdlePerKey(5); gkoPool.setMaxTotalPerKey(10); @@ -2253,7 +2253,7 @@ public class TestGenericKeyedObjectPool extends AbstractTestKeyedObjectPool { @Test @Timeout(value = 60_000, unit = TimeUnit.MILLISECONDS) - public void testMinIdleMaxTotalPerKey() throws Exception { + void testMinIdleMaxTotalPerKey() throws Exception { gkoPool.setMaxIdlePerKey(500); gkoPool.setMinIdlePerKey(5); gkoPool.setMaxTotalPerKey(10); @@ -2306,7 +2306,7 @@ public class TestGenericKeyedObjectPool extends AbstractTestKeyedObjectPool { @Test @Timeout(value = 60_000, unit = TimeUnit.MILLISECONDS) - public void testMinIdleNoPreparePool() throws Exception { + void testMinIdleNoPreparePool() throws Exception { gkoPool.setMaxIdlePerKey(500); gkoPool.setMinIdlePerKey(5); gkoPool.setMaxTotalPerKey(10); @@ -2335,7 +2335,7 @@ public class TestGenericKeyedObjectPool extends AbstractTestKeyedObjectPool { * JIRA: POOL-285 */ @Test - public void testMultipleReturn() throws Exception { + void testMultipleReturn() throws Exception { final WaiterFactory<String> factory = new WaiterFactory<>(0, 0, 0, 0, 0, 0); try (GenericKeyedObjectPool<String, Waiter, RuntimeException> pool = new GenericKeyedObjectPool<>(factory)) { pool.setTestOnReturn(true); @@ -2361,7 +2361,7 @@ public class TestGenericKeyedObjectPool extends AbstractTestKeyedObjectPool { * JIRA: POOL-284 */ @Test - public void testMutable() throws Exception { + void testMutable() throws Exception { final HashSetFactory factory = new HashSetFactory(); try (GenericKeyedObjectPool<String, HashSet<String>, RuntimeException> pool = new GenericKeyedObjectPool<>(factory, new GenericKeyedObjectPoolConfig<>())) { @@ -2376,7 +2376,7 @@ public class TestGenericKeyedObjectPool extends AbstractTestKeyedObjectPool { @Test @Timeout(value = 60_000, unit = TimeUnit.MILLISECONDS) - public void testNegativeMaxTotalPerKey() throws Exception { + void testNegativeMaxTotalPerKey() throws Exception { gkoPool.setMaxTotalPerKey(-1); gkoPool.setBlockWhenExhausted(false); final String obj = gkoPool.borrowObject(""); @@ -2389,7 +2389,7 @@ public class TestGenericKeyedObjectPool extends AbstractTestKeyedObjectPool { */ @Test @Timeout(value = 1000, unit = TimeUnit.MILLISECONDS) - public void testNPEOnFactoryNull() { + void testNPEOnFactoryNull() { // @formatter:off final DisconnectingWaiterFactory<String> factory = new DisconnectingWaiterFactory<>( () -> null, // Override default to always return null from makeObject @@ -2412,7 +2412,7 @@ public class TestGenericKeyedObjectPool extends AbstractTestKeyedObjectPool { @Test @Timeout(value = 60_000, unit = TimeUnit.MILLISECONDS) - public void testNumActiveNumIdle2() throws Exception { + void testNumActiveNumIdle2() throws Exception { assertEquals(0, gkoPool.getNumActive()); assertEquals(0, gkoPool.getNumIdle()); assertEquals(0, gkoPool.getNumActive("A")); @@ -2462,7 +2462,7 @@ public class TestGenericKeyedObjectPool extends AbstractTestKeyedObjectPool { } @Test - public void testReturnObjectThrowsIllegalStateException() { + void testReturnObjectThrowsIllegalStateException() { try (GenericKeyedObjectPool<String, String, TestException> pool = new GenericKeyedObjectPool<>(new SimpleFactory<>())) { assertThrows(IllegalStateException.class, () -> pool.returnObject("Foo", "Bar")); @@ -2470,7 +2470,7 @@ public class TestGenericKeyedObjectPool extends AbstractTestKeyedObjectPool { } @Test - public void testReturnObjectWithBlockWhenExhausted() throws Exception { + void testReturnObjectWithBlockWhenExhausted() throws Exception { gkoPool.setBlockWhenExhausted(true); gkoPool.setMaxTotal(1); @@ -2490,7 +2490,7 @@ public class TestGenericKeyedObjectPool extends AbstractTestKeyedObjectPool { } @Test - public void testReturnObjectWithoutBlockWhenExhausted() throws Exception { + void testReturnObjectWithoutBlockWhenExhausted() throws Exception { gkoPool.setBlockWhenExhausted(false); // Test return object with no take waiters @@ -2507,7 +2507,7 @@ public class TestGenericKeyedObjectPool extends AbstractTestKeyedObjectPool { * Test creates the scenario described in POOL-287. */ @Test - public void testReturnToHead() throws Exception { + void testReturnToHead() throws Exception { final SimpleFactory<String> factory = new SimpleFactory<>(); factory.setValidateLatency(100); factory.setValid(true); // Validation always succeeds @@ -2538,7 +2538,7 @@ public class TestGenericKeyedObjectPool extends AbstractTestKeyedObjectPool { @Test @Timeout(value = 60_000, unit = TimeUnit.MILLISECONDS) - public void testSettersAndGetters() { + void testSettersAndGetters() { { gkoPool.setMaxTotalPerKey(123); assertEquals(123, gkoPool.getMaxTotalPerKey()); @@ -2591,7 +2591,7 @@ public class TestGenericKeyedObjectPool extends AbstractTestKeyedObjectPool { @Test @Timeout(value = 60_000, unit = TimeUnit.MILLISECONDS) - public void testThreaded1() { + void testThreaded1() { gkoPool.setMaxTotalPerKey(15); gkoPool.setMaxIdlePerKey(15); gkoPool.setMaxWait(Duration.ofMillis(1000)); @@ -2600,7 +2600,7 @@ public class TestGenericKeyedObjectPool extends AbstractTestKeyedObjectPool { // Pool-361 @Test - public void testValidateOnCreate() throws Exception { + void testValidateOnCreate() throws Exception { gkoPool.setTestOnCreate(true); simpleFactory.setValidationEnabled(true); gkoPool.addObject("one"); @@ -2608,7 +2608,7 @@ public class TestGenericKeyedObjectPool extends AbstractTestKeyedObjectPool { } @Test - public void testValidateOnCreateFailure() throws Exception { + void testValidateOnCreateFailure() throws Exception { gkoPool.setTestOnCreate(true); gkoPool.setTestOnBorrow(false); gkoPool.setMaxTotal(2); @@ -2637,7 +2637,7 @@ public class TestGenericKeyedObjectPool extends AbstractTestKeyedObjectPool { * @throws Exception May occur in some failure modes */ @Test - public void testValidationFailureOnReturnFreesCapacity() + void testValidationFailureOnReturnFreesCapacity() throws Exception { final SimpleFactory<String> factory = new SimpleFactory<>(); factory.setValid(false); // Validate will always fail @@ -2662,7 +2662,7 @@ public class TestGenericKeyedObjectPool extends AbstractTestKeyedObjectPool { // POOL-276 @Test - public void testValidationOnCreateOnly() throws Exception { + void testValidationOnCreateOnly() throws Exception { simpleFactory.enableValidation = true; gkoPool.setMaxTotal(1); @@ -2695,7 +2695,7 @@ public class TestGenericKeyedObjectPool extends AbstractTestKeyedObjectPool { */ @Test @Timeout(value = 60_000, unit = TimeUnit.MILLISECONDS) - public void testWhenExhaustedBlockClosePool() throws Exception { + void testWhenExhaustedBlockClosePool() throws Exception { gkoPool.setMaxTotalPerKey(1); gkoPool.setBlockWhenExhausted(true); gkoPool.setMaxWait(Duration.ofMillis(-1)); 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 e689bc31..4a971695 100644 --- a/src/test/java/org/apache/commons/pool3/impl/TestGenericObjectPool.java +++ b/src/test/java/org/apache/commons/pool3/impl/TestGenericObjectPool.java @@ -969,7 +969,7 @@ public class TestGenericObjectPool extends TestBaseObjectPool { */ @SuppressWarnings("deprecation") @Test - public void testAbandonedPool() throws TestException, InterruptedException { + void testAbandonedPool() throws TestException, InterruptedException { final GenericObjectPoolConfig<String> config = new GenericObjectPoolConfig<>(); config.setJmxEnabled(false); GenericObjectPool<String, TestException> abandoned = new GenericObjectPool<>(simpleFactory, config); @@ -987,7 +987,7 @@ public class TestGenericObjectPool extends TestBaseObjectPool { @Test @Timeout(value = 60000, unit = TimeUnit.MILLISECONDS) - public void testAddObject() throws Exception { + void testAddObject() throws Exception { assertEquals(0, genericObjectPool.getNumIdle(), "should be zero idle"); genericObjectPool.addObject(); assertEquals(1, genericObjectPool.getNumIdle(), "should be one idle"); @@ -1001,7 +1001,7 @@ public class TestGenericObjectPool extends TestBaseObjectPool { } @Test - public void testAppendStats() { + void testAppendStats() { assertFalse(genericObjectPool.getMessageStatistics()); assertEquals("foo", genericObjectPool.appendStats("foo")); try (GenericObjectPool<?, TestException> pool = new GenericObjectPool<>(new SimpleFactory())) { @@ -1022,7 +1022,7 @@ public class TestGenericObjectPool extends TestBaseObjectPool { }) @Test @Timeout(value = 60000, unit = TimeUnit.MILLISECONDS) - public void testBorrowObjectFairness() throws Exception { + void testBorrowObjectFairness() throws Exception { final int numThreads = 40; final int maxTotal = 40; @@ -1069,7 +1069,7 @@ public class TestGenericObjectPool extends TestBaseObjectPool { @Test/* maxWaitMillis x2 + padding */ @Timeout(value = 1200, unit = TimeUnit.MILLISECONDS) - public void testBorrowObjectOverrideMaxWaitLarge() throws Exception { + void testBorrowObjectOverrideMaxWaitLarge() throws Exception { try (GenericObjectPool<String, InterruptedException> pool = new GenericObjectPool<>(createSlowObjectFactory(Duration.ofSeconds(60)))) { pool.setMaxTotal(1); pool.setMaxWait(Duration.ofMillis(1_000)); // large @@ -1092,7 +1092,7 @@ public class TestGenericObjectPool extends TestBaseObjectPool { @Test/* maxWaitMillis x2 + padding */ @Timeout(value = 1200, unit = TimeUnit.MILLISECONDS) - public void testBorrowObjectOverrideMaxWaitSmall() throws Exception { + void testBorrowObjectOverrideMaxWaitSmall() throws Exception { try (GenericObjectPool<String, InterruptedException> pool = new GenericObjectPool<>(createSlowObjectFactory(Duration.ofSeconds(60)))) { pool.setMaxTotal(1); pool.setMaxWait(Duration.ofMillis(1)); // small @@ -1114,7 +1114,7 @@ public class TestGenericObjectPool extends TestBaseObjectPool { } } @Test - public void testBorrowTimings() throws Exception { + void testBorrowTimings() throws Exception { // Borrow final String object = genericObjectPool.borrowObject(); final PooledObject<String> po = genericObjectPool.getPooledObject(object); @@ -1177,7 +1177,7 @@ public class TestGenericObjectPool extends TestBaseObjectPool { */ @Test @Timeout(value = 60000, unit = TimeUnit.MILLISECONDS) - public void testBrokenFactoryShouldNotBlockPool() throws Exception { + void testBrokenFactoryShouldNotBlockPool() throws Exception { final int maxTotal = 1; simpleFactory.setMaxTotal(maxTotal); @@ -1211,7 +1211,7 @@ public class TestGenericObjectPool extends TestBaseObjectPool { // POOL-259 @Test - public void testClientWaitStats() throws TestException { + void testClientWaitStats() throws TestException { final SimpleFactory factory = new SimpleFactory(); // Give makeObject a little latency factory.setMakeLatency(200); @@ -1233,7 +1233,7 @@ public class TestGenericObjectPool extends TestBaseObjectPool { @Test @Timeout(value = 60000, unit = TimeUnit.MILLISECONDS) - public void testCloseMultiplePools1() { + void testCloseMultiplePools1() { try (GenericObjectPool<String, TestException> genericObjectPool2 = new GenericObjectPool<>( simpleFactory)) { genericObjectPool.setDurationBetweenEvictionRuns(TestConstants.ONE_MILLISECOND_DURATION); @@ -1244,7 +1244,7 @@ public class TestGenericObjectPool extends TestBaseObjectPool { @Test @Timeout(value = 60000, unit = TimeUnit.MILLISECONDS) - public void testCloseMultiplePools2() throws Exception { + void testCloseMultiplePools2() throws Exception { try (GenericObjectPool<String, TestException> genericObjectPool2 = new GenericObjectPool<>( simpleFactory)) { // Ensure eviction takes a long time, during which time EvictionTimer.executor's @@ -1264,7 +1264,7 @@ public class TestGenericObjectPool extends TestBaseObjectPool { @Test @Timeout(value = 60000, unit = TimeUnit.MILLISECONDS) - public void testConcurrentBorrowAndEvict() throws Exception { + void testConcurrentBorrowAndEvict() throws Exception { genericObjectPool.setMaxTotal(1); genericObjectPool.addObject(); @@ -1296,7 +1296,7 @@ public class TestGenericObjectPool extends TestBaseObjectPool { * @throws Exception May occur in some failure modes */ @Test - public void testConcurrentInvalidate() throws Exception { + void testConcurrentInvalidate() throws Exception { // Get allObjects and idleObjects loaded with some instances final int nObjects = 1000; genericObjectPool.setMaxTotal(nObjects); @@ -1343,7 +1343,7 @@ public class TestGenericObjectPool extends TestBaseObjectPool { } @Test - public void testConstructorNullFactory() { + void testConstructorNullFactory() { // add dummy assert (won't be invoked because of IAE) to avoid "unused" warning assertThrows(IllegalArgumentException.class, () -> new GenericObjectPool<>(null)); @@ -1351,7 +1351,7 @@ public class TestGenericObjectPool extends TestBaseObjectPool { @Test @Timeout(value = 60000, unit = TimeUnit.MILLISECONDS) - public void testConstructors() { + void testConstructors() { // Make constructor arguments all different from defaults final int minIdle = 2; @@ -1424,7 +1424,7 @@ public class TestGenericObjectPool extends TestBaseObjectPool { @Test @Timeout(value = 60000, unit = TimeUnit.MILLISECONDS) - public void testDefaultConfiguration() { + void testDefaultConfiguration() { assertConfiguration(new GenericObjectPoolConfig<>(), genericObjectPool); } @@ -1435,7 +1435,7 @@ public class TestGenericObjectPool extends TestBaseObjectPool { * JIRA: POOL-283 */ @Test - public void testEqualsIndiscernible() throws Exception { + void testEqualsIndiscernible() throws Exception { final HashSetFactory factory = new HashSetFactory(); try (GenericObjectPool<HashSet<String>, RuntimeException> pool = new GenericObjectPool<>(factory, new GenericObjectPoolConfig<>())) { @@ -1447,7 +1447,7 @@ public class TestGenericObjectPool extends TestBaseObjectPool { } @Test - public void testErrorFactoryDoesNotBlockThreads() throws Exception { + void testErrorFactoryDoesNotBlockThreads() throws Exception { final CreateErrorFactory factory = new CreateErrorFactory(); try (GenericObjectPool<String, InterruptedException> createFailFactoryPool = new GenericObjectPool<>( @@ -1504,7 +1504,7 @@ public class TestGenericObjectPool extends TestBaseObjectPool { */ @Test @Timeout(value = 60000, unit = TimeUnit.MILLISECONDS) - public void testEvictAddObjects() throws Exception { + void testEvictAddObjects() throws Exception { simpleFactory.setMakeLatency(300); simpleFactory.setMaxTotal(2); genericObjectPool.setMaxTotal(2); @@ -1523,13 +1523,13 @@ public class TestGenericObjectPool extends TestBaseObjectPool { @Test @Timeout(value = 60000, unit = TimeUnit.MILLISECONDS) - public void testEvictFIFO() throws Exception { + void testEvictFIFO() throws Exception { checkEvict(false); } @Test @Timeout(value = 60000, unit = TimeUnit.MILLISECONDS) - public void testEviction() throws Exception { + void testEviction() throws Exception { genericObjectPool.setMaxIdle(500); genericObjectPool.setMaxTotal(500); genericObjectPool.setNumTestsPerEvictionRun(100); @@ -1591,7 +1591,7 @@ public class TestGenericObjectPool extends TestBaseObjectPool { @Test @Timeout(value = 60000, unit = TimeUnit.MILLISECONDS) - public void testEvictionInvalid() throws Exception { + void testEvictionInvalid() throws Exception { try (GenericObjectPool<Object, RuntimeException> invalidFactoryPool = new GenericObjectPool<>( new InvalidFactory())) { @@ -1639,7 +1639,7 @@ public class TestGenericObjectPool extends TestBaseObjectPool { */ @Test @Timeout(value = 60000, unit = TimeUnit.MILLISECONDS) - public void testEvictionOrder() throws Exception { + void testEvictionOrder() throws Exception { checkEvictionOrder(false); tearDown(); setUp(); @@ -1648,7 +1648,7 @@ public class TestGenericObjectPool extends TestBaseObjectPool { @Test @Timeout(value = 60000, unit = TimeUnit.MILLISECONDS) - public void testEvictionPolicy() throws Exception { + void testEvictionPolicy() throws Exception { genericObjectPool.setMaxIdle(500); genericObjectPool.setMaxTotal(500); genericObjectPool.setNumTestsPerEvictionRun(500); @@ -1702,7 +1702,7 @@ public class TestGenericObjectPool extends TestBaseObjectPool { @Test @Timeout(value = 60000, unit = TimeUnit.MILLISECONDS) - public void testEvictionSoftMinIdle() throws Exception { + void testEvictionSoftMinIdle() throws Exception { final class TimeTest extends BasePooledObjectFactory<TimeTest, RuntimeException> { private final long createTimeMillis; @@ -1759,7 +1759,7 @@ public class TestGenericObjectPool extends TestBaseObjectPool { @Test @Timeout(value = 60000, unit = TimeUnit.MILLISECONDS) - public void testEvictionWithNegativeNumTests() throws Exception { + void testEvictionWithNegativeNumTests() throws Exception { // when numTestsPerEvictionRun is negative, it represents a fraction of the idle // objects to test genericObjectPool.setMaxIdle(6); @@ -1791,7 +1791,7 @@ public class TestGenericObjectPool extends TestBaseObjectPool { @Test @Timeout(value = 60000, unit = TimeUnit.MILLISECONDS) - public void testEvictLIFO() throws Exception { + void testEvictLIFO() throws Exception { checkEvict(true); } @@ -1802,14 +1802,14 @@ public class TestGenericObjectPool extends TestBaseObjectPool { * @throws Exception May occur in some failure modes */ @Test - public void testEvictorVisiting() throws Exception { + void testEvictorVisiting() throws Exception { checkEvictorVisiting(true); checkEvictorVisiting(false); } @Test @Timeout(value = 60000, unit = TimeUnit.MILLISECONDS) - public void testEvictWhileEmpty() throws Exception { + void testEvictWhileEmpty() throws Exception { genericObjectPool.evict(); genericObjectPool.evict(); genericObjectPool.close(); @@ -1817,7 +1817,7 @@ public class TestGenericObjectPool extends TestBaseObjectPool { @Test @Timeout(value = 60000, unit = TimeUnit.MILLISECONDS) - public void testExceptionInValidationDuringEviction() throws Exception { + void testExceptionInValidationDuringEviction() throws Exception { genericObjectPool.setMaxIdle(1); genericObjectPool.setMinEvictableIdleDuration(Duration.ZERO); genericObjectPool.setTestWhileIdle(true); @@ -1834,7 +1834,7 @@ public class TestGenericObjectPool extends TestBaseObjectPool { @Test @Timeout(value = 60000, unit = TimeUnit.MILLISECONDS) - public void testExceptionOnActivateDuringBorrow() throws Exception { + void testExceptionOnActivateDuringBorrow() throws Exception { final String obj1 = genericObjectPool.borrowObject(); final String obj2 = genericObjectPool.borrowObject(); genericObjectPool.returnObject(obj1); @@ -1858,7 +1858,7 @@ public class TestGenericObjectPool extends TestBaseObjectPool { @Test @Timeout(value = 60000, unit = TimeUnit.MILLISECONDS) - public void testExceptionOnDestroyDuringBorrow() throws Exception { + void testExceptionOnDestroyDuringBorrow() throws Exception { simpleFactory.setThrowExceptionOnDestroy(true); genericObjectPool.setTestOnBorrow(true); genericObjectPool.borrowObject(); @@ -1870,7 +1870,7 @@ public class TestGenericObjectPool extends TestBaseObjectPool { @Test @Timeout(value = 60000, unit = TimeUnit.MILLISECONDS) - public void testExceptionOnDestroyDuringReturn() throws Exception { + void testExceptionOnDestroyDuringReturn() throws Exception { simpleFactory.setThrowExceptionOnDestroy(true); genericObjectPool.setTestOnReturn(true); final String obj1 = genericObjectPool.borrowObject(); @@ -1883,7 +1883,7 @@ public class TestGenericObjectPool extends TestBaseObjectPool { @Test @Timeout(value = 60000, unit = TimeUnit.MILLISECONDS) - public void testExceptionOnPassivateDuringReturn() throws Exception { + void testExceptionOnPassivateDuringReturn() throws Exception { final String obj = genericObjectPool.borrowObject(); simpleFactory.setThrowExceptionOnPassivate(true); genericObjectPool.returnObject(obj); @@ -1891,7 +1891,7 @@ public class TestGenericObjectPool extends TestBaseObjectPool { } @Test - public void testFailingFactoryDoesNotBlockThreads() throws Exception { + void testFailingFactoryDoesNotBlockThreads() throws Exception { final CreateFailFactory factory = new CreateFailFactory(); try (GenericObjectPool<String, InterruptedException> createFailFactoryPool = new GenericObjectPool<>( @@ -1942,7 +1942,7 @@ public class TestGenericObjectPool extends TestBaseObjectPool { @Test @Timeout(value = 60000, unit = TimeUnit.MILLISECONDS) - public void testFIFO() throws Exception { + void testFIFO() throws Exception { genericObjectPool.setLifo(false); genericObjectPool.addObject(); // "0" genericObjectPool.addObject(); // "1" @@ -1958,7 +1958,7 @@ public class TestGenericObjectPool extends TestBaseObjectPool { } @Test - public void testGetFactoryType_DefaultPooledObjectFactory() { + void testGetFactoryType_DefaultPooledObjectFactory() { try (GenericObjectPool<String, RuntimeException> pool = new GenericObjectPool<>( createDefaultPooledObjectFactory())) { assertNotNull(pool.getFactoryType()); @@ -1966,7 +1966,7 @@ public class TestGenericObjectPool extends TestBaseObjectPool { } @Test - public void testGetFactoryType_NullPooledObjectFactory() { + void testGetFactoryType_NullPooledObjectFactory() { try (GenericObjectPool<String, RuntimeException> pool = new GenericObjectPool<>( createNullPooledObjectFactory())) { assertNotNull(pool.getFactoryType()); @@ -1974,7 +1974,7 @@ public class TestGenericObjectPool extends TestBaseObjectPool { } @Test - public void testGetFactoryType_PoolUtilsSynchronizedDefaultPooledFactory() { + void testGetFactoryType_PoolUtilsSynchronizedDefaultPooledFactory() { try (GenericObjectPool<String, RuntimeException> pool = new GenericObjectPool<>( PoolUtils.synchronizedPooledFactory(createDefaultPooledObjectFactory()))) { assertNotNull(pool.getFactoryType()); @@ -1982,7 +1982,7 @@ public class TestGenericObjectPool extends TestBaseObjectPool { } @Test - public void testGetFactoryType_PoolUtilsSynchronizedNullPooledFactory() { + void testGetFactoryType_PoolUtilsSynchronizedNullPooledFactory() { try (GenericObjectPool<String, RuntimeException> pool = new GenericObjectPool<>( PoolUtils.synchronizedPooledFactory(createNullPooledObjectFactory()))) { assertNotNull(pool.getFactoryType()); @@ -1990,7 +1990,7 @@ public class TestGenericObjectPool extends TestBaseObjectPool { } @Test - public void testGetFactoryType_SynchronizedDefaultPooledObjectFactory() { + void testGetFactoryType_SynchronizedDefaultPooledObjectFactory() { try (GenericObjectPool<String, RuntimeException> pool = new GenericObjectPool<>( new TestSynchronizedPooledObjectFactory<>(createDefaultPooledObjectFactory()))) { assertNotNull(pool.getFactoryType()); @@ -1998,7 +1998,7 @@ public class TestGenericObjectPool extends TestBaseObjectPool { } @Test - public void testGetFactoryType_SynchronizedNullPooledObjectFactory() { + void testGetFactoryType_SynchronizedNullPooledObjectFactory() { try (GenericObjectPool<String, RuntimeException> pool = new GenericObjectPool<>( new TestSynchronizedPooledObjectFactory<>(createNullPooledObjectFactory()))) { assertNotNull(pool.getFactoryType()); @@ -2006,7 +2006,7 @@ public class TestGenericObjectPool extends TestBaseObjectPool { } @Test - public void testGetStatsString() { + void testGetStatsString() { try (GenericObjectPool<String, RuntimeException> pool = new GenericObjectPool<>( new TestSynchronizedPooledObjectFactory<>(createNullPooledObjectFactory()))) { assertNotNull(pool.getStatsString()); @@ -2023,7 +2023,7 @@ public class TestGenericObjectPool extends TestBaseObjectPool { * @throws Exception May occur in some failure modes */ @Test - public void testInvalidateFreesCapacity() throws Exception { + void testInvalidateFreesCapacity() throws Exception { final SimpleFactory factory = new SimpleFactory(); try (GenericObjectPool<String, TestException> pool = new GenericObjectPool<>(factory)) { pool.setMaxTotal(2); @@ -2052,7 +2052,7 @@ public class TestGenericObjectPool extends TestBaseObjectPool { */ @Test @Timeout(value = 60000, unit = TimeUnit.MILLISECONDS) - public void testJmxRegistration() { + void testJmxRegistration() { final ObjectName oname = genericObjectPool.getJmxName(); final MBeanServer mbs = ManagementFactory.getPlatformMBeanServer(); final Set<ObjectName> result = mbs.queryNames(oname, null); @@ -2077,7 +2077,7 @@ public class TestGenericObjectPool extends TestBaseObjectPool { @Test @Timeout(value = 60000, unit = TimeUnit.MILLISECONDS) - public void testLIFO() throws Exception { + void testLIFO() throws Exception { final String o; genericObjectPool.setLifo(true); genericObjectPool.addObject(); // "0" @@ -2102,7 +2102,7 @@ public class TestGenericObjectPool extends TestBaseObjectPool { */ @Test @Timeout(value = 1000, unit = TimeUnit.MILLISECONDS) - public void testLivenessOnTransientFactoryFailure() throws InterruptedException { + void testLivenessOnTransientFactoryFailure() throws InterruptedException { final DisconnectingWaiterFactory<String> factory = new DisconnectingWaiterFactory<>( DisconnectingWaiterFactory.DEFAULT_DISCONNECTED_CREATE_ACTION, DisconnectingWaiterFactory.DEFAULT_DISCONNECTED_LIFECYCLE_ACTION, @@ -2154,7 +2154,7 @@ public class TestGenericObjectPool extends TestBaseObjectPool { */ @Test @Timeout(value = 60000, unit = TimeUnit.MILLISECONDS) - public void testMakeConcurrentWithReturn() throws Exception { + void testMakeConcurrentWithReturn() throws Exception { genericObjectPool.setTestOnBorrow(true); simpleFactory.setValid(true); // Borrow and return an instance, with a short wait @@ -2172,7 +2172,7 @@ public class TestGenericObjectPool extends TestBaseObjectPool { @Test @Timeout(value = 60000, unit = TimeUnit.MILLISECONDS) - public void testMaxIdle() throws Exception { + void testMaxIdle() throws Exception { genericObjectPool.setMaxTotal(100); genericObjectPool.setMaxIdle(8); final String[] active = new String[100]; @@ -2190,7 +2190,7 @@ public class TestGenericObjectPool extends TestBaseObjectPool { @Test @Timeout(value = 60000, unit = TimeUnit.MILLISECONDS) - public void testMaxIdleZero() throws Exception { + void testMaxIdleZero() throws Exception { genericObjectPool.setMaxTotal(100); genericObjectPool.setMaxIdle(0); final String[] active = new String[100]; @@ -2212,7 +2212,7 @@ public class TestGenericObjectPool extends TestBaseObjectPool { @Test @Timeout(value = 60000, unit = TimeUnit.MILLISECONDS) @SuppressWarnings("rawtypes") - public void testMaxIdleZeroUnderLoad() { + void testMaxIdleZeroUnderLoad() { // Config final int numThreads = 199; // And main thread makes a round 200. final int numIter = 20; @@ -2278,7 +2278,7 @@ public class TestGenericObjectPool extends TestBaseObjectPool { @Test @Timeout(value = 60000, unit = TimeUnit.MILLISECONDS) - public void testMaxTotal() throws Exception { + void testMaxTotal() throws Exception { genericObjectPool.setMaxTotal(3); genericObjectPool.setBlockWhenExhausted(false); @@ -2295,7 +2295,7 @@ public class TestGenericObjectPool extends TestBaseObjectPool { */ @Test @Timeout(value = 60000, unit = TimeUnit.MILLISECONDS) - public void testMaxTotalInvariant() { + void testMaxTotalInvariant() { final int maxTotal = 15; simpleFactory.setEvenValid(false); // Every other validation fails simpleFactory.setDestroyLatency(100); // Destroy takes 100 ms @@ -2311,7 +2311,7 @@ public class TestGenericObjectPool extends TestBaseObjectPool { @Test @Timeout(value = 60000, unit = TimeUnit.MILLISECONDS) @SuppressWarnings("rawtypes") - public void testMaxTotalUnderLoad() { + void testMaxTotalUnderLoad() { // Config final int numThreads = 199; // And main thread makes a round 200. final int numIter = 20; @@ -2373,7 +2373,7 @@ public class TestGenericObjectPool extends TestBaseObjectPool { @Test @Timeout(value = 60000, unit = TimeUnit.MILLISECONDS) - public void testMaxTotalZero() throws Exception { + void testMaxTotalZero() throws Exception { genericObjectPool.setMaxTotal(0); genericObjectPool.setBlockWhenExhausted(false); assertThrows(NoSuchElementException.class, () -> genericObjectPool.borrowObject()); @@ -2390,7 +2390,7 @@ public class TestGenericObjectPool extends TestBaseObjectPool { */ @Test @Timeout(value = 60000, unit = TimeUnit.MILLISECONDS) - public void testMaxWaitMultiThreaded() throws Exception { + void testMaxWaitMultiThreaded() throws Exception { final long maxWait = 500; // wait for connection final long holdTime = 2 * maxWait; // how long to hold connection final int threads = 10; // number of threads to grab the object initially @@ -2436,7 +2436,7 @@ public class TestGenericObjectPool extends TestBaseObjectPool { @Test @Timeout(value = 60000, unit = TimeUnit.MILLISECONDS) - public void testMinIdle() throws Exception { + void testMinIdle() throws Exception { genericObjectPool.setMaxIdle(500); genericObjectPool.setMinIdle(5); genericObjectPool.setMaxTotal(10); @@ -2471,7 +2471,7 @@ public class TestGenericObjectPool extends TestBaseObjectPool { @Test @Timeout(value = 60000, unit = TimeUnit.MILLISECONDS) - public void testMinIdleMaxTotal() throws Exception { + void testMinIdleMaxTotal() throws Exception { genericObjectPool.setMaxIdle(500); genericObjectPool.setMinIdle(5); genericObjectPool.setMaxTotal(10); @@ -2525,7 +2525,7 @@ public class TestGenericObjectPool extends TestBaseObjectPool { * JIRA: POOL-285 */ @Test - public void testMultipleReturn() throws Exception { + void testMultipleReturn() throws Exception { final WaiterFactory<String> factory = new WaiterFactory<>(0, 0, 0, 0, 0, 0); try (GenericObjectPool<Waiter, IllegalStateException> pool = new GenericObjectPool<>(factory)) { pool.setTestOnReturn(true); @@ -2546,7 +2546,7 @@ public class TestGenericObjectPool extends TestBaseObjectPool { // POOL-248 @Test - public void testMultipleReturnOfSameObject() throws Exception { + void testMultipleReturnOfSameObject() throws Exception { try (GenericObjectPool<String, TestException> pool = new GenericObjectPool<>(simpleFactory, new GenericObjectPoolConfig<>())) { @@ -2578,7 +2578,7 @@ public class TestGenericObjectPool extends TestBaseObjectPool { * JIRA: POOL-284 */ @Test - public void testMutable() throws Exception { + void testMutable() throws Exception { final HashSetFactory factory = new HashSetFactory(); try (GenericObjectPool<HashSet<String>, RuntimeException> pool = new GenericObjectPool<>(factory, new GenericObjectPoolConfig<>())) { @@ -2593,7 +2593,7 @@ public class TestGenericObjectPool extends TestBaseObjectPool { @Test @Timeout(value = 60000, unit = TimeUnit.MILLISECONDS) - public void testNegativeMaxTotal() throws Exception { + void testNegativeMaxTotal() throws Exception { genericObjectPool.setMaxTotal(-1); genericObjectPool.setBlockWhenExhausted(false); final String obj = genericObjectPool.borrowObject(); @@ -2605,7 +2605,7 @@ public class TestGenericObjectPool extends TestBaseObjectPool { * Verifies that concurrent threads never "share" instances */ @Test - public void testNoInstanceOverlap() { + void testNoInstanceOverlap() { final int maxTotal = 5; final int numThreads = 100; final int delay = 1; @@ -2627,7 +2627,7 @@ public class TestGenericObjectPool extends TestBaseObjectPool { */ @Test @Timeout(value = 60000, unit = TimeUnit.MILLISECONDS) - public void testNoInvalidateNPE() throws Exception { + void testNoInvalidateNPE() throws Exception { genericObjectPool.setMaxTotal(1); genericObjectPool.setTestOnCreate(true); genericObjectPool.setMaxWait(Duration.ofMillis(-1)); @@ -2651,7 +2651,7 @@ public class TestGenericObjectPool extends TestBaseObjectPool { */ @Test @Timeout(value = 1000, unit = TimeUnit.MILLISECONDS) - public void testNPEOnFactoryNull() throws InterruptedException { + void testNPEOnFactoryNull() throws InterruptedException { final DisconnectingWaiterFactory<String> factory = new DisconnectingWaiterFactory<>( () -> null, // Override default to always return null from makeObject DisconnectingWaiterFactory.DEFAULT_DISCONNECTED_LIFECYCLE_ACTION, @@ -2669,7 +2669,7 @@ public class TestGenericObjectPool extends TestBaseObjectPool { } @Test - public void testPreparePool() throws Exception { + void testPreparePool() throws Exception { genericObjectPool.setMinIdle(1); genericObjectPool.setMaxTotal(1); genericObjectPool.preparePool(); @@ -2685,7 +2685,7 @@ public class TestGenericObjectPool extends TestBaseObjectPool { @Test /* maxWaitMillis x2 + padding */ @Timeout(value = 1200, unit = TimeUnit.MILLISECONDS) - public void testReturnBorrowObjectWithingMaxWaitDuration() throws Exception { + void testReturnBorrowObjectWithingMaxWaitDuration() throws Exception { final Duration maxWaitDuration = Duration.ofMillis(500); try (GenericObjectPool<String, InterruptedException> createSlowObjectFactoryPool = new GenericObjectPool<>( createSlowObjectFactory(Duration.ofSeconds(60)))) { @@ -2705,7 +2705,7 @@ public class TestGenericObjectPool extends TestBaseObjectPool { @Test /* maxWaitMillis x2 + padding */ @Timeout(value = 1200, unit = TimeUnit.MILLISECONDS) - public void testReturnBorrowObjectWithingMaxWaitMillis() throws Exception { + void testReturnBorrowObjectWithingMaxWaitMillis() throws Exception { final long maxWaitMillis = 500; try (GenericObjectPool<String, InterruptedException> createSlowObjectFactoryPool = new GenericObjectPool<>( createSlowObjectFactory(Duration.ofSeconds(60)))) { @@ -2733,7 +2733,7 @@ public class TestGenericObjectPool extends TestBaseObjectPool { */ // @Test @Timeout(value = 60000, unit = TimeUnit.MILLISECONDS) - public void testReturnObject() throws Exception { + void testReturnObject() throws Exception { genericObjectPool.setMaxTotal(1); genericObjectPool.setMaxIdle(-1); @@ -2757,7 +2757,7 @@ public class TestGenericObjectPool extends TestBaseObjectPool { @Test @Timeout(value = 60000, unit = TimeUnit.MILLISECONDS) - public void testSetConfig() throws Exception { + void testSetConfig() throws Exception { final GenericObjectPoolConfig<String> expected = new GenericObjectPoolConfig<>(); assertConfiguration(expected, genericObjectPool); expected.setMaxTotal(2); @@ -2777,7 +2777,7 @@ public class TestGenericObjectPool extends TestBaseObjectPool { @Test @Timeout(value = 60000, unit = TimeUnit.MILLISECONDS) - public void testSettersAndGetters() throws Exception { + void testSettersAndGetters() throws Exception { { // The object receives an Exception during its creation to prevent // memory leaks. See BaseGenericObjectPool constructor for more details. @@ -2872,7 +2872,7 @@ public class TestGenericObjectPool extends TestBaseObjectPool { @Test @Timeout(value = 60000, unit = TimeUnit.MILLISECONDS) - public void testStartAndStopEvictor() throws Exception { + void testStartAndStopEvictor() throws Exception { // set up pool without evictor genericObjectPool.setMaxIdle(6); genericObjectPool.setMaxTotal(6); @@ -2909,7 +2909,7 @@ public class TestGenericObjectPool extends TestBaseObjectPool { } @Test - public void testSwallowedExceptionListener() { + void testSwallowedExceptionListener() { genericObjectPool.setSwallowedExceptionListener(null); // must simply return final List<Exception> swallowedExceptions = new ArrayList<>(); /* @@ -2936,7 +2936,7 @@ public class TestGenericObjectPool extends TestBaseObjectPool { @Test @Timeout(value = 60000, unit = TimeUnit.MILLISECONDS) - public void testThreaded1() throws Exception { + void testThreaded1() throws Exception { genericObjectPool.setMaxTotal(15); genericObjectPool.setMaxIdle(15); genericObjectPool.setMaxWait(Duration.ofMillis(1000)); @@ -2945,7 +2945,7 @@ public class TestGenericObjectPool extends TestBaseObjectPool { @Test @Timeout(value = 60000, unit = TimeUnit.MILLISECONDS) - public void testTimeoutNoLeak() throws Exception { + void testTimeoutNoLeak() throws Exception { genericObjectPool.setMaxTotal(2); genericObjectPool.setMaxWait(Duration.ofMillis(10)); genericObjectPool.setBlockWhenExhausted(true); @@ -2963,7 +2963,7 @@ public class TestGenericObjectPool extends TestBaseObjectPool { * Tests POOL-361 */ @Test - public void testValidateOnCreate() throws Exception { + void testValidateOnCreate() throws Exception { genericObjectPool.setTestOnCreate(true); genericObjectPool.addObject(); assertEquals(1, simpleFactory.validateCounter); @@ -2973,7 +2973,7 @@ public class TestGenericObjectPool extends TestBaseObjectPool { * Tests POOL-361 */ @Test - public void testValidateOnCreateFailure() throws Exception { + void testValidateOnCreateFailure() throws Exception { genericObjectPool.setTestOnCreate(true); genericObjectPool.setTestOnBorrow(false); genericObjectPool.setMaxTotal(2); @@ -3002,7 +3002,7 @@ public class TestGenericObjectPool extends TestBaseObjectPool { * @throws Exception May occur in some failure modes */ @Test - public void testValidationFailureOnReturnFreesCapacity() throws Exception { + void testValidationFailureOnReturnFreesCapacity() throws Exception { final SimpleFactory factory = new SimpleFactory(); factory.setValid(false); // Validate will always fail factory.setValidationEnabled(true); @@ -3026,7 +3026,7 @@ public class TestGenericObjectPool extends TestBaseObjectPool { // POOL-276 @Test - public void testValidationOnCreateOnly() throws Exception { + void testValidationOnCreateOnly() throws Exception { genericObjectPool.setMaxTotal(1); genericObjectPool.setTestOnCreate(true); genericObjectPool.setTestOnBorrow(false); @@ -3052,7 +3052,7 @@ public class TestGenericObjectPool extends TestBaseObjectPool { @Test @Timeout(value = 60000, unit = TimeUnit.MILLISECONDS) - public void testWhenExhaustedBlock() throws Exception { + void testWhenExhaustedBlock() throws Exception { genericObjectPool.setMaxTotal(1); genericObjectPool.setBlockWhenExhausted(true); genericObjectPool.setMaxWait(Duration.ofMillis(10)); @@ -3070,7 +3070,7 @@ public class TestGenericObjectPool extends TestBaseObjectPool { */ @Test @Timeout(value = 60000, unit = TimeUnit.MILLISECONDS) - public void testWhenExhaustedBlockClosePool() throws Exception { + void testWhenExhaustedBlockClosePool() throws Exception { genericObjectPool.setMaxTotal(1); genericObjectPool.setBlockWhenExhausted(true); genericObjectPool.setMaxWait(Duration.ofMillis(-1)); @@ -3097,7 +3097,7 @@ public class TestGenericObjectPool extends TestBaseObjectPool { @Test @Timeout(value = 60000, unit = TimeUnit.MILLISECONDS) - public void testWhenExhaustedBlockInterrupt() throws Exception { + void testWhenExhaustedBlockInterrupt() throws Exception { genericObjectPool.setMaxTotal(1); genericObjectPool.setBlockWhenExhausted(true); genericObjectPool.setMaxWait(Duration.ofMillis(-1)); @@ -3139,7 +3139,7 @@ public class TestGenericObjectPool extends TestBaseObjectPool { @Test @Timeout(value = 60000, unit = TimeUnit.MILLISECONDS) - public void testWhenExhaustedFail() throws Exception { + void testWhenExhaustedFail() throws Exception { genericObjectPool.setMaxTotal(1); genericObjectPool.setBlockWhenExhausted(false); final String obj1 = genericObjectPool.borrowObject(); 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 a5208df1..8a216b29 100644 --- a/src/test/java/org/apache/commons/pool3/impl/TestGenericObjectPoolClassLoaders.java +++ b/src/test/java/org/apache/commons/pool3/impl/TestGenericObjectPoolClassLoaders.java @@ -74,7 +74,7 @@ public class TestGenericObjectPoolClassLoaders { .getResource("/org/apache/commons/pool3/impl/"); @Test - public void testContextClassLoader() throws Exception { + void testContextClassLoader() throws Exception { final ClassLoader savedClassloader = Thread.currentThread().getContextClassLoader(); 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 a47ed05c..40d6988a 100644 --- a/src/test/java/org/apache/commons/pool3/impl/TestGenericObjectPoolFactoryCreateFailure.java +++ b/src/test/java/org/apache/commons/pool3/impl/TestGenericObjectPoolFactoryCreateFailure.java @@ -98,7 +98,7 @@ public class TestGenericObjectPoolFactoryCreateFailure { @Test @Timeout(value = 10_000, unit = TimeUnit.MILLISECONDS) - public void testBorrowObjectStuck() { + void testBorrowObjectStuck() { final SingleObjectFactory factory = new SingleObjectFactory(); final GenericObjectPoolConfig<Object> config = new GenericObjectPoolConfig<>(); config.setMaxIdle(1); diff --git a/src/test/java/org/apache/commons/pool3/impl/TestLinkedBlockingDeque.java b/src/test/java/org/apache/commons/pool3/impl/TestLinkedBlockingDeque.java index abd65512..159cab8e 100644 --- a/src/test/java/org/apache/commons/pool3/impl/TestLinkedBlockingDeque.java +++ b/src/test/java/org/apache/commons/pool3/impl/TestLinkedBlockingDeque.java @@ -52,7 +52,7 @@ public class TestLinkedBlockingDeque { } @Test - public void testAdd() { + void testAdd() { assertTrue(deque.add(ONE)); assertTrue(deque.add(TWO)); assertThrows(IllegalStateException.class, () -> deque.add(THREE)); @@ -60,7 +60,7 @@ public class TestLinkedBlockingDeque { } @Test - public void testAddFirst() { + void testAddFirst() { deque.addFirst(ONE); deque.addFirst(TWO); assertEquals(2, deque.size()); @@ -69,7 +69,7 @@ public class TestLinkedBlockingDeque { } @Test - public void testAddLast() { + void testAddLast() { deque.addLast(ONE); deque.addLast(TWO); assertEquals(2, deque.size()); @@ -78,7 +78,7 @@ public class TestLinkedBlockingDeque { } @Test - public void testClear() { + void testClear() { deque.add(ONE); deque.add(TWO); deque.clear(); @@ -87,7 +87,7 @@ public class TestLinkedBlockingDeque { } @Test - public void testConstructors() { + void testConstructors() { LinkedBlockingDeque<Integer> deque = new LinkedBlockingDeque<>(); assertEquals(Integer.MAX_VALUE, deque.remainingCapacity()); @@ -101,7 +101,7 @@ public class TestLinkedBlockingDeque { } @Test - public void testContains() { + void testContains() { deque.add(ONE); assertTrue(deque.contains(ONE)); assertFalse(deque.contains(TWO)); @@ -112,7 +112,7 @@ public class TestLinkedBlockingDeque { } @Test - public void testDescendingIterator() { + void testDescendingIterator() { assertThrows(NoSuchElementException.class, () -> deque.descendingIterator().next()); deque.add(ONE); deque.add(TWO); @@ -123,7 +123,7 @@ public class TestLinkedBlockingDeque { } @Test - public void testDrainTo() { + void testDrainTo() { Collection<Integer> c = new ArrayList<>(); deque.add(ONE); deque.add(TWO); @@ -140,7 +140,7 @@ public class TestLinkedBlockingDeque { } @Test - public void testElement() { + void testElement() { assertThrows(NoSuchElementException.class, () -> deque.element()); deque.add(ONE); deque.add(TWO); @@ -148,7 +148,7 @@ public class TestLinkedBlockingDeque { } @Test - public void testGetFirst() { + void testGetFirst() { assertThrows(NoSuchElementException.class, () -> deque.getFirst()); deque.add(ONE); deque.add(TWO); @@ -156,7 +156,7 @@ public class TestLinkedBlockingDeque { } @Test - public void testGetLast() { + void testGetLast() { assertThrows(NoSuchElementException.class, () -> deque.getLast()); deque.add(ONE); deque.add(TWO); @@ -164,7 +164,7 @@ public class TestLinkedBlockingDeque { } @Test - public void testIterator() { + void testIterator() { assertThrows(NoSuchElementException.class, () -> deque.iterator().next()); deque.add(ONE); deque.add(TWO); @@ -175,7 +175,7 @@ public class TestLinkedBlockingDeque { } @Test - public void testOffer() { + void testOffer() { assertTrue(deque.offer(ONE)); assertTrue(deque.offer(TWO)); assertFalse(deque.offer(THREE)); @@ -183,7 +183,7 @@ public class TestLinkedBlockingDeque { } @Test - public void testOfferFirst() { + void testOfferFirst() { deque.offerFirst(ONE); deque.offerFirst(TWO); assertEquals(2, deque.size()); @@ -192,7 +192,7 @@ public class TestLinkedBlockingDeque { } @Test - public void testOfferFirstWithTimeout() throws InterruptedException { + void testOfferFirstWithTimeout() throws InterruptedException { assertThrows(NullPointerException.class, () -> deque.offerFirst(null, TIMEOUT_50_MILLIS)); assertTrue(deque.offerFirst(ONE, TIMEOUT_50_MILLIS)); assertTrue(deque.offerFirst(TWO, TIMEOUT_50_MILLIS)); @@ -200,7 +200,7 @@ public class TestLinkedBlockingDeque { } @Test - public void testOfferLast() { + void testOfferLast() { deque.offerLast(ONE); deque.offerLast(TWO); assertEquals(2, deque.size()); @@ -209,7 +209,7 @@ public class TestLinkedBlockingDeque { } @Test - public void testOfferLastWithTimeout() throws InterruptedException { + void testOfferLastWithTimeout() throws InterruptedException { assertThrows(NullPointerException.class, () -> deque.offerLast(null, TIMEOUT_50_MILLIS)); assertTrue(deque.offerLast(ONE, TIMEOUT_50_MILLIS)); assertTrue(deque.offerLast(TWO, TIMEOUT_50_MILLIS)); @@ -217,7 +217,7 @@ public class TestLinkedBlockingDeque { } @Test - public void testOfferWithTimeout() throws InterruptedException { + void testOfferWithTimeout() throws InterruptedException { assertTrue(deque.offer(ONE, TIMEOUT_50_MILLIS)); assertTrue(deque.offer(TWO, TIMEOUT_50_MILLIS)); assertFalse(deque.offer(THREE, TIMEOUT_50_MILLIS)); @@ -225,7 +225,7 @@ public class TestLinkedBlockingDeque { } @Test - public void testPeek() { + void testPeek() { assertNull(deque.peek()); deque.add(ONE); deque.add(TWO); @@ -233,7 +233,7 @@ public class TestLinkedBlockingDeque { } @Test - public void testPeekFirst() { + void testPeekFirst() { assertNull(deque.peekFirst()); deque.add(ONE); deque.add(TWO); @@ -241,7 +241,7 @@ public class TestLinkedBlockingDeque { } @Test - public void testPeekLast() { + void testPeekLast() { assertNull(deque.peekLast()); deque.add(ONE); deque.add(TWO); @@ -249,7 +249,7 @@ public class TestLinkedBlockingDeque { } @Test - public void testPollFirst() { + void testPollFirst() { assertNull(deque.pollFirst()); assertTrue(deque.offerFirst(ONE)); assertTrue(deque.offerFirst(TWO)); @@ -257,13 +257,13 @@ public class TestLinkedBlockingDeque { } @Test - public void testPollFirstWithTimeout() throws InterruptedException { + void testPollFirstWithTimeout() throws InterruptedException { assertNull(deque.pollFirst()); assertNull(deque.pollFirst(TIMEOUT_50_MILLIS)); } @Test - public void testPollLast() { + void testPollLast() { assertNull(deque.pollLast()); assertTrue(deque.offerFirst(ONE)); assertTrue(deque.offerFirst(TWO)); @@ -271,19 +271,19 @@ public class TestLinkedBlockingDeque { } @Test - public void testPollLastWithTimeout() throws InterruptedException { + void testPollLastWithTimeout() throws InterruptedException { assertNull(deque.pollLast()); assertNull(deque.pollLast(TIMEOUT_50_MILLIS)); } @Test - public void testPollWithTimeout() throws InterruptedException { + void testPollWithTimeout() throws InterruptedException { assertNull(deque.poll(TIMEOUT_50_MILLIS)); assertNull(deque.poll(TIMEOUT_50_MILLIS)); } @Test - public void testPop() { + void testPop() { assertThrows(NoSuchElementException.class, () -> deque.pop()); deque.add(ONE); deque.add(TWO); @@ -301,7 +301,7 @@ public class TestLinkedBlockingDeque { */ @Test @Timeout(value = 10000, unit = TimeUnit.MILLISECONDS) - public void testPossibleBug() { + void testPossibleBug() { deque = new LinkedBlockingDeque<>(); for (int i = 0; i < 3; i++) { @@ -322,7 +322,7 @@ public class TestLinkedBlockingDeque { } @Test - public void testPush() { + void testPush() { deque.push(ONE); deque.push(TWO); assertEquals(2, deque.size()); @@ -331,14 +331,14 @@ public class TestLinkedBlockingDeque { } @Test - public void testPut() throws InterruptedException { + void testPut() throws InterruptedException { assertThrows(NullPointerException.class, () -> deque.put(null)); deque.put(ONE); deque.put(TWO); } @Test - public void testPutFirst() throws InterruptedException { + void testPutFirst() throws InterruptedException { assertThrows(NullPointerException.class, () -> deque.putFirst(null)); deque.putFirst(ONE); deque.putFirst(TWO); @@ -347,7 +347,7 @@ public class TestLinkedBlockingDeque { } @Test - public void testPutLast() throws InterruptedException { + void testPutLast() throws InterruptedException { assertThrows(NullPointerException.class, () -> deque.putLast(null)); deque.putLast(ONE); deque.putLast(TWO); @@ -356,7 +356,7 @@ public class TestLinkedBlockingDeque { } @Test - public void testRemove() { + void testRemove() { assertThrows(NoSuchElementException.class, deque::remove); deque.add(ONE); deque.add(TWO); @@ -364,7 +364,7 @@ public class TestLinkedBlockingDeque { } @Test - public void testRemoveFirst() { + void testRemoveFirst() { assertThrows(NoSuchElementException.class, deque::removeFirst); deque.add(ONE); deque.add(TWO); @@ -376,7 +376,7 @@ public class TestLinkedBlockingDeque { } @Test - public void testRemoveLast() { + void testRemoveLast() { assertThrows(NoSuchElementException.class, deque::removeLast); deque.add(ONE); deque.add(TWO); @@ -388,7 +388,7 @@ public class TestLinkedBlockingDeque { } @Test - public void testRemoveLastOccurrence() { + void testRemoveLastOccurrence() { assertFalse(deque.removeLastOccurrence(null)); assertFalse(deque.removeLastOccurrence(ONE)); deque.add(ONE); @@ -398,28 +398,28 @@ public class TestLinkedBlockingDeque { } @Test - public void testTake() throws InterruptedException { + void testTake() throws InterruptedException { assertTrue(deque.offerFirst(ONE)); assertTrue(deque.offerFirst(TWO)); assertEquals(Integer.valueOf(2), deque.take()); } @Test - public void testTakeFirst() throws InterruptedException { + void testTakeFirst() throws InterruptedException { assertTrue(deque.offerFirst(ONE)); assertTrue(deque.offerFirst(TWO)); assertEquals(Integer.valueOf(2), deque.takeFirst()); } @Test - public void testTakeLast() throws InterruptedException { + void testTakeLast() throws InterruptedException { assertTrue(deque.offerFirst(ONE)); assertTrue(deque.offerFirst(TWO)); assertEquals(Integer.valueOf(1), deque.takeLast()); } @Test - public void testToArray() { + void testToArray() { deque.add(ONE); deque.add(TWO); Object[] arr = deque.toArray(); diff --git a/src/test/java/org/apache/commons/pool3/impl/TestPoolImplUtils.java b/src/test/java/org/apache/commons/pool3/impl/TestPoolImplUtils.java index 1af2a5b8..a474f1ad 100644 --- a/src/test/java/org/apache/commons/pool3/impl/TestPoolImplUtils.java +++ b/src/test/java/org/apache/commons/pool3/impl/TestPoolImplUtils.java @@ -80,19 +80,19 @@ public class TestPoolImplUtils { private static final Instant INSTANT_0 = Instant.ofEpochMilli(0); @Test - public void testFactoryTypeNotSimple() { + void testFactoryTypeNotSimple() { final Class<?> result = PoolImplUtils.getFactoryType(NotSimpleFactory.class); assertEquals(Long.class, result); } @Test - public void testFactoryTypeSimple() { + void testFactoryTypeSimple() { final Class<?> result = PoolImplUtils.getFactoryType(SimpleFactory.class); assertEquals(String.class, result); } @Test - public void testMaxInstants() { + void testMaxInstants() { assertEquals(INSTANT_1, PoolImplUtils.max(INSTANT_0, INSTANT_1)); assertEquals(INSTANT_1, PoolImplUtils.max(INSTANT_1, INSTANT_0)); assertEquals(INSTANT_1, PoolImplUtils.max(INSTANT_1, INSTANT_1)); @@ -100,7 +100,7 @@ public class TestPoolImplUtils { } @Test - public void testMinInstants() { + void testMinInstants() { assertEquals(INSTANT_0, PoolImplUtils.min(INSTANT_0, INSTANT_1)); assertEquals(INSTANT_0, PoolImplUtils.min(INSTANT_1, INSTANT_0)); assertEquals(INSTANT_1, PoolImplUtils.min(INSTANT_1, INSTANT_1)); @@ -108,7 +108,7 @@ public class TestPoolImplUtils { } @Test - public void testToChronoUnit() { + void testToChronoUnit() { assertEquals(ChronoUnit.NANOS, PoolImplUtils.toChronoUnit(TimeUnit.NANOSECONDS)); assertEquals(ChronoUnit.MICROS, PoolImplUtils.toChronoUnit(TimeUnit.MICROSECONDS)); assertEquals(ChronoUnit.MILLIS, PoolImplUtils.toChronoUnit(TimeUnit.MILLISECONDS)); @@ -119,7 +119,7 @@ public class TestPoolImplUtils { } @Test - public void testToDuration() { + void testToDuration() { assertEquals(Duration.ZERO, PoolImplUtils.toDuration(0, TimeUnit.MILLISECONDS)); assertEquals(Duration.ofMillis(1), PoolImplUtils.toDuration(1, TimeUnit.MILLISECONDS)); for (final TimeUnit tu : TimeUnit.values()) { diff --git a/src/test/java/org/apache/commons/pool3/impl/TestPooledSoftReference.java b/src/test/java/org/apache/commons/pool3/impl/TestPooledSoftReference.java index 4cf88218..b616242a 100644 --- a/src/test/java/org/apache/commons/pool3/impl/TestPooledSoftReference.java +++ b/src/test/java/org/apache/commons/pool3/impl/TestPooledSoftReference.java @@ -39,7 +39,7 @@ public class TestPooledSoftReference { } @Test - public void testPooledSoftReference() { + void testPooledSoftReference() { assertEquals(REFERENT, ref.getObject()); SoftReference<String> softRef = ref.getReference(); @@ -57,7 +57,7 @@ public class TestPooledSoftReference { } @Test - public void testToString() { + void testToString() { final String expected = "Referenced Object: test, State: IDLE"; assertEquals(expected, ref.toString()); } 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 51124457..003fd177 100644 --- a/src/test/java/org/apache/commons/pool3/impl/TestResilientPooledObjectFactory.java +++ b/src/test/java/org/apache/commons/pool3/impl/TestResilientPooledObjectFactory.java @@ -96,7 +96,7 @@ public class TestResilientPooledObjectFactory { } @Test - public void testAdderStartStop() throws Exception { + void testAdderStartStop() throws Exception { final FailingFactory ff = new FailingFactory(); // Make the factory fail with exception immediately on make ff.setSilentFail(true); @@ -169,7 +169,7 @@ public class TestResilientPooledObjectFactory { } @Test - public void testConstructorWithDefaults() { + void testConstructorWithDefaults() { final FailingFactory ff = new FailingFactory(); final ResilientPooledObjectFactory<String, Exception> rf = new ResilientPooledObjectFactory<>(ff); assertFalse(rf.isMonitorRunning()); @@ -185,7 +185,7 @@ public class TestResilientPooledObjectFactory { } @Test - public void testIsMonitorRunning() throws Exception { + void testIsMonitorRunning() throws Exception { final FailingFactory ff = new FailingFactory(); // Make the factory fail with exception immediately on make ff.setSilentFail(true); @@ -208,7 +208,7 @@ public class TestResilientPooledObjectFactory { } @Test - public void testNulls() throws Exception { + void testNulls() throws Exception { final FailingFactory ff = new FailingFactory(); // Make the factory fail with exception immediately on make ff.setSilentFail(true); @@ -286,7 +286,7 @@ public class TestResilientPooledObjectFactory { } @Test - public void testTransientFailure() throws Exception { + void testTransientFailure() throws Exception { final FailingFactory ff = new FailingFactory(); // Make the factory fail with exception immediately on make ff.setHang(false); 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 3e25ba23..d891a572 100644 --- a/src/test/java/org/apache/commons/pool3/impl/TestSoftRefOutOfMemory.java +++ b/src/test/java/org/apache/commons/pool3/impl/TestSoftRefOutOfMemory.java @@ -135,7 +135,7 @@ public class TestSoftRefOutOfMemory { } @Test - public void testOutOfMemory() throws Exception { + void testOutOfMemory() throws Exception { pool = new SoftReferenceObjectPool<>(new SmallPoolableObjectFactory()); String obj = pool.borrowObject(); @@ -171,7 +171,7 @@ public class TestSoftRefOutOfMemory { } @Test - public void testOutOfMemory1000() throws Exception { + void testOutOfMemory1000() throws Exception { pool = new SoftReferenceObjectPool<>(new SmallPoolableObjectFactory()); for (int i = 0 ; i < 1000 ; i++) { @@ -216,7 +216,7 @@ public class TestSoftRefOutOfMemory { * @throws Exception May occur in some failure modes */ @Test - public void testOutOfMemoryError() throws Exception { + void testOutOfMemoryError() throws Exception { pool = new SoftReferenceObjectPool<>(new OomeFactory(OomeTrigger.CREATE)); assertThrows(OutOfMemoryError.class, pool::borrowObject); pool.close(); @@ -231,7 +231,7 @@ public class TestSoftRefOutOfMemory { } @Test - public void testOutOfMemoryLarge() throws Exception { + void testOutOfMemoryLarge() throws Exception { pool = new SoftReferenceObjectPool<>(new LargePoolableObjectFactory(1000000)); String obj = pool.borrowObject(); 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 7c38052e..41cc635c 100644 --- a/src/test/java/org/apache/commons/pool3/pool407/KeyedPool407Test.java +++ b/src/test/java/org/apache/commons/pool3/pool407/KeyedPool407Test.java @@ -83,37 +83,37 @@ public class KeyedPool407Test extends AbstractPool407Test { } @Test - public void testNormalFactoryNonNullFixtureWaitMax() throws InterruptedException { + void testNormalFactoryNonNullFixtureWaitMax() throws InterruptedException { test(new KeyedPool407NormalFactory(new KeyedPool407Fixture()), Pool407Constants.POOL_SIZE, Pool407Constants.WAIT_FOREVER); } @Disabled @Test - public void testNormalFactoryNullFixtureWaitMax() throws InterruptedException { + void testNormalFactoryNullFixtureWaitMax() throws InterruptedException { test(new KeyedPool407NormalFactory(null), Pool407Constants.POOL_SIZE, Pool407Constants.WAIT_FOREVER); } @Disabled @Test - public void testNullObjectFactoryWaitMax() throws InterruptedException { + void testNullObjectFactoryWaitMax() throws InterruptedException { test(new KeyedPool407NullObjectFactory(), Pool407Constants.POOL_SIZE, Pool407Constants.WAIT_FOREVER); } @Disabled @Test - public void testNullObjectFactoryWaitShort() throws InterruptedException { + void testNullObjectFactoryWaitShort() throws InterruptedException { test(new KeyedPool407NullObjectFactory(), Pool407Constants.POOL_SIZE, Pool407Constants.WAIT_SHORT); } @Disabled @Test - public void testNullPoolableFactoryWaitMax() throws InterruptedException { + void testNullPoolableFactoryWaitMax() throws InterruptedException { test(new KeyedPool407NullPoolableObjectFactory(), Pool407Constants.POOL_SIZE, Pool407Constants.WAIT_FOREVER); } @Disabled @Test - public void testNullPoolableFactoryWaitShort() throws InterruptedException { + void testNullPoolableFactoryWaitShort() throws InterruptedException { test(new KeyedPool407NullPoolableObjectFactory(), Pool407Constants.POOL_SIZE, Pool407Constants.WAIT_SHORT); } } 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 27737c53..65f3b4d1 100644 --- a/src/test/java/org/apache/commons/pool3/pool407/Pool407Test.java +++ b/src/test/java/org/apache/commons/pool3/pool407/Pool407Test.java @@ -81,37 +81,37 @@ public class Pool407Test extends AbstractPool407Test { } @Test - public void testNormalFactoryNonNullFixtureWaitMax() throws InterruptedException { + void testNormalFactoryNonNullFixtureWaitMax() throws InterruptedException { test(new Pool407NormalFactory(new Pool407Fixture()), Pool407Constants.POOL_SIZE, Pool407Constants.WAIT_FOREVER); } @Test @Disabled - public void testNormalFactoryNullFixtureWaitMax() throws InterruptedException { + void testNormalFactoryNullFixtureWaitMax() throws InterruptedException { test(new Pool407NormalFactory(null), Pool407Constants.POOL_SIZE, Pool407Constants.WAIT_FOREVER); } @Disabled @Test - public void testNullObjectFactoryWaitMax() throws InterruptedException { + void testNullObjectFactoryWaitMax() throws InterruptedException { test(new Pool407NullObjectFactory(), Pool407Constants.POOL_SIZE, Pool407Constants.WAIT_FOREVER); } @Test @Disabled - public void testNullObjectFactoryWaitShort() throws InterruptedException { + void testNullObjectFactoryWaitShort() throws InterruptedException { test(new Pool407NullObjectFactory(), Pool407Constants.POOL_SIZE, Pool407Constants.WAIT_SHORT); } @Test @Disabled - public void testNullPoolableFactoryWaitMax() throws InterruptedException { + void testNullPoolableFactoryWaitMax() throws InterruptedException { test(new Pool407NullPoolableObjectFactory(), Pool407Constants.POOL_SIZE, Pool407Constants.WAIT_FOREVER); } @Test @Disabled - public void testNullPoolableFactoryWaitShort() throws InterruptedException { + void testNullPoolableFactoryWaitShort() throws InterruptedException { test(new Pool407NullPoolableObjectFactory(), Pool407Constants.POOL_SIZE, Pool407Constants.WAIT_SHORT); } } diff --git a/src/test/java/org/apache/commons/pool3/proxy/AbstractTestProxiedKeyedObjectPool.java b/src/test/java/org/apache/commons/pool3/proxy/AbstractTestProxiedKeyedObjectPool.java index f16c6f29..54d440ac 100644 --- a/src/test/java/org/apache/commons/pool3/proxy/AbstractTestProxiedKeyedObjectPool.java +++ b/src/test/java/org/apache/commons/pool3/proxy/AbstractTestProxiedKeyedObjectPool.java @@ -107,7 +107,7 @@ public abstract class AbstractTestProxiedKeyedObjectPool { } @Test - public void testAccessAfterInvalidate() { + void testAccessAfterInvalidate() { final TestObject obj = pool.borrowObject(KEY1); assertNotNull(obj); @@ -125,7 +125,7 @@ public abstract class AbstractTestProxiedKeyedObjectPool { } @Test - public void testAccessAfterReturn() { + void testAccessAfterReturn() { final TestObject obj = pool.borrowObject(KEY1); assertNotNull(obj); @@ -141,7 +141,7 @@ public abstract class AbstractTestProxiedKeyedObjectPool { } @Test - public void testBorrowObject() { + void testBorrowObject() { final TestObject obj = pool.borrowObject(KEY1); assertNotNull(obj); @@ -153,7 +153,7 @@ public abstract class AbstractTestProxiedKeyedObjectPool { } @Test - public void testPassThroughMethods01() { + void testPassThroughMethods01() { assertEquals(0, pool.getNumActive()); assertEquals(0, pool.getNumIdle()); @@ -169,14 +169,14 @@ public abstract class AbstractTestProxiedKeyedObjectPool { } @Test - public void testPassThroughMethods02() { + void testPassThroughMethods02() { pool.close(); assertThrows(IllegalStateException.class, () -> pool.addObject(KEY1)); } @Test - public void testUsageTracking() throws InterruptedException { + void testUsageTracking() throws InterruptedException { final TestObject obj = pool.borrowObject(KEY1); assertNotNull(obj); diff --git a/src/test/java/org/apache/commons/pool3/proxy/AbstractTestProxiedObjectPool.java b/src/test/java/org/apache/commons/pool3/proxy/AbstractTestProxiedObjectPool.java index 10e3cf2d..cc4b8a8b 100644 --- a/src/test/java/org/apache/commons/pool3/proxy/AbstractTestProxiedObjectPool.java +++ b/src/test/java/org/apache/commons/pool3/proxy/AbstractTestProxiedObjectPool.java @@ -126,7 +126,7 @@ public abstract class AbstractTestProxiedObjectPool { } @Test - public void testAccessAfterInvalidate() { + void testAccessAfterInvalidate() { @SuppressWarnings("resource") final ObjectPool<TestObject, RuntimeException> pool = createProxiedObjectPool(); @@ -147,7 +147,7 @@ public abstract class AbstractTestProxiedObjectPool { } @Test - public void testAccessAfterReturn() { + void testAccessAfterReturn() { @SuppressWarnings("resource") final ObjectPool<TestObject, RuntimeException> pool = createProxiedObjectPool(); @@ -167,7 +167,7 @@ public abstract class AbstractTestProxiedObjectPool { } @Test - public void testBorrowObject() { + void testBorrowObject() { @SuppressWarnings("resource") final ObjectPool<TestObject, RuntimeException> pool = createProxiedObjectPool(); @@ -182,7 +182,7 @@ public abstract class AbstractTestProxiedObjectPool { } @Test - public void testPassThroughMethods01() { + void testPassThroughMethods01() { @SuppressWarnings("resource") final ObjectPool<TestObject, RuntimeException> pool = createProxiedObjectPool(); @@ -201,7 +201,7 @@ public abstract class AbstractTestProxiedObjectPool { } @Test - public void testPassThroughMethods02() { + void testPassThroughMethods02() { final ObjectPool<TestObject, RuntimeException> pool = createProxiedObjectPool(); pool.close(); @@ -211,7 +211,7 @@ public abstract class AbstractTestProxiedObjectPool { } @Test - public void testUsageTracking() throws InterruptedException { + void testUsageTracking() throws InterruptedException { @SuppressWarnings("resource") final ObjectPool<TestObject, RuntimeException> pool = createProxiedObjectPool(); @@ -234,7 +234,7 @@ public abstract class AbstractTestProxiedObjectPool { } @Test - public void testUnwrapInvocationTargetExceptionTrue() { + void testUnwrapInvocationTargetExceptionTrue() { @SuppressWarnings("resource") final ObjectPool<TestObject, RuntimeException> pool = createProxiedObjectPool(true, new MyException()); @@ -243,7 +243,7 @@ public abstract class AbstractTestProxiedObjectPool { } @Test - public void testUnwrapInvocationTargetExceptionFalse() { + void testUnwrapInvocationTargetExceptionFalse() { @SuppressWarnings("resource") final ObjectPool<TestObject, RuntimeException> pool = createProxiedObjectPool(false, new MyException());