You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@commons.apache.org by gg...@apache.org on 2025/06/10 14:01:26 UTC
(commons-pool) branch master updated (8e3a2983 -> 03b29cdf)
This is an automated email from the ASF dual-hosted git repository.
ggregory pushed a change to branch master
in repository https://gitbox.apache.org/repos/asf/commons-pool.git
from 8e3a2983 Use JUnit 5 convention for class visibility
new d6da62d9 Sort members
new b1b939ae [POOL-422] org.apache.commons.pool3.impl.GenericObjectPool.create(Duration) duration computation doesn't match 2.x
new 03b29cdf Use JUnit 5 method visibility convention
The 3 revisions listed above as "new" are entirely new to this
repository and will be described in separate emails. The revisions
listed as "add" were already present in the repository and have only
been added to this reference.
Summary of changes:
.../pool3/proxy/AbstractTestProxiedObjectPool.java | 60 +++++++++++-----------
.../proxy/TestProxiedObjectPoolWithCglibProxy.java | 10 ++--
.../proxy/TestProxiedObjectPoolWithJdkProxy.java | 10 ++--
3 files changed, 40 insertions(+), 40 deletions(-)
(commons-pool) 01/03: Sort members
Posted by gg...@apache.org.
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
commit d6da62d97736297a9045ec08d5c93e01c2d26581
Author: Gary Gregory <ga...@gmail.com>
AuthorDate: Tue Jun 10 09:42:37 2025 -0400
Sort members
---
.../pool3/proxy/AbstractTestProxiedObjectPool.java | 48 +++++++++++-----------
.../proxy/TestProxiedObjectPoolWithCglibProxy.java | 10 ++---
.../proxy/TestProxiedObjectPoolWithJdkProxy.java | 10 ++---
3 files changed, 34 insertions(+), 34 deletions(-)
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..37cc25df 100644
--- a/src/test/java/org/apache/commons/pool3/proxy/AbstractTestProxiedObjectPool.java
+++ b/src/test/java/org/apache/commons/pool3/proxy/AbstractTestProxiedObjectPool.java
@@ -38,6 +38,8 @@ import org.junit.jupiter.api.Test;
public abstract class AbstractTestProxiedObjectPool {
+ private static class MyException extends RuntimeException { }
+
protected interface TestObject {
String getData();
void setData(String data);
@@ -94,8 +96,6 @@ public abstract class AbstractTestProxiedObjectPool {
private StringWriter log;
- protected abstract ProxySource<TestObject> getProxySource(boolean unwrapInvocationTargetException);
-
private ProxiedObjectPool<TestObject, RuntimeException> createProxiedObjectPool() {
return createProxiedObjectPool(false, null);
}
@@ -120,6 +120,10 @@ public abstract class AbstractTestProxiedObjectPool {
return new ProxiedObjectPool<>(innerPool, getProxySource(unwrapInvocationTargetException));
}
+ protected abstract Class<? extends Throwable> getInvocationTargetExceptionType();
+
+ protected abstract ProxySource<TestObject> getProxySource(boolean unwrapInvocationTargetException);
+
@BeforeEach
public void setUp() {
log = new StringWriter();
@@ -210,6 +214,24 @@ public abstract class AbstractTestProxiedObjectPool {
() -> pool.addObject());
}
+ @Test
+ public void testUnwrapInvocationTargetExceptionFalse() {
+ @SuppressWarnings("resource")
+ final ObjectPool<TestObject, RuntimeException> pool = createProxiedObjectPool(false, new MyException());
+
+ final TestObject object = pool.borrowObject();
+ assertThrows(getInvocationTargetExceptionType(), object::getData);
+ }
+
+ @Test
+ public void testUnwrapInvocationTargetExceptionTrue() {
+ @SuppressWarnings("resource")
+ final ObjectPool<TestObject, RuntimeException> pool = createProxiedObjectPool(true, new MyException());
+
+ final TestObject object = pool.borrowObject();
+ assertThrows(MyException.class, object::getData);
+ }
+
@Test
public void testUsageTracking() throws InterruptedException {
@SuppressWarnings("resource")
@@ -232,26 +254,4 @@ public abstract class AbstractTestProxiedObjectPool {
assertTrue(logOutput.contains("Pooled object created"));
assertTrue(logOutput.contains("The last code to use this object was"));
}
-
- @Test
- public void testUnwrapInvocationTargetExceptionTrue() {
- @SuppressWarnings("resource")
- final ObjectPool<TestObject, RuntimeException> pool = createProxiedObjectPool(true, new MyException());
-
- final TestObject object = pool.borrowObject();
- assertThrows(MyException.class, object::getData);
- }
-
- @Test
- public void testUnwrapInvocationTargetExceptionFalse() {
- @SuppressWarnings("resource")
- final ObjectPool<TestObject, RuntimeException> pool = createProxiedObjectPool(false, new MyException());
-
- final TestObject object = pool.borrowObject();
- assertThrows(getInvocationTargetExceptionType(), object::getData);
- }
-
- protected abstract Class<? extends Throwable> getInvocationTargetExceptionType();
-
- private static class MyException extends RuntimeException { }
}
diff --git a/src/test/java/org/apache/commons/pool3/proxy/TestProxiedObjectPoolWithCglibProxy.java b/src/test/java/org/apache/commons/pool3/proxy/TestProxiedObjectPoolWithCglibProxy.java
index c7914918..3b0f6781 100644
--- a/src/test/java/org/apache/commons/pool3/proxy/TestProxiedObjectPoolWithCglibProxy.java
+++ b/src/test/java/org/apache/commons/pool3/proxy/TestProxiedObjectPoolWithCglibProxy.java
@@ -21,6 +21,11 @@ import java.lang.reflect.InvocationTargetException;
public class TestProxiedObjectPoolWithCglibProxy extends AbstractTestProxiedObjectPool {
+ @Override
+ protected Class<? extends Throwable> getInvocationTargetExceptionType() {
+ return InvocationTargetException.class;
+ }
+
@Override
protected ProxySource<TestObject> getProxySource(boolean unwrapInvocationTargetException) {
// @formatter:off
@@ -30,9 +35,4 @@ public class TestProxiedObjectPoolWithCglibProxy extends AbstractTestProxiedObje
.get();
// @formatter:on
}
-
- @Override
- protected Class<? extends Throwable> getInvocationTargetExceptionType() {
- return InvocationTargetException.class;
- }
}
diff --git a/src/test/java/org/apache/commons/pool3/proxy/TestProxiedObjectPoolWithJdkProxy.java b/src/test/java/org/apache/commons/pool3/proxy/TestProxiedObjectPoolWithJdkProxy.java
index becd2418..b9b57c06 100644
--- a/src/test/java/org/apache/commons/pool3/proxy/TestProxiedObjectPoolWithJdkProxy.java
+++ b/src/test/java/org/apache/commons/pool3/proxy/TestProxiedObjectPoolWithJdkProxy.java
@@ -21,6 +21,11 @@ import java.lang.reflect.UndeclaredThrowableException;
public class TestProxiedObjectPoolWithJdkProxy extends AbstractTestProxiedObjectPool {
+ @Override
+ protected Class<? extends Throwable> getInvocationTargetExceptionType() {
+ return UndeclaredThrowableException.class;
+ }
+
@Override
protected ProxySource<TestObject> getProxySource(boolean unwrapInvocationTargetException) {
// @formatter:off
@@ -31,9 +36,4 @@ public class TestProxiedObjectPoolWithJdkProxy extends AbstractTestProxiedObject
.get();
// @formatter:on
}
-
- @Override
- protected Class<? extends Throwable> getInvocationTargetExceptionType() {
- return UndeclaredThrowableException.class;
- }
}
(commons-pool) 03/03: Use JUnit 5 method visibility convention
Posted by gg...@apache.org.
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
commit 03b29cdf2177ab9f968eaf2404feae467e149ee5
Author: Gary Gregory <ga...@gmail.com>
AuthorDate: Tue Jun 10 10:01:20 2025 -0400
Use JUnit 5 method visibility convention
---
.../commons/pool3/AbstractTestKeyedObjectPool.java | 30 ++--
.../commons/pool3/AbstractTestObjectPool.java | 16 +-
.../java/org/apache/commons/pool3/PoolTest.java | 4 +-
.../pool3/TestBaseKeyedPooledObjectFactory.java | 4 +-
.../apache/commons/pool3/TestBaseObjectPool.java | 18 +--
.../pool3/TestBasePoolableObjectFactory.java | 6 +-
.../org/apache/commons/pool3/TestPoolUtils.java | 34 ++--
.../org/apache/commons/pool3/TestTrackedUse.java | 4 +-
.../apache/commons/pool3/impl/CallStackTest.java | 6 +-
.../commons/pool3/impl/NoOpCallStackTest.java | 4 +-
.../pool3/impl/TestAbandonedKeyedObjectPool.java | 18 +--
.../pool3/impl/TestAbandonedObjectPool.java | 18 +--
.../pool3/impl/TestBaseGenericObjectPool.java | 12 +-
.../commons/pool3/impl/TestCallStackUtils.java | 4 +-
.../apache/commons/pool3/impl/TestConstants.java | 2 +-
.../pool3/impl/TestDefaultPooledObject.java | 12 +-
.../pool3/impl/TestDefaultPooledObjectInfo.java | 10 +-
.../commons/pool3/impl/TestEvictionConfig.java | 6 +-
.../commons/pool3/impl/TestEvictionTimer.java | 4 +-
.../pool3/impl/TestGenericKeyedObjectPool.java | 138 ++++++++--------
.../commons/pool3/impl/TestGenericObjectPool.java | 174 ++++++++++-----------
.../impl/TestGenericObjectPoolClassLoaders.java | 4 +-
.../TestGenericObjectPoolFactoryCreateFailure.java | 4 +-
.../pool3/impl/TestLinkedBlockingDeque.java | 82 +++++-----
.../commons/pool3/impl/TestPoolImplUtils.java | 14 +-
.../pool3/impl/TestPooledSoftReference.java | 6 +-
.../impl/TestResilientPooledObjectFactory.java | 12 +-
.../commons/pool3/impl/TestSoftRefOutOfMemory.java | 14 +-
.../pool3/impl/TestSoftReferenceObjectPool.java | 2 +-
.../commons/pool3/performance/PerformanceTest.java | 2 +-
.../commons/pool3/pool407/AbstractPool407Test.java | 2 +-
.../commons/pool3/pool407/KeyedPool407Test.java | 14 +-
.../apache/commons/pool3/pool407/Pool407Test.java | 14 +-
.../proxy/AbstractTestProxiedKeyedObjectPool.java | 12 +-
.../TestProxiedKeyedObjectPoolWithCglibProxy.java | 2 +-
.../TestProxiedKeyedObjectPoolWithJdkProxy.java | 2 +-
.../proxy/TestProxiedObjectPoolWithCglibProxy.java | 2 +-
.../proxy/TestProxiedObjectPoolWithJdkProxy.java | 2 +-
38 files changed, 358 insertions(+), 356 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..5d87c883 100644
--- a/src/test/java/org/apache/commons/pool3/PoolTest.java
+++ b/src/test/java/org/apache/commons/pool3/PoolTest.java
@@ -29,7 +29,7 @@ import org.junit.jupiter.api.Disabled;
import org.junit.jupiter.api.Test;
@Disabled
-public class PoolTest {
+class PoolTest {
private static final class Foo {
}
@@ -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..e97a415f 100644
--- a/src/test/java/org/apache/commons/pool3/TestBaseKeyedPooledObjectFactory.java
+++ b/src/test/java/org/apache/commons/pool3/TestBaseKeyedPooledObjectFactory.java
@@ -23,7 +23,7 @@ import org.junit.jupiter.api.Test;
/**
*/
-public class TestBaseKeyedPooledObjectFactory {
+class TestBaseKeyedPooledObjectFactory {
private static final class TestFactory extends BaseKeyedPooledObjectFactory<Object, Object, RuntimeException> {
@Override
@@ -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..7bbd6d00 100644
--- a/src/test/java/org/apache/commons/pool3/TestBasePoolableObjectFactory.java
+++ b/src/test/java/org/apache/commons/pool3/TestBasePoolableObjectFactory.java
@@ -26,7 +26,7 @@ import org.junit.jupiter.api.Test;
/**
*/
-public class TestBasePoolableObjectFactory {
+class TestBasePoolableObjectFactory {
private static final class TestFactory extends BasePooledObjectFactory<AtomicInteger, RuntimeException> {
@Override
@@ -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..8fdc8ca9 100644
--- a/src/test/java/org/apache/commons/pool3/TestPoolUtils.java
+++ b/src/test/java/org/apache/commons/pool3/TestPoolUtils.java
@@ -45,7 +45,7 @@ import org.opentest4j.AssertionFailedError;
*
* TODO Replace our own mocking with a mocking library like Mockito.
*/
-public class TestPoolUtils {
+class TestPoolUtils {
private static class MethodCallLogger implements InvocationHandler {
private final List<String> calledMethods;
@@ -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..b97bfb57 100644
--- a/src/test/java/org/apache/commons/pool3/TestTrackedUse.java
+++ b/src/test/java/org/apache/commons/pool3/TestTrackedUse.java
@@ -23,7 +23,7 @@ import java.time.Instant;
import org.junit.jupiter.api.Test;
-public class TestTrackedUse {
+class TestTrackedUse {
final class DefaultTrackedUse implements TrackedUse {
@@ -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..b28067ed 100644
--- a/src/test/java/org/apache/commons/pool3/impl/CallStackTest.java
+++ b/src/test/java/org/apache/commons/pool3/impl/CallStackTest.java
@@ -27,7 +27,7 @@ import org.junit.jupiter.params.ParameterizedTest;
import org.junit.jupiter.params.provider.Arguments;
import org.junit.jupiter.params.provider.MethodSource;
-public class CallStackTest {
+class CallStackTest {
public static Stream<Arguments> data() {
// @formatter:off
@@ -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..40f5ef0c 100644
--- a/src/test/java/org/apache/commons/pool3/impl/NoOpCallStackTest.java
+++ b/src/test/java/org/apache/commons/pool3/impl/NoOpCallStackTest.java
@@ -23,9 +23,9 @@ import java.io.StringWriter;
import org.junit.jupiter.api.Test;
-public class NoOpCallStackTest {
+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..3d7c414c 100644
--- a/src/test/java/org/apache/commons/pool3/impl/TestAbandonedKeyedObjectPool.java
+++ b/src/test/java/org/apache/commons/pool3/impl/TestAbandonedKeyedObjectPool.java
@@ -44,7 +44,7 @@ import org.junit.jupiter.api.Test;
/**
* Tests for {@link AbandonedConfig}.
*/
-public class TestAbandonedKeyedObjectPool {
+class TestAbandonedKeyedObjectPool {
private final class ConcurrentBorrower extends Thread {
private final ArrayList<PooledTestObject> borrowed;
@@ -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..5b7be2ec 100644
--- a/src/test/java/org/apache/commons/pool3/impl/TestAbandonedObjectPool.java
+++ b/src/test/java/org/apache/commons/pool3/impl/TestAbandonedObjectPool.java
@@ -113,7 +113,7 @@ final class PooledTestObject implements TrackedUse {
/**
* TestCase for AbandonedObjectPool
*/
-public class TestAbandonedObjectPool {
+class TestAbandonedObjectPool {
private final class ConcurrentBorrower extends Thread {
private final ArrayList<PooledTestObject> borrowed;
@@ -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..d9fb5ec2 100644
--- a/src/test/java/org/apache/commons/pool3/impl/TestBaseGenericObjectPool.java
+++ b/src/test/java/org/apache/commons/pool3/impl/TestBaseGenericObjectPool.java
@@ -39,7 +39,7 @@ import org.junit.jupiter.api.Timeout;
/**
*/
-public class TestBaseGenericObjectPool {
+class TestBaseGenericObjectPool {
BaseGenericObjectPool<String, TestException> pool;
SimpleFactory factory;
@@ -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..d484ef04 100644
--- a/src/test/java/org/apache/commons/pool3/impl/TestCallStackUtils.java
+++ b/src/test/java/org/apache/commons/pool3/impl/TestCallStackUtils.java
@@ -28,7 +28,7 @@ import org.junit.jupiter.api.Test;
/**
* Tests {@link CallStackUtils}.
*/
-public class TestCallStackUtils {
+class TestCallStackUtils {
private static final String MESSAGE_FORMAT = "'Timestamp:' yyyy-MM-dd HH:mm:ss Z";
@@ -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/TestConstants.java b/src/test/java/org/apache/commons/pool3/impl/TestConstants.java
index 9e010291..04462da7 100644
--- a/src/test/java/org/apache/commons/pool3/impl/TestConstants.java
+++ b/src/test/java/org/apache/commons/pool3/impl/TestConstants.java
@@ -22,7 +22,7 @@ import java.time.Duration;
/**
* Constants used in tests.
*/
-public class TestConstants {
+class TestConstants {
/**
* A duration of one second.
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..f4e9107c 100644
--- a/src/test/java/org/apache/commons/pool3/impl/TestDefaultPooledObject.java
+++ b/src/test/java/org/apache/commons/pool3/impl/TestDefaultPooledObject.java
@@ -35,7 +35,7 @@ import org.junit.jupiter.api.Test;
/**
* Tests {@link DefaultPooledObject}.
*/
-public class TestDefaultPooledObject {
+class TestDefaultPooledObject {
/**
* JIRA: POOL-279
@@ -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..69df7c3d 100644
--- a/src/test/java/org/apache/commons/pool3/impl/TestDefaultPooledObjectInfo.java
+++ b/src/test/java/org/apache/commons/pool3/impl/TestDefaultPooledObjectInfo.java
@@ -26,10 +26,10 @@ import org.apache.commons.pool3.TestException;
import org.apache.commons.pool3.impl.TestGenericObjectPool.SimpleFactory;
import org.junit.jupiter.api.Test;
-public class TestDefaultPooledObjectInfo {
+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..9cff06cc 100644
--- a/src/test/java/org/apache/commons/pool3/impl/TestEvictionConfig.java
+++ b/src/test/java/org/apache/commons/pool3/impl/TestEvictionConfig.java
@@ -26,10 +26,10 @@ import org.junit.jupiter.api.Test;
/**
* Tests for {@link EvictionConfig}.
*/
-public class TestEvictionConfig {
+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..cd475b44 100644
--- a/src/test/java/org/apache/commons/pool3/impl/TestEvictionTimer.java
+++ b/src/test/java/org/apache/commons/pool3/impl/TestEvictionTimer.java
@@ -32,10 +32,10 @@ import org.junit.jupiter.api.Test;
/**
* Tests for {@link EvictionTimer}.
*/
-public class TestEvictionTimer {
+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..72322a86 100644
--- a/src/test/java/org/apache/commons/pool3/impl/TestGenericKeyedObjectPool.java
+++ b/src/test/java/org/apache/commons/pool3/impl/TestGenericKeyedObjectPool.java
@@ -73,7 +73,7 @@ import org.junit.jupiter.params.provider.EnumSource;
/**
*/
-public class TestGenericKeyedObjectPool extends AbstractTestKeyedObjectPool {
+class TestGenericKeyedObjectPool extends AbstractTestKeyedObjectPool {
private static final class DaemonThreadFactory implements ThreadFactory {
@Override
@@ -179,11 +179,11 @@ public class TestGenericKeyedObjectPool extends AbstractTestKeyedObjectPool {
boolean exceptionOnCreate;
- public SimpleFactory() {
+ SimpleFactory() {
this(true);
}
- public SimpleFactory(final boolean valid) {
+ SimpleFactory(final boolean valid) {
this.valid = valid;
}
@@ -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..74c10e4a 100644
--- a/src/test/java/org/apache/commons/pool3/impl/TestGenericObjectPool.java
+++ b/src/test/java/org/apache/commons/pool3/impl/TestGenericObjectPool.java
@@ -72,7 +72,7 @@ import org.junit.jupiter.api.Timeout;
/**
*/
-public class TestGenericObjectPool extends TestBaseObjectPool {
+class TestGenericObjectPool extends TestBaseObjectPool {
private final class ConcurrentBorrowAndEvictThread extends Thread {
private final boolean borrow;
@@ -276,15 +276,15 @@ public class TestGenericObjectPool extends TestBaseObjectPool {
int maxTotal = Integer.MAX_VALUE;
- public SimpleFactory() {
+ SimpleFactory() {
this(true);
}
- public SimpleFactory(final boolean valid) {
+ SimpleFactory(final boolean valid) {
this(valid, valid);
}
- public SimpleFactory(final boolean evalid, final boolean ovalid) {
+ SimpleFactory(final boolean evalid, final boolean ovalid) {
evenValid = evalid;
oddValid = ovalid;
}
@@ -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..da219a3a 100644
--- a/src/test/java/org/apache/commons/pool3/impl/TestGenericObjectPoolClassLoaders.java
+++ b/src/test/java/org/apache/commons/pool3/impl/TestGenericObjectPoolClassLoaders.java
@@ -26,7 +26,7 @@ import org.apache.commons.pool3.BasePooledObjectFactory;
import org.apache.commons.pool3.PooledObject;
import org.junit.jupiter.api.Test;
-public class TestGenericObjectPoolClassLoaders {
+class TestGenericObjectPoolClassLoaders {
private static final class CustomClassLoader extends URLClassLoader {
private final int n;
@@ -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..0aaf9a9d 100644
--- a/src/test/java/org/apache/commons/pool3/impl/TestGenericObjectPoolFactoryCreateFailure.java
+++ b/src/test/java/org/apache/commons/pool3/impl/TestGenericObjectPoolFactoryCreateFailure.java
@@ -33,7 +33,7 @@ import org.junit.jupiter.api.Timeout;
/**
* Tests POOL-340.
*/
-public class TestGenericObjectPoolFactoryCreateFailure {
+class TestGenericObjectPoolFactoryCreateFailure {
private static final class SingleObjectFactory extends BasePooledObjectFactory<Object, Exception> {
private final AtomicBoolean created = new AtomicBoolean();
@@ -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..c2bef8de 100644
--- a/src/test/java/org/apache/commons/pool3/impl/TestLinkedBlockingDeque.java
+++ b/src/test/java/org/apache/commons/pool3/impl/TestLinkedBlockingDeque.java
@@ -37,7 +37,7 @@ import org.junit.jupiter.api.Timeout;
/**
* Tests for {@link LinkedBlockingDeque}.
*/
-public class TestLinkedBlockingDeque {
+class TestLinkedBlockingDeque {
private static final Duration TIMEOUT_50_MILLIS = Duration.ofMillis(50);
private static final Integer ONE = Integer.valueOf(1);
@@ -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..91b24608 100644
--- a/src/test/java/org/apache/commons/pool3/impl/TestPoolImplUtils.java
+++ b/src/test/java/org/apache/commons/pool3/impl/TestPoolImplUtils.java
@@ -27,7 +27,7 @@ import org.apache.commons.pool3.BasePooledObjectFactory;
import org.apache.commons.pool3.PooledObject;
import org.junit.jupiter.api.Test;
-public class TestPoolImplUtils {
+class TestPoolImplUtils {
@SuppressWarnings("unused")
private abstract static class FactoryAB<A, B> extends BasePooledObjectFactory<B, RuntimeException> {
@@ -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..1e26e145 100644
--- a/src/test/java/org/apache/commons/pool3/impl/TestPooledSoftReference.java
+++ b/src/test/java/org/apache/commons/pool3/impl/TestPooledSoftReference.java
@@ -26,7 +26,7 @@ import org.junit.jupiter.api.Test;
/**
* Tests for PooledSoftReference.
*/
-public class TestPooledSoftReference {
+class TestPooledSoftReference {
private static final String REFERENT = "test";
private static final String REFERENT2 = "test2";
@@ -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..8d1ac26e 100644
--- a/src/test/java/org/apache/commons/pool3/impl/TestResilientPooledObjectFactory.java
+++ b/src/test/java/org/apache/commons/pool3/impl/TestResilientPooledObjectFactory.java
@@ -27,7 +27,7 @@ import org.apache.commons.pool3.PooledObject;
import org.apache.commons.pool3.PooledObjectFactory;
import org.junit.jupiter.api.Test;
-public class TestResilientPooledObjectFactory {
+class TestResilientPooledObjectFactory {
/**
* Factory that suffers outages and fails in configurable ways when it is down.
*/
@@ -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..a0818813 100644
--- a/src/test/java/org/apache/commons/pool3/impl/TestSoftRefOutOfMemory.java
+++ b/src/test/java/org/apache/commons/pool3/impl/TestSoftRefOutOfMemory.java
@@ -32,12 +32,14 @@ import org.junit.jupiter.api.Test;
/**
*/
-public class TestSoftRefOutOfMemory {
+class TestSoftRefOutOfMemory {
+
public static class LargePoolableObjectFactory extends BasePooledObjectFactory<String, RuntimeException> {
+
private final String buffer;
private int counter;
- public LargePoolableObjectFactory(final int size) {
+ LargePoolableObjectFactory(final int size) {
final char[] data = new char[size];
Arrays.fill(data, '.');
buffer = new String(data);
@@ -135,7 +137,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 +173,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 +218,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 +233,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/impl/TestSoftReferenceObjectPool.java b/src/test/java/org/apache/commons/pool3/impl/TestSoftReferenceObjectPool.java
index c2167eaa..1c31590d 100644
--- a/src/test/java/org/apache/commons/pool3/impl/TestSoftReferenceObjectPool.java
+++ b/src/test/java/org/apache/commons/pool3/impl/TestSoftReferenceObjectPool.java
@@ -24,7 +24,7 @@ import org.apache.commons.pool3.TestBaseObjectPool;
/**
*/
-public class TestSoftReferenceObjectPool extends TestBaseObjectPool {
+class TestSoftReferenceObjectPool extends TestBaseObjectPool {
private static final class SimpleFactory extends BasePooledObjectFactory<String, RuntimeException> {
diff --git a/src/test/java/org/apache/commons/pool3/performance/PerformanceTest.java b/src/test/java/org/apache/commons/pool3/performance/PerformanceTest.java
index b44c3643..55c92d8b 100644
--- a/src/test/java/org/apache/commons/pool3/performance/PerformanceTest.java
+++ b/src/test/java/org/apache/commons/pool3/performance/PerformanceTest.java
@@ -31,7 +31,7 @@ import org.apache.commons.pool3.impl.GenericObjectPool;
/**
* Multi-thread performance test
*/
-public class PerformanceTest {
+class PerformanceTest {
final class PerfTask implements Callable<TaskStats> {
final TaskStats taskStats = new TaskStats();
diff --git a/src/test/java/org/apache/commons/pool3/pool407/AbstractPool407Test.java b/src/test/java/org/apache/commons/pool3/pool407/AbstractPool407Test.java
index 6267b622..4935e89f 100644
--- a/src/test/java/org/apache/commons/pool3/pool407/AbstractPool407Test.java
+++ b/src/test/java/org/apache/commons/pool3/pool407/AbstractPool407Test.java
@@ -27,7 +27,7 @@ import org.apache.commons.pool3.PooledObject;
/**
* Tests POOL-407.
*/
-public class AbstractPool407Test {
+class AbstractPool407Test {
protected <T> void assertShutdown(final boolean termination, final Duration poolConfigMaxWait, final T obj, final PooledObject<T> pooledObject) {
if (pooledObject != null) {
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..a43258a5 100644
--- a/src/test/java/org/apache/commons/pool3/pool407/KeyedPool407Test.java
+++ b/src/test/java/org/apache/commons/pool3/pool407/KeyedPool407Test.java
@@ -29,7 +29,7 @@ import org.junit.jupiter.api.Test;
/**
* Tests POOL-407.
*/
-public class KeyedPool407Test extends AbstractPool407Test {
+class KeyedPool407Test extends AbstractPool407Test {
/**
* Borrows from a pool and then immediately returns to that a pool.
@@ -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..ccba1a9f 100644
--- a/src/test/java/org/apache/commons/pool3/pool407/Pool407Test.java
+++ b/src/test/java/org/apache/commons/pool3/pool407/Pool407Test.java
@@ -29,7 +29,7 @@ import org.junit.jupiter.api.Test;
/**
* Tests POOL-407.
*/
-public class Pool407Test extends AbstractPool407Test {
+class Pool407Test extends AbstractPool407Test {
/**
* Borrows from a pool and then immediately returns to that a pool.
@@ -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/TestProxiedKeyedObjectPoolWithCglibProxy.java b/src/test/java/org/apache/commons/pool3/proxy/TestProxiedKeyedObjectPoolWithCglibProxy.java
index a1b7ad6a..d7b3ca55 100644
--- a/src/test/java/org/apache/commons/pool3/proxy/TestProxiedKeyedObjectPoolWithCglibProxy.java
+++ b/src/test/java/org/apache/commons/pool3/proxy/TestProxiedKeyedObjectPoolWithCglibProxy.java
@@ -16,7 +16,7 @@
*/
package org.apache.commons.pool3.proxy;
-public class TestProxiedKeyedObjectPoolWithCglibProxy extends
+class TestProxiedKeyedObjectPoolWithCglibProxy extends
AbstractTestProxiedKeyedObjectPool {
@Override
diff --git a/src/test/java/org/apache/commons/pool3/proxy/TestProxiedKeyedObjectPoolWithJdkProxy.java b/src/test/java/org/apache/commons/pool3/proxy/TestProxiedKeyedObjectPoolWithJdkProxy.java
index 5da2e45c..a0804d7f 100644
--- a/src/test/java/org/apache/commons/pool3/proxy/TestProxiedKeyedObjectPoolWithJdkProxy.java
+++ b/src/test/java/org/apache/commons/pool3/proxy/TestProxiedKeyedObjectPoolWithJdkProxy.java
@@ -16,7 +16,7 @@
*/
package org.apache.commons.pool3.proxy;
-public class TestProxiedKeyedObjectPoolWithJdkProxy
+class TestProxiedKeyedObjectPoolWithJdkProxy
extends AbstractTestProxiedKeyedObjectPool {
@Override
diff --git a/src/test/java/org/apache/commons/pool3/proxy/TestProxiedObjectPoolWithCglibProxy.java b/src/test/java/org/apache/commons/pool3/proxy/TestProxiedObjectPoolWithCglibProxy.java
index 3b0f6781..63407d3b 100644
--- a/src/test/java/org/apache/commons/pool3/proxy/TestProxiedObjectPoolWithCglibProxy.java
+++ b/src/test/java/org/apache/commons/pool3/proxy/TestProxiedObjectPoolWithCglibProxy.java
@@ -19,7 +19,7 @@ package org.apache.commons.pool3.proxy;
import java.lang.reflect.InvocationTargetException;
-public class TestProxiedObjectPoolWithCglibProxy extends AbstractTestProxiedObjectPool {
+class TestProxiedObjectPoolWithCglibProxy extends AbstractTestProxiedObjectPool {
@Override
protected Class<? extends Throwable> getInvocationTargetExceptionType() {
diff --git a/src/test/java/org/apache/commons/pool3/proxy/TestProxiedObjectPoolWithJdkProxy.java b/src/test/java/org/apache/commons/pool3/proxy/TestProxiedObjectPoolWithJdkProxy.java
index b9b57c06..35662673 100644
--- a/src/test/java/org/apache/commons/pool3/proxy/TestProxiedObjectPoolWithJdkProxy.java
+++ b/src/test/java/org/apache/commons/pool3/proxy/TestProxiedObjectPoolWithJdkProxy.java
@@ -19,7 +19,7 @@ package org.apache.commons.pool3.proxy;
import java.lang.reflect.UndeclaredThrowableException;
-public class TestProxiedObjectPoolWithJdkProxy extends AbstractTestProxiedObjectPool {
+class TestProxiedObjectPoolWithJdkProxy extends AbstractTestProxiedObjectPool {
@Override
protected Class<? extends Throwable> getInvocationTargetExceptionType() {
(commons-pool) 02/03: [POOL-422] org.apache.commons.pool3.impl.GenericObjectPool.create(Duration) duration computation doesn't match 2.x
Posted by gg...@apache.org.
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
commit b1b939ae721c9f76f5a85aa744b334d131a22e30
Merge: d6da62d9 8e3a2983
Author: Gary Gregory <ga...@gmail.com>
AuthorDate: Tue Jun 10 10:00:32 2025 -0400
[POOL-422]
org.apache.commons.pool3.impl.GenericObjectPool.create(Duration)
duration computation doesn't match 2.x
src/changes/changes.xml | 1 +
.../java/org/apache/commons/pool3/impl/GenericObjectPool.java | 8 ++++----
2 files changed, 5 insertions(+), 4 deletions(-)