< prev index next >

test/jdk/java/util/Collection/SetFactories.java

Print this page
rev 48431 : 8193128: Reduce number of implementation classes returned by List/Set/Map.of()
8191418: List.of().indexOf(null) doesn't throw NullPointerException
Reviewed-by: smarks, jrose, martin, plevart

@@ -264,10 +264,15 @@
     @Test(expectedExceptions=NullPointerException.class)
     public void nullArrayDisallowed() {
         Set.of((Object[])null);
     }
 
+    @Test(dataProvider="all", expectedExceptions=NullPointerException.class)
+    public void containsNullShouldThrowNPE(Set<String> act, Set<String> exp) {
+        act.contains(null);
+    }
+
     @Test(dataProvider="all")
     public void serialEquality(Set<String> act, Set<String> exp) {
         // assume that act.equals(exp) tested elsewhere
         Set<String> copy = serialClone(act);
         assertEquals(act, copy);
< prev index next >