Author: simonetripodi
Date: Mon Apr 25 06:32:13 2011
New Revision: 1096417
URL: http://svn.apache.org/viewvc?rev=1096417&view=rev
Log:
tests moved to JUnit4 annotations
Modified:
commons/proper/pool/trunk/src/test/org/apache/commons/pool2/TestPoolUtils.java
Modified:
commons/proper/pool/trunk/src/test/org/apache/commons/pool2/TestPoolUtils.java
URL:
http://svn.apache.org/viewvc/commons/proper/pool/trunk/src/test/org/apache/commons/pool2/TestPoolUtils.java?rev=1096417&r1=1096416&r2=1096417&view=diff
==============================================================================
---
commons/proper/pool/trunk/src/test/org/apache/commons/pool2/TestPoolUtils.java
(original)
+++
commons/proper/pool/trunk/src/test/org/apache/commons/pool2/TestPoolUtils.java
Mon Apr 25 06:32:13 2011
@@ -17,6 +17,9 @@
package org.apache.commons.pool2;
+import static junit.framework.Assert.assertEquals;
+import static junit.framework.Assert.fail;
+
import java.lang.reflect.InvocationHandler;
import java.lang.reflect.Method;
import java.lang.reflect.Proxy;
@@ -31,17 +34,10 @@ import java.util.Set;
import java.util.TimerTask;
import junit.framework.AssertionFailedError;
-import junit.framework.TestCase;
-import org.apache.commons.pool2.BaseKeyedObjectPool;
-import org.apache.commons.pool2.BaseObjectPool;
-import org.apache.commons.pool2.KeyedObjectPool;
-import org.apache.commons.pool2.KeyedPoolableObjectFactory;
-import org.apache.commons.pool2.ObjectPool;
-import org.apache.commons.pool2.PoolableObjectFactory;
import org.apache.commons.pool2.impl.GenericKeyedObjectPool;
import org.apache.commons.pool2.impl.GenericObjectPool;
-import org.apache.commons.pool2.PoolUtils;
+import org.junit.Test;
/**
* Unit tests for {@link PoolUtils}.
@@ -49,7 +45,7 @@ import org.apache.commons.pool2.PoolUtil
* @author Sandy McArthur
* @version $Revision$ $Date$
*/
-public class TestPoolUtils extends TestCase {
+public class TestPoolUtils {
/** Period between checks for minIdle tests. Increase this if you happen
to get too many false failures. */
private static final int CHECK_PERIOD = 300;
@@ -64,6 +60,7 @@ public class TestPoolUtils extends TestC
new PoolUtils();
}
+ @Test
public void testAdaptKeyedPoolableObjectFactory() throws Exception {
try {
PoolUtils.adapt((KeyedPoolableObjectFactory<Object,Object>)null);
@@ -73,6 +70,7 @@ public class TestPoolUtils extends TestC
}
}
+ @Test
public void testAdaptKeyedPoolableObjectFactoryKey() throws Exception {
try {
PoolUtils.adapt((KeyedPoolableObjectFactory<Object,Object>)null,
new Object());
@@ -96,6 +94,7 @@ public class TestPoolUtils extends TestC
assertEquals(expectedMethods, calledMethods);
}
+ @Test
public void testAdaptPoolableObjectFactory() throws Exception {
try {
PoolUtils.adapt((PoolableObjectFactory<Object>)null);
@@ -113,6 +112,7 @@ public class TestPoolUtils extends TestC
assertEquals(expectedMethods, calledMethods);
}
+ @Test
public void testAdaptKeyedObjectPool() throws Exception {
try {
PoolUtils.adapt((KeyedObjectPool<Object,Object>)null);
@@ -122,6 +122,7 @@ public class TestPoolUtils extends TestC
}
}
+ @Test
public void testAdaptKeyedObjectPoolKey() throws Exception {
try {
PoolUtils.adapt((KeyedObjectPool<Object,Object>)null, new
Object());
@@ -144,6 +145,7 @@ public class TestPoolUtils extends TestC
assertEquals(expectedMethods, calledMethods);
}
+ @Test
public void testAdaptObjectPool() throws Exception {
try {
PoolUtils.adapt((ObjectPool<Object>)null);
@@ -160,6 +162,7 @@ public class TestPoolUtils extends TestC
assertEquals(expectedMethods, calledMethods);
}
+ @Test
public void testCheckedPoolObjectPool() throws Exception {
try {
PoolUtils.checkedPool((ObjectPool<Object>)null, Object.class);
@@ -212,6 +215,7 @@ public class TestPoolUtils extends TestC
} */
}
+ @Test
public void testCheckedPoolKeyedObjectPool() throws Exception {
try {
PoolUtils.checkedPool((KeyedObjectPool<Object,Object>)null,
Object.class);
@@ -267,6 +271,7 @@ public class TestPoolUtils extends TestC
} */
}
+ @Test
public void testCheckMinIdleObjectPool() throws Exception {
try {
PoolUtils.checkMinIdle(null, 1, 1);
@@ -331,6 +336,7 @@ public class TestPoolUtils extends TestC
}
}
+ @Test
public void testCheckMinIdleKeyedObjectPool() throws Exception {
try {
PoolUtils.checkMinIdle(null, new Object(), 1, 1);
@@ -404,6 +410,7 @@ public class TestPoolUtils extends TestC
}
}
+ @Test
public void testCheckMinIdleKeyedObjectPoolKeys() throws Exception {
try {
final KeyedObjectPool<Object,Object> pool =
(KeyedObjectPool<Object,Object>)createProxy(KeyedObjectPool.class,
(List<String>)null);
@@ -446,6 +453,7 @@ public class TestPoolUtils extends TestC
}
}
+ @Test
public void testPrefillObjectPool() throws Exception {
try {
PoolUtils.prefill(null, 1);
@@ -469,6 +477,7 @@ public class TestPoolUtils extends TestC
assertEquals(expectedMethods, calledMethods);
}
+ @Test
public void testPrefillKeyedObjectPool() throws Exception {
try {
PoolUtils.prefill(null, new Object(), 1);
@@ -499,6 +508,7 @@ public class TestPoolUtils extends TestC
assertEquals(expectedMethods, calledMethods);
}
+ @Test
public void testPrefillKeyedObjectPoolCollection() throws Exception {
try {
final KeyedObjectPool<String,String> pool =
(KeyedObjectPool<String,String>)createProxy(KeyedObjectPool.class, (List)null);
@@ -527,6 +537,7 @@ public class TestPoolUtils extends TestC
assertEquals(expectedMethods, calledMethods);
}
+ @Test
public void testSynchronizedPoolObjectPool() throws Exception {
try {
PoolUtils.synchronizedPool((ObjectPool)null);
@@ -545,6 +556,7 @@ public class TestPoolUtils extends TestC
// TODO: Anyone feel motivated to construct a test that verifies
proper synchronization?
}
+ @Test
public void testSynchronizedPoolKeyedObjectPool() throws Exception {
try {
PoolUtils.synchronizedPool((KeyedObjectPool)null);
@@ -563,6 +575,7 @@ public class TestPoolUtils extends TestC
// TODO: Anyone feel motivated to construct a test that verifies
proper synchronization?
}
+ @Test
public void testSynchronizedPoolableFactoryPoolableObjectFactory() throws
Exception {
try {
PoolUtils.synchronizedPoolableFactory((PoolableObjectFactory)null);
@@ -582,6 +595,7 @@ public class TestPoolUtils extends TestC
// TODO: Anyone feel motivated to construct a test that verifies
proper synchronization?
}
+ @Test
public void testSynchronizedPoolableFactoryKeyedPoolableObjectFactory()
throws Exception {
try {
PoolUtils.synchronizedPoolableFactory((KeyedPoolableObjectFactory)null);
@@ -601,6 +615,7 @@ public class TestPoolUtils extends TestC
// TODO: Anyone feel motivated to construct a test that verifies
proper synchronization?
}
+ @Test
public void testErodingPoolObjectPool() throws Exception {
try {
PoolUtils.erodingPool((ObjectPool)null);
@@ -677,6 +692,7 @@ public class TestPoolUtils extends TestC
assertEquals(expectedMethods, calledMethods);
}
+ @Test
public void testErodingPoolKeyedObjectPool() throws Exception {
try {
PoolUtils.erodingPool((KeyedObjectPool)null);
@@ -768,7 +784,8 @@ public class TestPoolUtils extends TestC
expectedMethods.add("invalidateObject");
assertEquals(expectedMethods, calledMethods);
}
-
+
+ @Test
public void testErodingPerKeyKeyedObjectPool() throws Exception {
try {
PoolUtils.erodingPool((KeyedObjectPool)null, 1, true);