This is the mail archive of the mauve-patches@sourceware.org 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]

FYI: tiny extra tests on unmodifiableMap linked to PR 27128


Hi,
I added a little check to David tests on the mutability of a map via UnmodifiableMap.entrySet().toArray(Object[]).
Cheers


+Olivier

2006-04-23 Olivier Jolly <olivier.jolly@pcedev.com>

   * gnu/testlet/java/util/Collections/unmodifiableMap.java(testMap):
   Added regression test on UnmodifiableMap.entrySet().toArray(Object[]).

Index: unmodifiableMap.java
===================================================================
RCS file: /cvs/mauve/mauve/gnu/testlet/java/util/Collections/unmodifiableMap.java,v
retrieving revision 1.1
diff -u -r1.1 unmodifiableMap.java
--- unmodifiableMap.java	12 Apr 2006 09:32:06 -0000	1.1
+++ unmodifiableMap.java	23 Apr 2006 16:31:43 -0000
@@ -135,5 +135,22 @@
         harness.check(pass);
       }
 
+    // check a Map.Entry item from entrySet().toArray(Object[])
+    pass = false;    
+    Object[] entries2 = new Object[umap.size()];
+    umap.entrySet().toArray(entries2);
+    if (entries2.length > 0)
+      {
+        try
+          {
+            ((Map.Entry) entries2[0]).setValue("XYZ");
+          }
+        catch (UnsupportedOperationException e)
+          {
+            pass = true;
+          }
+        harness.check(pass);
+      }
+        
   }
 }

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