ViewVC Help
View File | Revision Log | Show Annotations | Download File | Root Listing
root/jsr166/jsr166/src/test/jtreg/util/Collections/EmptyNavigableSet.java
(Generate patch)

Comparing jsr166/src/test/jtreg/util/Collections/EmptyNavigableSet.java (file contents):
Revision 1.6 by jsr166, Mon May 15 21:39:24 2017 UTC vs.
Revision 1.10 by jsr166, Sun Jan 7 23:48:13 2018 UTC

# Line 50 | Line 50 | import static org.testng.Assert.assertTr
50   public class EmptyNavigableSet {
51  
52      public static <T> void assertInstance(T actual, Class<? extends T> expected) {
53 <        assertInstance(expected.isInstance(actual), null);
53 >        assertInstance(actual, expected, null);
54      }
55  
56      public static <T> void assertInstance(T actual, Class<? extends T> expected, String message) {
# Line 130 | Line 130 | public class EmptyNavigableSet {
130       */
131      @Test(dataProvider = "NavigableSet<?>", dataProviderClass = EmptyNavigableSet.class)
132      public void testContainsRequiresComparable(String description, NavigableSet<?> navigableSet) {
133 <        assertThrowsCCE(() -> {
134 <            navigableSet.contains(new Object());
135 <        },
136 <            description + ": Compareable should be required");
133 >        assertThrowsCCE(
134 >            () -> navigableSet.contains(new Object()),
135 >            description + ": Comparable should be required");
136      }
137  
138      /**
# Line 182 | Line 181 | public class EmptyNavigableSet {
181       */
182      @Test(dataProvider = "NavigableSet<?>", dataProviderClass = EmptyNavigableSet.class)
183      public void testFirst(String description, NavigableSet<?> navigableSet) {
184 <        assertThrowsNSEE(() -> {
186 <            navigableSet.first();
187 <        }, description);
184 >        assertThrowsNSEE(navigableSet::first, description);
185      }
186  
187      /**
# Line 210 | Line 207 | public class EmptyNavigableSet {
207       */
208      @Test(dataProvider = "NavigableSet<?>", dataProviderClass = EmptyNavigableSet.class)
209      public void testLast(String description, NavigableSet<?> navigableSet) {
210 <        assertThrowsNSEE(() -> {
214 <            navigableSet.last();
215 <        }, description);
210 >        assertThrowsNSEE(navigableSet::last, description);
211      }
212  
213      /**
# Line 277 | Line 272 | public class EmptyNavigableSet {
272          Object last = (BigInteger.ZERO == first) ? BigInteger.TEN : BigInteger.ZERO;
273  
274              assertThrowsIAE(
275 <                () -> {
281 <                    navigableSet.subSet(last, true, first, false);
282 <                },
275 >                () -> navigableSet.subSet(last, true, first, false),
276                  description
277                  + ": Must throw IllegalArgumentException when fromElement is not less than toElement.");
278  
# Line 299 | Line 292 | public class EmptyNavigableSet {
292          // slightly smaller
293          NavigableSet ns = subSet.subSet(first, false, last, false);
294          // slight expansion
295 <        assertThrowsIAE(() -> {
296 <            ns.subSet(first, true, last, true);
304 <        },
295 >        assertThrowsIAE(
296 >            () -> ns.subSet(first, true, last, true),
297              description + ": Expansion should not be allowed");
298  
299          // much smaller
# Line 319 | Line 311 | public class EmptyNavigableSet {
311          NavigableSet ns = subSet.headSet(BigInteger.ONE, false);
312  
313          // slight expansion
314 <        assertThrowsIAE(() -> {
315 <            ns.headSet(BigInteger.ONE, true);
324 <        },
314 >        assertThrowsIAE(
315 >            () -> ns.headSet(BigInteger.ONE, true),
316              description + ": Expansion should not be allowed");
317  
318          // much smaller
# Line 339 | Line 330 | public class EmptyNavigableSet {
330          NavigableSet ns = subSet.tailSet(BigInteger.ONE, false);
331  
332          // slight expansion
333 <        assertThrowsIAE(() -> {
334 <            ns.tailSet(BigInteger.ONE, true);
344 <        },
333 >        assertThrowsIAE(
334 >            () -> ns.tailSet(BigInteger.ONE, true),
335              description + ": Expansion should not be allowed");
336  
337          // much smaller
# Line 353 | Line 343 | public class EmptyNavigableSet {
343       */
344      @Test(dataProvider = "NavigableSet<?>", dataProviderClass = EmptyNavigableSet.class)
345      public void testTailSet(String description, NavigableSet navigableSet) {
346 <        assertThrowsNPE(() -> {
347 <            navigableSet.tailSet(null);
358 <        },
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  

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines