This is the mail archive of the mauve-discuss@sources.redhat.com mailing list for the Mauve project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

AcuniaAbstractListTest fixes


Hi,

I made the following changes to AcuniaAbstractListTest.

2002-04-06  Mark Wielaard  <mark@klomp.org>

    * gnu/testlet/java/util/AbstractList/AcuniaAbstractListTest.java
    (test_iterator): Second hasNext() ConcurrentModificationException 
    check removed.
    (add): Only update modCount when edit == true.
    (set): Never update modCount.

When an Iterator throws a ConcurrentModificationException once it is
allowed to always throw that exception on successive call. Since
super.add() already updates the modCount it should not be updated a
second time. set() should not increase modCount according to:
http://java.sun.com/products/jdk/1.2/docs/api/java/util/AbstractList.html#modCount

Does someone disagree?

Cheers,

Mark
Index: gnu/testlet/java/util/AbstractList/AcuniaAbstractListTest.java
===================================================================
RCS file: /cvs/mauve/mauve/gnu/testlet/java/util/AbstractList/AcuniaAbstractListTest.java,v
retrieving revision 1.2
diff -u -r1.2 AcuniaAbstractListTest.java
--- AcuniaAbstractListTest.java	2002/04/03 21:19:44	1.2
+++ AcuniaAbstractListTest.java	2002/04/06 16:35:15
@@ -310,12 +310,6 @@
     	th.fail("should throw a ConcurrentModificationException -- 2");
     	}
     catch(ConcurrentModificationException cme) { th.check(true, "next"); }
-    try  {
-    	th.check(it.hasNext());
-    	}
-    catch(ConcurrentModificationException cme) {     	
-    	th.fail("should not throw a ConcurrentModificationException -- 3");
-    }
     it = eal.iterator();
     try {
     	it.remove();	
@@ -534,10 +528,10 @@
 	
 	public void add(int idx, Object o) {
 		if (edit) {
+			if (updateMC) modCount++;
 		 	v.add(idx , o);
 		}
 		else super.add(idx,o);
-		if (updateMC) modCount++;
 	}
 
 	public Object remove(int idx) {
@@ -551,7 +545,6 @@
 	
 	public Object set(int idx , Object o) {
 		if (edit) {
-			if (updateMC) modCount++;
 			return v.set(idx , o);
 		}
 		return super.set(idx , o);

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]