You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@commons.apache.org by mo...@apache.org on 2002/05/08 19:54:28 UTC
cvs commit: jakarta-commons/collections/src/test/org/apache/commons/collections TestMap.java
morgand 02/05/08 10:54:28
Modified: collections/src/test/org/apache/commons/collections
TestMap.java
Log:
added test for concurrent modifications
Revision Changes Path
1.15 +23 -4 jakarta-commons/collections/src/test/org/apache/commons/collections/TestMap.java
Index: TestMap.java
===================================================================
RCS file: /home/cvs/jakarta-commons/collections/src/test/org/apache/commons/collections/TestMap.java,v
retrieving revision 1.14
retrieving revision 1.15
diff -u -r1.14 -r1.15
--- TestMap.java 26 Feb 2002 18:08:58 -0000 1.14
+++ TestMap.java 8 May 2002 17:54:28 -0000 1.15
@@ -1,7 +1,7 @@
/*
- * $Header: /home/cvs/jakarta-commons/collections/src/test/org/apache/commons/collections/TestMap.java,v 1.14 2002/02/26 18:08:58 morgand Exp $
- * $Revision: 1.14 $
- * $Date: 2002/02/26 18:08:58 $
+ * $Header: /home/cvs/jakarta-commons/collections/src/test/org/apache/commons/collections/TestMap.java,v 1.15 2002/05/08 17:54:28 morgand Exp $
+ * $Revision: 1.15 $
+ * $Date: 2002/05/08 17:54:28 $
*
* ====================================================================
*
@@ -65,6 +65,7 @@
import java.io.IOException;
import java.io.Serializable;
import java.util.Collection;
+import java.util.ConcurrentModificationException;
import java.util.Map;
import java.util.Collection;
import java.util.Set;
@@ -87,7 +88,7 @@
*
* @author Michael Smith
* @author Rodney Waldhoff
- * @version $Id: TestMap.java,v 1.14 2002/02/26 18:08:58 morgand Exp $
+ * @version $Id: TestMap.java,v 1.15 2002/05/08 17:54:28 morgand Exp $
*/
public abstract class TestMap extends TestObject {
@@ -397,6 +398,24 @@
} catch (UnsupportedOperationException exception) {
assertTrue("Map must not throw UnsupportedOperationException if the " +
"map supports removing elements", !isAddRemoveModifiable());
+ }
+ }
+
+ public void testFailFastIterator() {
+ Map fm = makeFullMap();
+
+ Iterator iterator = fm.keySet().iterator();
+ try {
+ fm.remove(getSampleKeys()[0]);
+ } catch (UnsupportedOperationException e) {
+ return;
+ }
+
+ try {
+ iterator.next();
+ fail("Iterators typically throw ConcurrentModificationExceptions when underlying collection is modified.");
+ } catch (ConcurrentModificationException e) {
+
}
}
--
To unsubscribe, e-mail: <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>