516 |
|
try { |
517 |
|
e.setValue("A"); |
518 |
|
shouldThrow(); |
519 |
< |
} catch (Exception ok) { |
520 |
< |
} |
519 |
> |
} catch (UnsupportedOperationException success) {} |
520 |
|
e = map.pollFirstEntry(); |
521 |
|
assertNull(e); |
522 |
|
} |
543 |
|
try { |
544 |
|
e.setValue("E"); |
545 |
|
shouldThrow(); |
546 |
< |
} catch (Exception ok) { |
548 |
< |
} |
546 |
> |
} catch (UnsupportedOperationException success) {} |
547 |
|
e = map.pollLastEntry(); |
548 |
|
assertNull(e); |
549 |
|
} |
579 |
|
TreeMap c = map5(); |
580 |
|
c.get(null); |
581 |
|
shouldThrow(); |
582 |
< |
} catch (NullPointerException e) {} |
582 |
> |
} catch (NullPointerException success) {} |
583 |
|
} |
584 |
|
|
585 |
|
/** |
590 |
|
TreeMap c = map5(); |
591 |
|
c.containsKey(null); |
592 |
|
shouldThrow(); |
593 |
< |
} catch (NullPointerException e) {} |
593 |
> |
} catch (NullPointerException success) {} |
594 |
|
} |
595 |
|
|
596 |
|
/** |
602 |
|
c.put("sadsdf", "asdads"); |
603 |
|
c.remove(null); |
604 |
|
shouldThrow(); |
605 |
< |
} catch (NullPointerException e) {} |
605 |
> |
} catch (NullPointerException success) {} |
606 |
|
} |
607 |
|
|
608 |
|
/** |
787 |
|
/** |
788 |
|
* Submaps of submaps subdivide correctly |
789 |
|
*/ |
790 |
< |
public void testRecursiveSubMaps() { |
790 |
> |
public void testRecursiveSubMaps() throws Exception { |
791 |
|
int mapSize = 1000; |
792 |
|
Class cl = TreeMap.class; |
793 |
|
NavigableMap<Integer, Integer> map = newMap(cl); |
805 |
|
0, mapSize - 1, true); |
806 |
|
} |
807 |
|
|
808 |
< |
static NavigableMap<Integer, Integer> newMap(Class cl) { |
809 |
< |
NavigableMap<Integer, Integer> result = null; |
810 |
< |
try { |
813 |
< |
result = (NavigableMap<Integer, Integer>) cl.newInstance(); |
814 |
< |
} catch (Exception e) { |
815 |
< |
fail(); |
816 |
< |
} |
808 |
> |
static NavigableMap<Integer, Integer> newMap(Class cl) throws Exception { |
809 |
> |
NavigableMap<Integer, Integer> result |
810 |
> |
= (NavigableMap<Integer, Integer>) cl.newInstance(); |
811 |
|
assertEquals(result.size(), 0); |
812 |
|
assertFalse(result.keySet().iterator().hasNext()); |
813 |
|
return result; |
870 |
|
} else { |
871 |
|
try { |
872 |
|
map.put(key, 2 * key); |
873 |
< |
fail(); |
874 |
< |
} catch (IllegalArgumentException e) { |
881 |
< |
// expected |
882 |
< |
} |
873 |
> |
shouldThrow(); |
874 |
> |
} catch (IllegalArgumentException success) {} |
875 |
|
} |
876 |
|
} |
877 |
|
} |
1066 |
|
assertEq(rs.last(), -1); |
1067 |
|
try { |
1068 |
|
map.firstKey(); |
1069 |
< |
fail(); |
1070 |
< |
} catch (NoSuchElementException e) { |
1079 |
< |
// expected |
1080 |
< |
} |
1069 |
> |
shouldThrow(); |
1070 |
> |
} catch (NoSuchElementException success) {} |
1071 |
|
try { |
1072 |
|
map.lastKey(); |
1073 |
< |
fail(); |
1074 |
< |
} catch (NoSuchElementException e) { |
1085 |
< |
// expected |
1086 |
< |
} |
1073 |
> |
shouldThrow(); |
1074 |
> |
} catch (NoSuchElementException success) {} |
1075 |
|
} |
1076 |
|
} |
1077 |
|
|