Author: simonetripodi
Date: Mon Apr 25 20:16:23 2011
New Revision: 1096581
URL: http://svn.apache.org/viewvc?rev=1096581&view=rev
Log:
TestSoftRefOutOfMemory tests moved to JUnit4 annotations
Modified:
commons/proper/pool/trunk/src/test/org/apache/commons/pool2/impl/TestSoftRefOutOfMemory.java
Modified:
commons/proper/pool/trunk/src/test/org/apache/commons/pool2/impl/TestSoftRefOutOfMemory.java
URL:
http://svn.apache.org/viewvc/commons/proper/pool/trunk/src/test/org/apache/commons/pool2/impl/TestSoftRefOutOfMemory.java?rev=1096581&r1=1096580&r2=1096581&view=diff
==============================================================================
---
commons/proper/pool/trunk/src/test/org/apache/commons/pool2/impl/TestSoftRefOutOfMemory.java
(original)
+++
commons/proper/pool/trunk/src/test/org/apache/commons/pool2/impl/TestSoftRefOutOfMemory.java
Mon Apr 25 20:16:23 2011
@@ -17,29 +17,28 @@
package org.apache.commons.pool2.impl;
+import static junit.framework.Assert.assertEquals;
+import static junit.framework.Assert.assertTrue;
+import static junit.framework.Assert.fail;
+
import java.util.Arrays;
import java.util.LinkedList;
import java.util.List;
-import junit.framework.TestCase;
-
import org.apache.commons.pool2.BasePoolableObjectFactory;
import org.apache.commons.pool2.PoolableObjectFactory;
-import org.apache.commons.pool2.impl.SoftReferenceObjectPool;
+import org.junit.After;
+import org.junit.Test;
/**
* @author Dirk Verbeeck
* @author Sandy McArthur
* @version $Revision$ $Date$
*/
-public class TestSoftRefOutOfMemory extends TestCase {
+public class TestSoftRefOutOfMemory {
private SoftReferenceObjectPool<String> pool;
- public TestSoftRefOutOfMemory(String testName) {
- super(testName);
- }
-
- @Override
+ @After
public void tearDown() throws Exception {
if (pool != null) {
pool.close();
@@ -48,6 +47,7 @@ public class TestSoftRefOutOfMemory exte
System.gc();
}
+ @Test
public void testOutOfMemory() throws Exception {
pool = new SoftReferenceObjectPool<String>(new
SmallPoolableObjectFactory());
@@ -83,6 +83,7 @@ public class TestSoftRefOutOfMemory exte
assertEquals(1, pool.getNumIdle());
}
+ @Test
public void testOutOfMemory1000() throws Exception {
pool = new SoftReferenceObjectPool<String>(new
SmallPoolableObjectFactory());
@@ -122,6 +123,7 @@ public class TestSoftRefOutOfMemory exte
assertEquals(1, pool.getNumIdle());
}
+ @Test
public void testOutOfMemoryLarge() throws Exception {
pool = new SoftReferenceObjectPool<String>(new
LargePoolableObjectFactory(1000000));
@@ -160,6 +162,7 @@ public class TestSoftRefOutOfMemory exte
/**
* Makes sure an {@link OutOfMemoryError} isn't swallowed.
*/
+ @Test
public void testOutOfMemoryError() throws Exception {
pool = new SoftReferenceObjectPool<String>(new
BasePoolableObjectFactory<String>() {
@Override