ViewVC Help
View File | Revision Log | Show Annotations | Download File | Root Listing
root/jsr166/jsr166/src/test/tck/ConcurrentSkipListSubMapTest.java
(Generate patch)

Comparing jsr166/src/test/tck/ConcurrentSkipListSubMapTest.java (file contents):
Revision 1.3 by dl, Sat May 28 14:02:00 2005 UTC vs.
Revision 1.18 by jsr166, Fri May 27 19:21:27 2011 UTC

# Line 1 | Line 1
1   /*
2   * Written by Doug Lea with assistance from members of JCP JSR-166
3   * Expert Group and released to the public domain, as explained at
4 < * http://creativecommons.org/licenses/publicdomain
4 > * http://creativecommons.org/publicdomain/zero/1.0/
5   */
6  
7   import junit.framework.*;
# Line 11 | Line 11 | import java.io.*;
11  
12   public class ConcurrentSkipListSubMapTest extends JSR166TestCase {
13      public static void main(String[] args) {
14 <        junit.textui.TestRunner.run (suite());  
14 >        junit.textui.TestRunner.run(suite());
15      }
16      public static Test suite() {
17 <        return new TestSuite(ConcurrentSkipListSubMapTest.class);
17 >        return new TestSuite(ConcurrentSkipListSubMapTest.class);
18      }
19  
20      /**
21       * Create a map from Integers 1-5 to Strings "A"-"E".
22       */
23 <    private static ConcurrentNavigableMap map5() {  
24 <        ConcurrentSkipListMap map = new ConcurrentSkipListMap();
23 >    private static ConcurrentNavigableMap map5() {
24 >        ConcurrentSkipListMap map = new ConcurrentSkipListMap();
25          assertTrue(map.isEmpty());
26 <        map.put(zero, "Z");
27 <        map.put(one, "A");
28 <        map.put(five, "E");
29 <        map.put(three, "C");
30 <        map.put(two, "B");
31 <        map.put(four, "D");
32 <        map.put(seven, "F");
26 >        map.put(zero, "Z");
27 >        map.put(one, "A");
28 >        map.put(five, "E");
29 >        map.put(three, "C");
30 >        map.put(two, "B");
31 >        map.put(four, "D");
32 >        map.put(seven, "F");
33          assertFalse(map.isEmpty());
34          assertEquals(7, map.size());
35 <        return map.navigableSubMap(one, seven);
35 >        return map.subMap(one, true, seven, false);
36      }
37  
38 <    private static ConcurrentNavigableMap map0() {  
39 <        ConcurrentSkipListMap map = new ConcurrentSkipListMap();
38 >    /**
39 >     * Create a map from Integers -5 to -1 to Strings "A"-"E".
40 >     */
41 >    private static ConcurrentNavigableMap dmap5() {
42 >        ConcurrentSkipListMap map = new ConcurrentSkipListMap();
43          assertTrue(map.isEmpty());
44 <        return map.navigableTailMap(one);
44 >        map.put(m1, "A");
45 >        map.put(m5, "E");
46 >        map.put(m3, "C");
47 >        map.put(m2, "B");
48 >        map.put(m4, "D");
49 >        assertFalse(map.isEmpty());
50 >        assertEquals(5, map.size());
51 >        return map.descendingMap();
52 >    }
53 >
54 >    private static ConcurrentNavigableMap map0() {
55 >        ConcurrentSkipListMap map = new ConcurrentSkipListMap();
56 >        assertTrue(map.isEmpty());
57 >        return map.tailMap(one, true);
58 >    }
59 >
60 >    private static ConcurrentNavigableMap dmap0() {
61 >        ConcurrentSkipListMap map = new ConcurrentSkipListMap();
62 >        assertTrue(map.isEmpty());
63 >        return map;
64      }
65  
66      /**
67 <     *  clear removes all pairs
67 >     * clear removes all pairs
68       */
69      public void testClear() {
70          ConcurrentNavigableMap map = map5();
71 <        map.clear();
72 <        assertEquals(map.size(), 0);
71 >        map.clear();
72 >        assertEquals(map.size(), 0);
73      }
74  
53
75      /**
76 <     *  Maps with same contents are equal
76 >     * Maps with same contents are equal
77       */
78      public void testEquals() {
79          ConcurrentNavigableMap map1 = map5();
80          ConcurrentNavigableMap map2 = map5();
81          assertEquals(map1, map2);
82          assertEquals(map2, map1);
83 <        map1.clear();
83 >        map1.clear();
84          assertFalse(map1.equals(map2));
85          assertFalse(map2.equals(map1));
86      }
87  
88      /**
89 <     *  containsKey returns true for contained key
89 >     * containsKey returns true for contained key
90       */
91      public void testContainsKey() {
92          ConcurrentNavigableMap map = map5();
93 <        assertTrue(map.containsKey(one));
93 >        assertTrue(map.containsKey(one));
94          assertFalse(map.containsKey(zero));
95      }
96  
97      /**
98 <     *  containsValue returns true for held values
98 >     * containsValue returns true for held values
99       */
100      public void testContainsValue() {
101          ConcurrentNavigableMap map = map5();
102 <        assertTrue(map.containsValue("A"));
102 >        assertTrue(map.containsValue("A"));
103          assertFalse(map.containsValue("Z"));
104      }
105  
106      /**
107 <     *  get returns the correct element at the given key,
108 <     *  or null if not present
107 >     * get returns the correct element at the given key,
108 >     * or null if not present
109       */
110      public void testGet() {
111          ConcurrentNavigableMap map = map5();
112 <        assertEquals("A", (String)map.get(one));
112 >        assertEquals("A", (String)map.get(one));
113          ConcurrentNavigableMap empty = map0();
114          assertNull(empty.get(one));
115      }
116  
117      /**
118 <     *  isEmpty is true of empty map and false for non-empty
118 >     * isEmpty is true of empty map and false for non-empty
119       */
120      public void testIsEmpty() {
121          ConcurrentNavigableMap empty = map0();
122          ConcurrentNavigableMap map = map5();
123 <        assertTrue(empty.isEmpty());
123 >        assertTrue(empty.isEmpty());
124          assertFalse(map.isEmpty());
125      }
126  
127      /**
128 <     *   firstKey returns first key
128 >     * firstKey returns first key
129       */
130      public void testFirstKey() {
131          ConcurrentNavigableMap map = map5();
132 <        assertEquals(one, map.firstKey());
132 >        assertEquals(one, map.firstKey());
133      }
134  
135      /**
136 <     *   lastKey returns last key
136 >     * lastKey returns last key
137       */
138      public void testLastKey() {
139          ConcurrentNavigableMap map = map5();
140 <        assertEquals(five, map.lastKey());
140 >        assertEquals(five, map.lastKey());
141      }
142  
122
143      /**
144 <     *   keySet returns a Set containing all the keys
144 >     * keySet returns a Set containing all the keys
145       */
146      public void testKeySet() {
147          ConcurrentNavigableMap map = map5();
148 <        Set s = map.keySet();
149 <        assertEquals(5, s.size());
150 <        assertTrue(s.contains(one));
151 <        assertTrue(s.contains(two));
152 <        assertTrue(s.contains(three));
153 <        assertTrue(s.contains(four));
154 <        assertTrue(s.contains(five));
148 >        Set s = map.keySet();
149 >        assertEquals(5, s.size());
150 >        assertTrue(s.contains(one));
151 >        assertTrue(s.contains(two));
152 >        assertTrue(s.contains(three));
153 >        assertTrue(s.contains(four));
154 >        assertTrue(s.contains(five));
155      }
156  
157      /**
158 <     *   keySet is ordered
158 >     * keySet is ordered
159       */
160      public void testKeySetOrder() {
161          ConcurrentNavigableMap map = map5();
162 <        Set s = map.keySet();
162 >        Set s = map.keySet();
163          Iterator i = s.iterator();
164          Integer last = (Integer)i.next();
165          assertEquals(last, one);
# Line 155 | Line 175 | public class ConcurrentSkipListSubMapTes
175       */
176      public void testValues() {
177          ConcurrentNavigableMap map = map5();
178 <        Collection s = map.values();
179 <        assertEquals(5, s.size());
180 <        assertTrue(s.contains("A"));
181 <        assertTrue(s.contains("B"));
182 <        assertTrue(s.contains("C"));
183 <        assertTrue(s.contains("D"));
184 <        assertTrue(s.contains("E"));
178 >        Collection s = map.values();
179 >        assertEquals(5, s.size());
180 >        assertTrue(s.contains("A"));
181 >        assertTrue(s.contains("B"));
182 >        assertTrue(s.contains("C"));
183 >        assertTrue(s.contains("D"));
184 >        assertTrue(s.contains("E"));
185      }
186  
187      /**
188 <     *  keySet.toArray returns contains all keys
188 >     * keySet.toArray returns contains all keys
189       */
190      public void testKeySetToArray() {
191          ConcurrentNavigableMap map = map5();
192 <        Set s = map.keySet();
192 >        Set s = map.keySet();
193          Object[] ar = s.toArray();
194          assertTrue(s.containsAll(Arrays.asList(ar)));
195 <        assertEquals(5, ar.length);
195 >        assertEquals(5, ar.length);
196          ar[0] = m10;
197          assertFalse(s.containsAll(Arrays.asList(ar)));
198      }
199  
200      /**
201 <     *  descendingkeySet.toArray returns contains all keys
201 >     * descendingkeySet.toArray returns contains all keys
202       */
203      public void testDescendingKeySetToArray() {
204          ConcurrentNavigableMap map = map5();
205 <        Set s = map.descendingKeySet();
205 >        Set s = map.descendingKeySet();
206          Object[] ar = s.toArray();
207 <        assertEquals(5, ar.length);
207 >        assertEquals(5, ar.length);
208          assertTrue(s.containsAll(Arrays.asList(ar)));
209          ar[0] = m10;
210          assertFalse(s.containsAll(Arrays.asList(ar)));
211      }
212  
213      /**
214 <     *  Values.toArray contains all values
214 >     * Values.toArray contains all values
215       */
216      public void testValuesToArray() {
217          ConcurrentNavigableMap map = map5();
218 <        Collection v = map.values();
218 >        Collection v = map.values();
219          Object[] ar = v.toArray();
220          ArrayList s = new ArrayList(Arrays.asList(ar));
221 <        assertEquals(5, ar.length);
222 <        assertTrue(s.contains("A"));
223 <        assertTrue(s.contains("B"));
224 <        assertTrue(s.contains("C"));
225 <        assertTrue(s.contains("D"));
226 <        assertTrue(s.contains("E"));
221 >        assertEquals(5, ar.length);
222 >        assertTrue(s.contains("A"));
223 >        assertTrue(s.contains("B"));
224 >        assertTrue(s.contains("C"));
225 >        assertTrue(s.contains("D"));
226 >        assertTrue(s.contains("E"));
227      }
228  
209
229      /**
230       * entrySet contains all pairs
231       */
232      public void testEntrySet() {
233          ConcurrentNavigableMap map = map5();
234 <        Set s = map.entrySet();
235 <        assertEquals(5, s.size());
234 >        Set s = map.entrySet();
235 >        assertEquals(5, s.size());
236          Iterator it = s.iterator();
237          while (it.hasNext()) {
238              Map.Entry e = (Map.Entry) it.next();
239 <            assertTrue(
239 >            assertTrue(
240                         (e.getKey().equals(one) && e.getValue().equals("A")) ||
241                         (e.getKey().equals(two) && e.getValue().equals("B")) ||
242                         (e.getKey().equals(three) && e.getValue().equals("C")) ||
# Line 227 | Line 246 | public class ConcurrentSkipListSubMapTes
246      }
247  
248      /**
249 <     *   putAll  adds all key-value pairs from the given map
249 >     * putAll adds all key-value pairs from the given map
250       */
251      public void testPutAll() {
252          ConcurrentNavigableMap empty = map0();
253          ConcurrentNavigableMap map = map5();
254 <        empty.putAll(map);
255 <        assertEquals(5, empty.size());
256 <        assertTrue(empty.containsKey(one));
257 <        assertTrue(empty.containsKey(two));
258 <        assertTrue(empty.containsKey(three));
259 <        assertTrue(empty.containsKey(four));
260 <        assertTrue(empty.containsKey(five));
254 >        empty.putAll(map);
255 >        assertEquals(5, empty.size());
256 >        assertTrue(empty.containsKey(one));
257 >        assertTrue(empty.containsKey(two));
258 >        assertTrue(empty.containsKey(three));
259 >        assertTrue(empty.containsKey(four));
260 >        assertTrue(empty.containsKey(five));
261      }
262  
263      /**
264 <     *   putIfAbsent works when the given key is not present
264 >     * putIfAbsent works when the given key is not present
265       */
266      public void testPutIfAbsent() {
267          ConcurrentNavigableMap map = map5();
268 <        map.putIfAbsent(six, "Z");
268 >        map.putIfAbsent(six, "Z");
269          assertTrue(map.containsKey(six));
270      }
271  
272      /**
273 <     *   putIfAbsent does not add the pair if the key is already present
273 >     * putIfAbsent does not add the pair if the key is already present
274       */
275      public void testPutIfAbsent2() {
276          ConcurrentNavigableMap map = map5();
# Line 259 | Line 278 | public class ConcurrentSkipListSubMapTes
278      }
279  
280      /**
281 <     *   replace fails when the given key is not present
281 >     * replace fails when the given key is not present
282       */
283      public void testReplace() {
284          ConcurrentNavigableMap map = map5();
285 <        assertNull(map.replace(six, "Z"));
285 >        assertNull(map.replace(six, "Z"));
286          assertFalse(map.containsKey(six));
287      }
288  
289      /**
290 <     *   replace succeeds if the key is already present
290 >     * replace succeeds if the key is already present
291       */
292      public void testReplace2() {
293          ConcurrentNavigableMap map = map5();
# Line 276 | Line 295 | public class ConcurrentSkipListSubMapTes
295          assertEquals("Z", map.get(one));
296      }
297  
279
298      /**
299       * replace value fails when the given key not mapped to expected value
300       */
301      public void testReplaceValue() {
302          ConcurrentNavigableMap map = map5();
303          assertEquals("A", map.get(one));
304 <        assertFalse(map.replace(one, "Z", "Z"));
304 >        assertFalse(map.replace(one, "Z", "Z"));
305          assertEquals("A", map.get(one));
306      }
307  
# Line 293 | Line 311 | public class ConcurrentSkipListSubMapTes
311      public void testReplaceValue2() {
312          ConcurrentNavigableMap map = map5();
313          assertEquals("A", map.get(one));
314 <        assertTrue(map.replace(one, "A", "Z"));
314 >        assertTrue(map.replace(one, "A", "Z"));
315          assertEquals("Z", map.get(one));
316      }
317  
300
318      /**
319 <     *   remove removes the correct key-value pair from the map
319 >     * remove removes the correct key-value pair from the map
320       */
321      public void testRemove() {
322          ConcurrentNavigableMap map = map5();
323 <        map.remove(five);
324 <        assertEquals(4, map.size());
325 <        assertFalse(map.containsKey(five));
323 >        map.remove(five);
324 >        assertEquals(4, map.size());
325 >        assertFalse(map.containsKey(five));
326      }
327  
328      /**
# Line 313 | Line 330 | public class ConcurrentSkipListSubMapTes
330       */
331      public void testRemove2() {
332          ConcurrentNavigableMap map = map5();
333 <        assertTrue(map.containsKey(five));
333 >        assertTrue(map.containsKey(five));
334          assertEquals("E", map.get(five));
335 <        map.remove(five, "E");
336 <        assertEquals(4, map.size());
337 <        assertFalse(map.containsKey(five));
338 <        map.remove(four, "A");
339 <        assertEquals(4, map.size());
340 <        assertTrue(map.containsKey(four));
324 <
335 >        map.remove(five, "E");
336 >        assertEquals(4, map.size());
337 >        assertFalse(map.containsKey(five));
338 >        map.remove(four, "A");
339 >        assertEquals(4, map.size());
340 >        assertTrue(map.containsKey(four));
341      }
342  
343      /**
# Line 340 | Line 356 | public class ConcurrentSkipListSubMapTes
356  
357          Map.Entry e4 = map.lowerEntry(zero);
358          assertNull(e4);
343
359      }
360  
361      /**
# Line 359 | Line 374 | public class ConcurrentSkipListSubMapTes
374  
375          Map.Entry e4 = map.higherEntry(six);
376          assertNull(e4);
362
377      }
378  
379      /**
# Line 378 | Line 392 | public class ConcurrentSkipListSubMapTes
392  
393          Map.Entry e4 = map.floorEntry(zero);
394          assertNull(e4);
381
395      }
396  
397      /**
# Line 397 | Line 410 | public class ConcurrentSkipListSubMapTes
410  
411          Map.Entry e4 = map.ceilingEntry(six);
412          assertNull(e4);
400
413      }
414  
415      /**
# Line 422 | Line 434 | public class ConcurrentSkipListSubMapTes
434          try {
435              e.setValue("A");
436              shouldThrow();
437 <        } catch (Exception ok) {
426 <        }
437 >        } catch (UnsupportedOperationException success) {}
438          e = map.pollFirstEntry();
439          assertNull(e);
440      }
# Line 450 | Line 461 | public class ConcurrentSkipListSubMapTes
461          try {
462              e.setValue("E");
463              shouldThrow();
464 <        } catch (Exception ok) {
454 <        }
464 >        } catch (UnsupportedOperationException success) {}
465          e = map.pollLastEntry();
466          assertNull(e);
467      }
468  
469      /**
470 <     *   size returns the correct values
470 >     * size returns the correct values
471       */
472      public void testSize() {
473          ConcurrentNavigableMap map = map5();
474          ConcurrentNavigableMap empty = map0();
475 <        assertEquals(0, empty.size());
476 <        assertEquals(5, map.size());
475 >        assertEquals(0, empty.size());
476 >        assertEquals(5, map.size());
477      }
478  
479      /**
# Line 473 | Line 483 | public class ConcurrentSkipListSubMapTes
483          ConcurrentNavigableMap map = map5();
484          String s = map.toString();
485          for (int i = 1; i <= 5; ++i) {
486 <            assertTrue(s.indexOf(String.valueOf(i)) >= 0);
486 >            assertTrue(s.contains(String.valueOf(i)));
487          }
488 <    }        
488 >    }
489  
490      // Exception tests
491  
# Line 487 | Line 497 | public class ConcurrentSkipListSubMapTes
497              ConcurrentNavigableMap c = map5();
498              c.get(null);
499              shouldThrow();
500 <        } catch(NullPointerException e){}
500 >        } catch (NullPointerException success) {}
501      }
502  
503      /**
# Line 498 | Line 508 | public class ConcurrentSkipListSubMapTes
508              ConcurrentNavigableMap c = map5();
509              c.containsKey(null);
510              shouldThrow();
511 <        } catch(NullPointerException e){}
511 >        } catch (NullPointerException success) {}
512      }
513  
514      /**
# Line 509 | Line 519 | public class ConcurrentSkipListSubMapTes
519              ConcurrentNavigableMap c = map0();
520              c.containsValue(null);
521              shouldThrow();
522 <        } catch(NullPointerException e){}
522 >        } catch (NullPointerException success) {}
523      }
524  
515
525      /**
526       * put(null,x) throws NPE
527       */
# Line 521 | Line 530 | public class ConcurrentSkipListSubMapTes
530              ConcurrentNavigableMap c = map5();
531              c.put(null, "whatever");
532              shouldThrow();
533 <        } catch(NullPointerException e){}
533 >        } catch (NullPointerException success) {}
534      }
535  
536      /**
# Line 532 | Line 541 | public class ConcurrentSkipListSubMapTes
541              ConcurrentNavigableMap c = map5();
542              c.putIfAbsent(null, "whatever");
543              shouldThrow();
544 <        } catch(NullPointerException e){}
544 >        } catch (NullPointerException success) {}
545      }
546  
547      /**
# Line 543 | Line 552 | public class ConcurrentSkipListSubMapTes
552              ConcurrentNavigableMap c = map5();
553              c.replace(null, "whatever");
554              shouldThrow();
555 <        } catch(NullPointerException e){}
555 >        } catch (NullPointerException success) {}
556      }
557  
558      /**
# Line 554 | Line 563 | public class ConcurrentSkipListSubMapTes
563              ConcurrentNavigableMap c = map5();
564              c.replace(null, one, "whatever");
565              shouldThrow();
566 <        } catch(NullPointerException e){}
566 >        } catch (NullPointerException success) {}
567      }
568  
569      /**
# Line 565 | Line 574 | public class ConcurrentSkipListSubMapTes
574              ConcurrentNavigableMap c = map5();
575              c.remove(null);
576              shouldThrow();
577 <        } catch(NullPointerException e){}
577 >        } catch (NullPointerException success) {}
578      }
579  
580      /**
# Line 576 | Line 585 | public class ConcurrentSkipListSubMapTes
585              ConcurrentNavigableMap c = map5();
586              c.remove(null, "whatever");
587              shouldThrow();
588 <        } catch(NullPointerException e){}
588 >        } catch (NullPointerException success) {}
589      }
590  
591      /**
592       * A deserialized map equals original
593       */
594 <    public void testSerialization() {
594 >    public void testSerialization() throws Exception {
595          ConcurrentNavigableMap q = map5();
596  
597 <        try {
598 <            ByteArrayOutputStream bout = new ByteArrayOutputStream(10000);
599 <            ObjectOutputStream out = new ObjectOutputStream(new BufferedOutputStream(bout));
600 <            out.writeObject(q);
601 <            out.close();
602 <
603 <            ByteArrayInputStream bin = new ByteArrayInputStream(bout.toByteArray());
604 <            ObjectInputStream in = new ObjectInputStream(new BufferedInputStream(bin));
605 <            ConcurrentNavigableMap r = (ConcurrentNavigableMap)in.readObject();
606 <            assertEquals(q.size(), r.size());
607 <            assertTrue(q.equals(r));
599 <            assertTrue(r.equals(q));
600 <        } catch(Exception e){
601 <            e.printStackTrace();
602 <            unexpectedException();
603 <        }
597 >        ByteArrayOutputStream bout = new ByteArrayOutputStream(10000);
598 >        ObjectOutputStream out = new ObjectOutputStream(new BufferedOutputStream(bout));
599 >        out.writeObject(q);
600 >        out.close();
601 >
602 >        ByteArrayInputStream bin = new ByteArrayInputStream(bout.toByteArray());
603 >        ObjectInputStream in = new ObjectInputStream(new BufferedInputStream(bin));
604 >        ConcurrentNavigableMap r = (ConcurrentNavigableMap)in.readObject();
605 >        assertEquals(q.size(), r.size());
606 >        assertTrue(q.equals(r));
607 >        assertTrue(r.equals(q));
608      }
609  
606
607
610      /**
611       * subMap returns map with keys in requested range
612       */
# Line 634 | Line 636 | public class ConcurrentSkipListSubMapTes
636          assertEquals(1, sm.size());
637          assertEquals(three, sm.firstKey());
638          assertEquals(three, sm.lastKey());
639 <        assertTrue(sm.remove(three) != null);
639 >        assertEquals("C", sm.remove(three));
640          assertTrue(sm.isEmpty());
641          assertEquals(3, map.size());
642      }
# Line 662 | Line 664 | public class ConcurrentSkipListSubMapTes
664          assertEquals(4, map.size());
665          assertEquals(0, sm.size());
666          assertTrue(sm.isEmpty());
667 <        assertTrue(sm.remove(three) == null);
667 >        assertSame(sm.remove(three), null);
668          assertEquals(4, map.size());
669      }
670  
# Line 734 | Line 736 | public class ConcurrentSkipListSubMapTes
736          SortedMap ssm = sm.tailMap(four);
737          assertEquals(four, ssm.firstKey());
738          assertEquals(five, ssm.lastKey());
739 <        assertTrue(ssm.remove(four) != null);
739 >        assertEquals("D", ssm.remove(four));
740 >        assertEquals(1, ssm.size());
741 >        assertEquals(3, sm.size());
742 >        assertEquals(4, map.size());
743 >    }
744 >
745 >    /**
746 >     * clear removes all pairs
747 >     */
748 >    public void testDescendingClear() {
749 >        ConcurrentNavigableMap map = dmap5();
750 >        map.clear();
751 >        assertEquals(map.size(), 0);
752 >    }
753 >
754 >    /**
755 >     * Maps with same contents are equal
756 >     */
757 >    public void testDescendingEquals() {
758 >        ConcurrentNavigableMap map1 = dmap5();
759 >        ConcurrentNavigableMap map2 = dmap5();
760 >        assertEquals(map1, map2);
761 >        assertEquals(map2, map1);
762 >        map1.clear();
763 >        assertFalse(map1.equals(map2));
764 >        assertFalse(map2.equals(map1));
765 >    }
766 >
767 >    /**
768 >     * containsKey returns true for contained key
769 >     */
770 >    public void testDescendingContainsKey() {
771 >        ConcurrentNavigableMap map = dmap5();
772 >        assertTrue(map.containsKey(m1));
773 >        assertFalse(map.containsKey(zero));
774 >    }
775 >
776 >    /**
777 >     * containsValue returns true for held values
778 >     */
779 >    public void testDescendingContainsValue() {
780 >        ConcurrentNavigableMap map = dmap5();
781 >        assertTrue(map.containsValue("A"));
782 >        assertFalse(map.containsValue("Z"));
783 >    }
784 >
785 >    /**
786 >     * get returns the correct element at the given key,
787 >     * or null if not present
788 >     */
789 >    public void testDescendingGet() {
790 >        ConcurrentNavigableMap map = dmap5();
791 >        assertEquals("A", (String)map.get(m1));
792 >        ConcurrentNavigableMap empty = dmap0();
793 >        assertNull(empty.get(m1));
794 >    }
795 >
796 >    /**
797 >     * isEmpty is true of empty map and false for non-empty
798 >     */
799 >    public void testDescendingIsEmpty() {
800 >        ConcurrentNavigableMap empty = dmap0();
801 >        ConcurrentNavigableMap map = dmap5();
802 >        assertTrue(empty.isEmpty());
803 >        assertFalse(map.isEmpty());
804 >    }
805 >
806 >    /**
807 >     * firstKey returns first key
808 >     */
809 >    public void testDescendingFirstKey() {
810 >        ConcurrentNavigableMap map = dmap5();
811 >        assertEquals(m1, map.firstKey());
812 >    }
813 >
814 >    /**
815 >     * lastKey returns last key
816 >     */
817 >    public void testDescendingLastKey() {
818 >        ConcurrentNavigableMap map = dmap5();
819 >        assertEquals(m5, map.lastKey());
820 >    }
821 >
822 >    /**
823 >     * keySet returns a Set containing all the keys
824 >     */
825 >    public void testDescendingKeySet() {
826 >        ConcurrentNavigableMap map = dmap5();
827 >        Set s = map.keySet();
828 >        assertEquals(5, s.size());
829 >        assertTrue(s.contains(m1));
830 >        assertTrue(s.contains(m2));
831 >        assertTrue(s.contains(m3));
832 >        assertTrue(s.contains(m4));
833 >        assertTrue(s.contains(m5));
834 >    }
835 >
836 >    /**
837 >     * keySet is ordered
838 >     */
839 >    public void testDescendingKeySetOrder() {
840 >        ConcurrentNavigableMap map = dmap5();
841 >        Set s = map.keySet();
842 >        Iterator i = s.iterator();
843 >        Integer last = (Integer)i.next();
844 >        assertEquals(last, m1);
845 >        while (i.hasNext()) {
846 >            Integer k = (Integer)i.next();
847 >            assertTrue(last.compareTo(k) > 0);
848 >            last = k;
849 >        }
850 >    }
851 >
852 >    /**
853 >     * values collection contains all values
854 >     */
855 >    public void testDescendingValues() {
856 >        ConcurrentNavigableMap map = dmap5();
857 >        Collection s = map.values();
858 >        assertEquals(5, s.size());
859 >        assertTrue(s.contains("A"));
860 >        assertTrue(s.contains("B"));
861 >        assertTrue(s.contains("C"));
862 >        assertTrue(s.contains("D"));
863 >        assertTrue(s.contains("E"));
864 >    }
865 >
866 >    /**
867 >     * keySet.toArray returns contains all keys
868 >     */
869 >    public void testDescendingAscendingKeySetToArray() {
870 >        ConcurrentNavigableMap map = dmap5();
871 >        Set s = map.keySet();
872 >        Object[] ar = s.toArray();
873 >        assertTrue(s.containsAll(Arrays.asList(ar)));
874 >        assertEquals(5, ar.length);
875 >        ar[0] = m10;
876 >        assertFalse(s.containsAll(Arrays.asList(ar)));
877 >    }
878 >
879 >    /**
880 >     * descendingkeySet.toArray returns contains all keys
881 >     */
882 >    public void testDescendingDescendingKeySetToArray() {
883 >        ConcurrentNavigableMap map = dmap5();
884 >        Set s = map.descendingKeySet();
885 >        Object[] ar = s.toArray();
886 >        assertEquals(5, ar.length);
887 >        assertTrue(s.containsAll(Arrays.asList(ar)));
888 >        ar[0] = m10;
889 >        assertFalse(s.containsAll(Arrays.asList(ar)));
890 >    }
891 >
892 >    /**
893 >     * Values.toArray contains all values
894 >     */
895 >    public void testDescendingValuesToArray() {
896 >        ConcurrentNavigableMap map = dmap5();
897 >        Collection v = map.values();
898 >        Object[] ar = v.toArray();
899 >        ArrayList s = new ArrayList(Arrays.asList(ar));
900 >        assertEquals(5, ar.length);
901 >        assertTrue(s.contains("A"));
902 >        assertTrue(s.contains("B"));
903 >        assertTrue(s.contains("C"));
904 >        assertTrue(s.contains("D"));
905 >        assertTrue(s.contains("E"));
906 >    }
907 >
908 >    /**
909 >     * entrySet contains all pairs
910 >     */
911 >    public void testDescendingEntrySet() {
912 >        ConcurrentNavigableMap map = dmap5();
913 >        Set s = map.entrySet();
914 >        assertEquals(5, s.size());
915 >        Iterator it = s.iterator();
916 >        while (it.hasNext()) {
917 >            Map.Entry e = (Map.Entry) it.next();
918 >            assertTrue(
919 >                       (e.getKey().equals(m1) && e.getValue().equals("A")) ||
920 >                       (e.getKey().equals(m2) && e.getValue().equals("B")) ||
921 >                       (e.getKey().equals(m3) && e.getValue().equals("C")) ||
922 >                       (e.getKey().equals(m4) && e.getValue().equals("D")) ||
923 >                       (e.getKey().equals(m5) && e.getValue().equals("E")));
924 >        }
925 >    }
926 >
927 >    /**
928 >     * putAll adds all key-value pairs from the given map
929 >     */
930 >    public void testDescendingPutAll() {
931 >        ConcurrentNavigableMap empty = dmap0();
932 >        ConcurrentNavigableMap map = dmap5();
933 >        empty.putAll(map);
934 >        assertEquals(5, empty.size());
935 >        assertTrue(empty.containsKey(m1));
936 >        assertTrue(empty.containsKey(m2));
937 >        assertTrue(empty.containsKey(m3));
938 >        assertTrue(empty.containsKey(m4));
939 >        assertTrue(empty.containsKey(m5));
940 >    }
941 >
942 >    /**
943 >     * putIfAbsent works when the given key is not present
944 >     */
945 >    public void testDescendingPutIfAbsent() {
946 >        ConcurrentNavigableMap map = dmap5();
947 >        map.putIfAbsent(six, "Z");
948 >        assertTrue(map.containsKey(six));
949 >    }
950 >
951 >    /**
952 >     * putIfAbsent does not add the pair if the key is already present
953 >     */
954 >    public void testDescendingPutIfAbsent2() {
955 >        ConcurrentNavigableMap map = dmap5();
956 >        assertEquals("A", map.putIfAbsent(m1, "Z"));
957 >    }
958 >
959 >    /**
960 >     * replace fails when the given key is not present
961 >     */
962 >    public void testDescendingReplace() {
963 >        ConcurrentNavigableMap map = dmap5();
964 >        assertNull(map.replace(six, "Z"));
965 >        assertFalse(map.containsKey(six));
966 >    }
967 >
968 >    /**
969 >     * replace succeeds if the key is already present
970 >     */
971 >    public void testDescendingReplace2() {
972 >        ConcurrentNavigableMap map = dmap5();
973 >        assertNotNull(map.replace(m1, "Z"));
974 >        assertEquals("Z", map.get(m1));
975 >    }
976 >
977 >    /**
978 >     * replace value fails when the given key not mapped to expected value
979 >     */
980 >    public void testDescendingReplaceValue() {
981 >        ConcurrentNavigableMap map = dmap5();
982 >        assertEquals("A", map.get(m1));
983 >        assertFalse(map.replace(m1, "Z", "Z"));
984 >        assertEquals("A", map.get(m1));
985 >    }
986 >
987 >    /**
988 >     * replace value succeeds when the given key mapped to expected value
989 >     */
990 >    public void testDescendingReplaceValue2() {
991 >        ConcurrentNavigableMap map = dmap5();
992 >        assertEquals("A", map.get(m1));
993 >        assertTrue(map.replace(m1, "A", "Z"));
994 >        assertEquals("Z", map.get(m1));
995 >    }
996 >
997 >    /**
998 >     * remove removes the correct key-value pair from the map
999 >     */
1000 >    public void testDescendingRemove() {
1001 >        ConcurrentNavigableMap map = dmap5();
1002 >        map.remove(m5);
1003 >        assertEquals(4, map.size());
1004 >        assertFalse(map.containsKey(m5));
1005 >    }
1006 >
1007 >    /**
1008 >     * remove(key,value) removes only if pair present
1009 >     */
1010 >    public void testDescendingRemove2() {
1011 >        ConcurrentNavigableMap map = dmap5();
1012 >        assertTrue(map.containsKey(m5));
1013 >        assertEquals("E", map.get(m5));
1014 >        map.remove(m5, "E");
1015 >        assertEquals(4, map.size());
1016 >        assertFalse(map.containsKey(m5));
1017 >        map.remove(m4, "A");
1018 >        assertEquals(4, map.size());
1019 >        assertTrue(map.containsKey(m4));
1020 >    }
1021 >
1022 >    /**
1023 >     * lowerEntry returns preceding entry.
1024 >     */
1025 >    public void testDescendingLowerEntry() {
1026 >        ConcurrentNavigableMap map = dmap5();
1027 >        Map.Entry e1 = map.lowerEntry(m3);
1028 >        assertEquals(m2, e1.getKey());
1029 >
1030 >        Map.Entry e2 = map.lowerEntry(m6);
1031 >        assertEquals(m5, e2.getKey());
1032 >
1033 >        Map.Entry e3 = map.lowerEntry(m1);
1034 >        assertNull(e3);
1035 >
1036 >        Map.Entry e4 = map.lowerEntry(zero);
1037 >        assertNull(e4);
1038 >    }
1039 >
1040 >    /**
1041 >     * higherEntry returns next entry.
1042 >     */
1043 >    public void testDescendingHigherEntry() {
1044 >        ConcurrentNavigableMap map = dmap5();
1045 >        Map.Entry e1 = map.higherEntry(m3);
1046 >        assertEquals(m4, e1.getKey());
1047 >
1048 >        Map.Entry e2 = map.higherEntry(zero);
1049 >        assertEquals(m1, e2.getKey());
1050 >
1051 >        Map.Entry e3 = map.higherEntry(m5);
1052 >        assertNull(e3);
1053 >
1054 >        Map.Entry e4 = map.higherEntry(m6);
1055 >        assertNull(e4);
1056 >    }
1057 >
1058 >    /**
1059 >     * floorEntry returns preceding entry.
1060 >     */
1061 >    public void testDescendingFloorEntry() {
1062 >        ConcurrentNavigableMap map = dmap5();
1063 >        Map.Entry e1 = map.floorEntry(m3);
1064 >        assertEquals(m3, e1.getKey());
1065 >
1066 >        Map.Entry e2 = map.floorEntry(m6);
1067 >        assertEquals(m5, e2.getKey());
1068 >
1069 >        Map.Entry e3 = map.floorEntry(m1);
1070 >        assertEquals(m1, e3.getKey());
1071 >
1072 >        Map.Entry e4 = map.floorEntry(zero);
1073 >        assertNull(e4);
1074 >    }
1075 >
1076 >    /**
1077 >     * ceilingEntry returns next entry.
1078 >     */
1079 >    public void testDescendingCeilingEntry() {
1080 >        ConcurrentNavigableMap map = dmap5();
1081 >        Map.Entry e1 = map.ceilingEntry(m3);
1082 >        assertEquals(m3, e1.getKey());
1083 >
1084 >        Map.Entry e2 = map.ceilingEntry(zero);
1085 >        assertEquals(m1, e2.getKey());
1086 >
1087 >        Map.Entry e3 = map.ceilingEntry(m5);
1088 >        assertEquals(m5, e3.getKey());
1089 >
1090 >        Map.Entry e4 = map.ceilingEntry(m6);
1091 >        assertNull(e4);
1092 >    }
1093 >
1094 >    /**
1095 >     * pollFirstEntry returns entries in order
1096 >     */
1097 >    public void testDescendingPollFirstEntry() {
1098 >        ConcurrentNavigableMap map = dmap5();
1099 >        Map.Entry e = map.pollFirstEntry();
1100 >        assertEquals(m1, e.getKey());
1101 >        assertEquals("A", e.getValue());
1102 >        e = map.pollFirstEntry();
1103 >        assertEquals(m2, e.getKey());
1104 >        map.put(m1, "A");
1105 >        e = map.pollFirstEntry();
1106 >        assertEquals(m1, e.getKey());
1107 >        assertEquals("A", e.getValue());
1108 >        e = map.pollFirstEntry();
1109 >        assertEquals(m3, e.getKey());
1110 >        map.remove(m4);
1111 >        e = map.pollFirstEntry();
1112 >        assertEquals(m5, e.getKey());
1113 >        try {
1114 >            e.setValue("A");
1115 >            shouldThrow();
1116 >        } catch (UnsupportedOperationException success) {}
1117 >        e = map.pollFirstEntry();
1118 >        assertNull(e);
1119 >    }
1120 >
1121 >    /**
1122 >     * pollLastEntry returns entries in order
1123 >     */
1124 >    public void testDescendingPollLastEntry() {
1125 >        ConcurrentNavigableMap map = dmap5();
1126 >        Map.Entry e = map.pollLastEntry();
1127 >        assertEquals(m5, e.getKey());
1128 >        assertEquals("E", e.getValue());
1129 >        e = map.pollLastEntry();
1130 >        assertEquals(m4, e.getKey());
1131 >        map.put(m5, "E");
1132 >        e = map.pollLastEntry();
1133 >        assertEquals(m5, e.getKey());
1134 >        assertEquals("E", e.getValue());
1135 >        e = map.pollLastEntry();
1136 >        assertEquals(m3, e.getKey());
1137 >        map.remove(m2);
1138 >        e = map.pollLastEntry();
1139 >        assertEquals(m1, e.getKey());
1140 >        try {
1141 >            e.setValue("E");
1142 >            shouldThrow();
1143 >        } catch (UnsupportedOperationException success) {}
1144 >        e = map.pollLastEntry();
1145 >        assertNull(e);
1146 >    }
1147 >
1148 >    /**
1149 >     * size returns the correct values
1150 >     */
1151 >    public void testDescendingSize() {
1152 >        ConcurrentNavigableMap map = dmap5();
1153 >        ConcurrentNavigableMap empty = dmap0();
1154 >        assertEquals(0, empty.size());
1155 >        assertEquals(5, map.size());
1156 >    }
1157 >
1158 >    /**
1159 >     * toString contains toString of elements
1160 >     */
1161 >    public void testDescendingToString() {
1162 >        ConcurrentNavigableMap map = dmap5();
1163 >        String s = map.toString();
1164 >        for (int i = 1; i <= 5; ++i) {
1165 >            assertTrue(s.contains(String.valueOf(i)));
1166 >        }
1167 >    }
1168 >
1169 >    // Exception testDescendings
1170 >
1171 >    /**
1172 >     * get(null) of empty map throws NPE
1173 >     */
1174 >    public void testDescendingGet_NullPointerException() {
1175 >        try {
1176 >            ConcurrentNavigableMap c = dmap5();
1177 >            c.get(null);
1178 >            shouldThrow();
1179 >        } catch (NullPointerException success) {}
1180 >    }
1181 >
1182 >    /**
1183 >     * containsKey(null) of empty map throws NPE
1184 >     */
1185 >    public void testDescendingContainsKey_NullPointerException() {
1186 >        try {
1187 >            ConcurrentNavigableMap c = dmap5();
1188 >            c.containsKey(null);
1189 >            shouldThrow();
1190 >        } catch (NullPointerException success) {}
1191 >    }
1192 >
1193 >    /**
1194 >     * containsValue(null) throws NPE
1195 >     */
1196 >    public void testDescendingContainsValue_NullPointerException() {
1197 >        try {
1198 >            ConcurrentNavigableMap c = dmap0();
1199 >            c.containsValue(null);
1200 >            shouldThrow();
1201 >        } catch (NullPointerException success) {}
1202 >    }
1203 >
1204 >    /**
1205 >     * put(null,x) throws NPE
1206 >     */
1207 >    public void testDescendingPut1_NullPointerException() {
1208 >        try {
1209 >            ConcurrentNavigableMap c = dmap5();
1210 >            c.put(null, "whatever");
1211 >            shouldThrow();
1212 >        } catch (NullPointerException success) {}
1213 >    }
1214 >
1215 >    /**
1216 >     * putIfAbsent(null, x) throws NPE
1217 >     */
1218 >    public void testDescendingPutIfAbsent1_NullPointerException() {
1219 >        try {
1220 >            ConcurrentNavigableMap c = dmap5();
1221 >            c.putIfAbsent(null, "whatever");
1222 >            shouldThrow();
1223 >        } catch (NullPointerException success) {}
1224 >    }
1225 >
1226 >    /**
1227 >     * replace(null, x) throws NPE
1228 >     */
1229 >    public void testDescendingReplace_NullPointerException() {
1230 >        try {
1231 >            ConcurrentNavigableMap c = dmap5();
1232 >            c.replace(null, "whatever");
1233 >            shouldThrow();
1234 >        } catch (NullPointerException success) {}
1235 >    }
1236 >
1237 >    /**
1238 >     * replace(null, x, y) throws NPE
1239 >     */
1240 >    public void testDescendingReplaceValue_NullPointerException() {
1241 >        try {
1242 >            ConcurrentNavigableMap c = dmap5();
1243 >            c.replace(null, m1, "whatever");
1244 >            shouldThrow();
1245 >        } catch (NullPointerException success) {}
1246 >    }
1247 >
1248 >    /**
1249 >     * remove(null) throws NPE
1250 >     */
1251 >    public void testDescendingRemove1_NullPointerException() {
1252 >        try {
1253 >            ConcurrentNavigableMap c = dmap5();
1254 >            c.remove(null);
1255 >            shouldThrow();
1256 >        } catch (NullPointerException success) {}
1257 >    }
1258 >
1259 >    /**
1260 >     * remove(null, x) throws NPE
1261 >     */
1262 >    public void testDescendingRemove2_NullPointerException() {
1263 >        try {
1264 >            ConcurrentNavigableMap c = dmap5();
1265 >            c.remove(null, "whatever");
1266 >            shouldThrow();
1267 >        } catch (NullPointerException success) {}
1268 >    }
1269 >
1270 >    /**
1271 >     * A deserialized map equals original
1272 >     */
1273 >    public void testDescendingSerialization() throws Exception {
1274 >        ConcurrentNavigableMap q = dmap5();
1275 >
1276 >        ByteArrayOutputStream bout = new ByteArrayOutputStream(10000);
1277 >        ObjectOutputStream out = new ObjectOutputStream(new BufferedOutputStream(bout));
1278 >        out.writeObject(q);
1279 >        out.close();
1280 >
1281 >        ByteArrayInputStream bin = new ByteArrayInputStream(bout.toByteArray());
1282 >        ObjectInputStream in = new ObjectInputStream(new BufferedInputStream(bin));
1283 >        ConcurrentNavigableMap r = (ConcurrentNavigableMap)in.readObject();
1284 >        assertEquals(q.size(), r.size());
1285 >        assertTrue(q.equals(r));
1286 >        assertTrue(r.equals(q));
1287 >    }
1288 >
1289 >    /**
1290 >     * subMap returns map with keys in requested range
1291 >     */
1292 >    public void testDescendingSubMapContents() {
1293 >        ConcurrentNavigableMap map = dmap5();
1294 >        SortedMap sm = map.subMap(m2, m4);
1295 >        assertEquals(m2, sm.firstKey());
1296 >        assertEquals(m3, sm.lastKey());
1297 >        assertEquals(2, sm.size());
1298 >        assertFalse(sm.containsKey(m1));
1299 >        assertTrue(sm.containsKey(m2));
1300 >        assertTrue(sm.containsKey(m3));
1301 >        assertFalse(sm.containsKey(m4));
1302 >        assertFalse(sm.containsKey(m5));
1303 >        Iterator i = sm.keySet().iterator();
1304 >        Object k;
1305 >        k = (Integer)(i.next());
1306 >        assertEquals(m2, k);
1307 >        k = (Integer)(i.next());
1308 >        assertEquals(m3, k);
1309 >        assertFalse(i.hasNext());
1310 >        Iterator j = sm.keySet().iterator();
1311 >        j.next();
1312 >        j.remove();
1313 >        assertFalse(map.containsKey(m2));
1314 >        assertEquals(4, map.size());
1315 >        assertEquals(1, sm.size());
1316 >        assertEquals(m3, sm.firstKey());
1317 >        assertEquals(m3, sm.lastKey());
1318 >        assertEquals("C", sm.remove(m3));
1319 >        assertTrue(sm.isEmpty());
1320 >        assertEquals(3, map.size());
1321 >    }
1322 >
1323 >    public void testDescendingSubMapContents2() {
1324 >        ConcurrentNavigableMap map = dmap5();
1325 >        SortedMap sm = map.subMap(m2, m3);
1326 >        assertEquals(1, sm.size());
1327 >        assertEquals(m2, sm.firstKey());
1328 >        assertEquals(m2, sm.lastKey());
1329 >        assertFalse(sm.containsKey(m1));
1330 >        assertTrue(sm.containsKey(m2));
1331 >        assertFalse(sm.containsKey(m3));
1332 >        assertFalse(sm.containsKey(m4));
1333 >        assertFalse(sm.containsKey(m5));
1334 >        Iterator i = sm.keySet().iterator();
1335 >        Object k;
1336 >        k = (Integer)(i.next());
1337 >        assertEquals(m2, k);
1338 >        assertFalse(i.hasNext());
1339 >        Iterator j = sm.keySet().iterator();
1340 >        j.next();
1341 >        j.remove();
1342 >        assertFalse(map.containsKey(m2));
1343 >        assertEquals(4, map.size());
1344 >        assertEquals(0, sm.size());
1345 >        assertTrue(sm.isEmpty());
1346 >        assertSame(sm.remove(m3), null);
1347 >        assertEquals(4, map.size());
1348 >    }
1349 >
1350 >    /**
1351 >     * headMap returns map with keys in requested range
1352 >     */
1353 >    public void testDescendingHeadMapContents() {
1354 >        ConcurrentNavigableMap map = dmap5();
1355 >        SortedMap sm = map.headMap(m4);
1356 >        assertTrue(sm.containsKey(m1));
1357 >        assertTrue(sm.containsKey(m2));
1358 >        assertTrue(sm.containsKey(m3));
1359 >        assertFalse(sm.containsKey(m4));
1360 >        assertFalse(sm.containsKey(m5));
1361 >        Iterator i = sm.keySet().iterator();
1362 >        Object k;
1363 >        k = (Integer)(i.next());
1364 >        assertEquals(m1, k);
1365 >        k = (Integer)(i.next());
1366 >        assertEquals(m2, k);
1367 >        k = (Integer)(i.next());
1368 >        assertEquals(m3, k);
1369 >        assertFalse(i.hasNext());
1370 >        sm.clear();
1371 >        assertTrue(sm.isEmpty());
1372 >        assertEquals(2, map.size());
1373 >        assertEquals(m4, map.firstKey());
1374 >    }
1375 >
1376 >    /**
1377 >     * headMap returns map with keys in requested range
1378 >     */
1379 >    public void testDescendingTailMapContents() {
1380 >        ConcurrentNavigableMap map = dmap5();
1381 >        SortedMap sm = map.tailMap(m2);
1382 >        assertFalse(sm.containsKey(m1));
1383 >        assertTrue(sm.containsKey(m2));
1384 >        assertTrue(sm.containsKey(m3));
1385 >        assertTrue(sm.containsKey(m4));
1386 >        assertTrue(sm.containsKey(m5));
1387 >        Iterator i = sm.keySet().iterator();
1388 >        Object k;
1389 >        k = (Integer)(i.next());
1390 >        assertEquals(m2, k);
1391 >        k = (Integer)(i.next());
1392 >        assertEquals(m3, k);
1393 >        k = (Integer)(i.next());
1394 >        assertEquals(m4, k);
1395 >        k = (Integer)(i.next());
1396 >        assertEquals(m5, k);
1397 >        assertFalse(i.hasNext());
1398 >
1399 >        Iterator ei = sm.entrySet().iterator();
1400 >        Map.Entry e;
1401 >        e = (Map.Entry)(ei.next());
1402 >        assertEquals(m2, e.getKey());
1403 >        assertEquals("B", e.getValue());
1404 >        e = (Map.Entry)(ei.next());
1405 >        assertEquals(m3, e.getKey());
1406 >        assertEquals("C", e.getValue());
1407 >        e = (Map.Entry)(ei.next());
1408 >        assertEquals(m4, e.getKey());
1409 >        assertEquals("D", e.getValue());
1410 >        e = (Map.Entry)(ei.next());
1411 >        assertEquals(m5, e.getKey());
1412 >        assertEquals("E", e.getValue());
1413 >        assertFalse(i.hasNext());
1414 >
1415 >        SortedMap ssm = sm.tailMap(m4);
1416 >        assertEquals(m4, ssm.firstKey());
1417 >        assertEquals(m5, ssm.lastKey());
1418 >        assertEquals("D", ssm.remove(m4));
1419          assertEquals(1, ssm.size());
1420          assertEquals(3, sm.size());
1421          assertEquals(4, map.size());
1422      }
1423 <    
1423 >
1424   }

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines