130 |
|
*/ |
131 |
|
@Test(dataProvider = "NavigableSet<?>", dataProviderClass = EmptyNavigableSet.class) |
132 |
|
public void testContainsRequiresComparable(String description, NavigableSet<?> navigableSet) { |
133 |
< |
assertThrowsCCE(() -> { |
134 |
< |
navigableSet.contains(new Object()); |
135 |
< |
}, |
133 |
> |
assertThrowsCCE( |
134 |
> |
() -> navigableSet.contains(new Object()), |
135 |
|
description + ": Compareable should be required"); |
136 |
|
} |
137 |
|
|
272 |
|
Object last = (BigInteger.ZERO == first) ? BigInteger.TEN : BigInteger.ZERO; |
273 |
|
|
274 |
|
assertThrowsIAE( |
275 |
< |
() -> { |
277 |
< |
navigableSet.subSet(last, true, first, false); |
278 |
< |
}, |
275 |
> |
() -> navigableSet.subSet(last, true, first, false), |
276 |
|
description |
277 |
|
+ ": Must throw IllegalArgumentException when fromElement is not less than toElement."); |
278 |
|
|
292 |
|
// slightly smaller |
293 |
|
NavigableSet ns = subSet.subSet(first, false, last, false); |
294 |
|
// slight expansion |
295 |
< |
assertThrowsIAE(() -> { |
296 |
< |
ns.subSet(first, true, last, true); |
300 |
< |
}, |
295 |
> |
assertThrowsIAE( |
296 |
> |
() -> ns.subSet(first, true, last, true), |
297 |
|
description + ": Expansion should not be allowed"); |
298 |
|
|
299 |
|
// much smaller |
311 |
|
NavigableSet ns = subSet.headSet(BigInteger.ONE, false); |
312 |
|
|
313 |
|
// slight expansion |
314 |
< |
assertThrowsIAE(() -> { |
315 |
< |
ns.headSet(BigInteger.ONE, true); |
320 |
< |
}, |
314 |
> |
assertThrowsIAE( |
315 |
> |
() -> ns.headSet(BigInteger.ONE, true), |
316 |
|
description + ": Expansion should not be allowed"); |
317 |
|
|
318 |
|
// much smaller |
330 |
|
NavigableSet ns = subSet.tailSet(BigInteger.ONE, false); |
331 |
|
|
332 |
|
// slight expansion |
333 |
< |
assertThrowsIAE(() -> { |
334 |
< |
ns.tailSet(BigInteger.ONE, true); |
340 |
< |
}, |
333 |
> |
assertThrowsIAE( |
334 |
> |
() -> ns.tailSet(BigInteger.ONE, true), |
335 |
|
description + ": Expansion should not be allowed"); |
336 |
|
|
337 |
|
// much smaller |
343 |
|
*/ |
344 |
|
@Test(dataProvider = "NavigableSet<?>", dataProviderClass = EmptyNavigableSet.class) |
345 |
|
public void testTailSet(String description, NavigableSet navigableSet) { |
346 |
< |
assertThrowsNPE(() -> { |
347 |
< |
navigableSet.tailSet(null); |
354 |
< |
}, |
346 |
> |
assertThrowsNPE( |
347 |
> |
() -> navigableSet.tailSet(null), |
348 |
|
description + ": Must throw NullPointerException for null element"); |
349 |
|
|
350 |
< |
assertThrowsCCE(() -> { |
351 |
< |
navigableSet.tailSet(new Object()); |
352 |
< |
}, description); |
350 |
> |
assertThrowsCCE( |
351 |
> |
() -> navigableSet.tailSet(new Object()), |
352 |
> |
description); |
353 |
|
|
354 |
|
NavigableSet ss = navigableSet.tailSet("1", true); |
355 |
|
|