267 () -> {
268 SortedSet ss = navigableSet.subSet(obj1, obj2);
269 },
270 ClassCastException.class, description
271 + ": Must throw ClassCastException for parameter which is not Comparable.");
272
273 // minimal range
274 navigableSet.subSet(BigInteger.ZERO, false, BigInteger.ZERO, false);
275 navigableSet.subSet(BigInteger.ZERO, false, BigInteger.ZERO, true);
276 navigableSet.subSet(BigInteger.ZERO, true, BigInteger.ZERO, false);
277 navigableSet.subSet(BigInteger.ZERO, true, BigInteger.ZERO, true);
278
279 Object first = isDescending(navigableSet) ? BigInteger.TEN : BigInteger.ZERO;
280 Object last = (BigInteger.ZERO == first) ? BigInteger.TEN : BigInteger.ZERO;
281
282 assertThrows(
283 () -> {
284 navigableSet.subSet(last, true, first, false);
285 },
286 IllegalArgumentException.class, description
287 + ": Must throw IllegalArgumentException when fromElement is not less then then toElement.");
288
289 navigableSet.subSet(first, true, last, false);
290 }
291
292 @Test(dataProvider = "NavigableSet<?>", dataProviderClass = EmptyNavigableSet.class)
293 public void testSubSetRanges(String description, NavigableSet navigableSet) {
294 Object first = isDescending(navigableSet) ? BigInteger.TEN : BigInteger.ZERO;
295 Object last = (BigInteger.ZERO == first) ? BigInteger.TEN : BigInteger.ZERO;
296
297 NavigableSet subSet = navigableSet.subSet(first, true, last, true);
298
299 // same subset
300 subSet.subSet(first, true, last, true);
301
302 // slightly smaller
303 NavigableSet ns = subSet.subSet(first, false, last, false);
304 // slight exapansion
305 assertThrows(() -> {
306 ns.subSet(first, true, last, true);
307 },
|
267 () -> {
268 SortedSet ss = navigableSet.subSet(obj1, obj2);
269 },
270 ClassCastException.class, description
271 + ": Must throw ClassCastException for parameter which is not Comparable.");
272
273 // minimal range
274 navigableSet.subSet(BigInteger.ZERO, false, BigInteger.ZERO, false);
275 navigableSet.subSet(BigInteger.ZERO, false, BigInteger.ZERO, true);
276 navigableSet.subSet(BigInteger.ZERO, true, BigInteger.ZERO, false);
277 navigableSet.subSet(BigInteger.ZERO, true, BigInteger.ZERO, true);
278
279 Object first = isDescending(navigableSet) ? BigInteger.TEN : BigInteger.ZERO;
280 Object last = (BigInteger.ZERO == first) ? BigInteger.TEN : BigInteger.ZERO;
281
282 assertThrows(
283 () -> {
284 navigableSet.subSet(last, true, first, false);
285 },
286 IllegalArgumentException.class, description
287 + ": Must throw IllegalArgumentException when fromElement is not less than toElement.");
288
289 navigableSet.subSet(first, true, last, false);
290 }
291
292 @Test(dataProvider = "NavigableSet<?>", dataProviderClass = EmptyNavigableSet.class)
293 public void testSubSetRanges(String description, NavigableSet navigableSet) {
294 Object first = isDescending(navigableSet) ? BigInteger.TEN : BigInteger.ZERO;
295 Object last = (BigInteger.ZERO == first) ? BigInteger.TEN : BigInteger.ZERO;
296
297 NavigableSet subSet = navigableSet.subSet(first, true, last, true);
298
299 // same subset
300 subSet.subSet(first, true, last, true);
301
302 // slightly smaller
303 NavigableSet ns = subSet.subSet(first, false, last, false);
304 // slight exapansion
305 assertThrows(() -> {
306 ns.subSet(first, true, last, true);
307 },
|