669 |
|
/** |
670 |
|
* Subsets of subsets subdivide correctly |
671 |
|
*/ |
672 |
< |
public void testRecursiveSubSets() { |
672 |
> |
public void testRecursiveSubSets() throws Exception { |
673 |
|
int setSize = 1000; |
674 |
|
Class cl = TreeSet.class; |
675 |
|
|
688 |
|
0, setSize - 1, true); |
689 |
|
} |
690 |
|
|
691 |
< |
static NavigableSet<Integer> newSet(Class cl) { |
692 |
< |
NavigableSet<Integer> result = null; |
693 |
< |
try { |
694 |
< |
result = (NavigableSet<Integer>) cl.newInstance(); |
695 |
< |
} catch (Exception e) { |
696 |
< |
fail(); |
697 |
< |
} |
691 |
> |
static NavigableSet<Integer> newSet(Class cl) throws Exception { |
692 |
> |
NavigableSet<Integer> result = (NavigableSet<Integer>) cl.newInstance(); |
693 |
|
assertEquals(result.size(), 0); |
694 |
|
assertFalse(result.iterator().hasNext()); |
695 |
|
return result; |
752 |
|
} else { |
753 |
|
try { |
754 |
|
set.add(element); |
755 |
< |
fail(); |
756 |
< |
} catch (IllegalArgumentException e) { |
762 |
< |
// expected |
763 |
< |
} |
755 |
> |
shouldThrow(); |
756 |
> |
} catch (IllegalArgumentException success) {} |
757 |
|
} |
758 |
|
} |
759 |
|
} |
952 |
|
assertEq(rs.last(), -1); |
953 |
|
try { |
954 |
|
set.first(); |
955 |
< |
fail(); |
956 |
< |
} catch (NoSuchElementException e) { |
964 |
< |
// expected |
965 |
< |
} |
955 |
> |
shouldThrow(); |
956 |
> |
} catch (NoSuchElementException success) {} |
957 |
|
try { |
958 |
|
set.last(); |
959 |
< |
fail(); |
960 |
< |
} catch (NoSuchElementException e) { |
970 |
< |
// expected |
971 |
< |
} |
959 |
> |
shouldThrow(); |
960 |
> |
} catch (NoSuchElementException success) {} |
961 |
|
} |
962 |
|
} |
963 |
|
|