You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@commons.apache.org by tv...@apache.org on 2016/02/10 14:06:10 UTC
svn commit: r1729591 -
/commons/proper/jcs/trunk/commons-jcs-core/src/test/java/org/apache/commons/jcs/JCSConcurrentCacheAccessUnitTest.java
Author: tv
Date: Wed Feb 10 13:06:10 2016
New Revision: 1729591
URL: http://svn.apache.org/viewvc?rev=1729591&view=rev
Log:
Fix assert in thread
Modified:
commons/proper/jcs/trunk/commons-jcs-core/src/test/java/org/apache/commons/jcs/JCSConcurrentCacheAccessUnitTest.java
Modified: commons/proper/jcs/trunk/commons-jcs-core/src/test/java/org/apache/commons/jcs/JCSConcurrentCacheAccessUnitTest.java
URL: http://svn.apache.org/viewvc/commons/proper/jcs/trunk/commons-jcs-core/src/test/java/org/apache/commons/jcs/JCSConcurrentCacheAccessUnitTest.java?rev=1729591&r1=1729590&r2=1729591&view=diff
==============================================================================
--- commons/proper/jcs/trunk/commons-jcs-core/src/test/java/org/apache/commons/jcs/JCSConcurrentCacheAccessUnitTest.java (original)
+++ commons/proper/jcs/trunk/commons-jcs-core/src/test/java/org/apache/commons/jcs/JCSConcurrentCacheAccessUnitTest.java Wed Feb 10 13:06:10 2016
@@ -19,6 +19,9 @@ package org.apache.commons.jcs;
* under the License.
*/
+import java.util.ArrayList;
+import java.util.Collections;
+import java.util.List;
import java.util.concurrent.atomic.AtomicInteger;
import junit.framework.TestCase;
@@ -52,6 +55,11 @@ public class JCSConcurrentCacheAccessUni
*/
protected AtomicInteger errcount;
+ /**
+ * Collect all value mismatches
+ */
+ protected List<String> valueMismatchList;
+
@Override
protected void setUp() throws Exception
{
@@ -59,6 +67,7 @@ public class JCSConcurrentCacheAccessUni
JCS.setConfigFilename( "/TestJCS-73.ccf" );
cache = JCS.getGroupCacheInstance( "cache" );
errcount = new AtomicInteger(0);
+ valueMismatchList = Collections.synchronizedList(new ArrayList<String>());
}
@Override
@@ -118,7 +127,10 @@ public class JCSConcurrentCacheAccessUni
}
}
- assertEquals("Values do not match", String.valueOf(idx-1), res);
+ if (!String.valueOf(idx-1).equals(res))
+ {
+ valueMismatchList.add(String.format("Values do not match: %s - %s", String.valueOf(idx-1), res));
+ }
}
// put value in the cache
@@ -161,6 +173,11 @@ public class JCSConcurrentCacheAccessUni
}
assertEquals("Error count should be 0", 0, errcount.intValue());
+ for (String msg : valueMismatchList)
+ {
+ System.out.println(msg);
+ }
+ assertEquals("Value mismatch count should be 0", 0, valueMismatchList.size());
}
}