< prev index next >

test/jdk/java/util/Map/MapFactories.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

@@ -374,10 +374,20 @@
     @Test(expectedExceptions=NullPointerException.class)
     public void nullArrayDisallowed() {
         Map.ofEntries((Map.Entry<?,?>[])null);
     }
 
+    @Test(dataProvider="all", expectedExceptions=NullPointerException.class)
+    public void containsValueNullShouldThrowNPE(Map<Integer,String> act, Map<Integer,String> exp) {
+        act.containsValue(null);
+    }
+
+    @Test(dataProvider="all", expectedExceptions=NullPointerException.class)
+    public void containsKeyNullShouldThrowNPE(Map<Integer,String> act, Map<Integer,String> exp) {
+        act.containsKey(null);
+    }
+
     @Test(dataProvider="all")
     public void serialEquality(Map<Integer, String> act, Map<Integer, String> exp) {
         // assume that act.equals(exp) tested elsewhere
         Map<Integer, String> copy = serialClone(act);
         assertEquals(act, copy);
< prev index next >