NullUtil { public static void requireNonNulls(Object o0) { if (o0 == null) { throw new NullPointerException(FIRST_ARG_IS_NULL); } } private  NullUtil(); static T[] requireNonNullElements(T[] array); static T requireNonNullElements(T collection); static T[] requireNonNullElements(T[] array, String msg); static void requireNonNulls(Object o0); static void requireNonNulls(Object o0, Object o1); static void requireNonNulls(Object o0, Object o1, Object o2); static void requireNonNulls(Object o0, Object o1, Object o2, Object o3); static void requireNonNulls(Object o0, Object o1, Object o2, Object o3, Object o4); static void requireNonNulls(Object o0, Object o1, Object o2, Object o3, Object o4, Object o5); static void requireNonNulls(Object o0, Object o1, Object o2, Object o3, Object o4, Object o5, Object o6); static void requireNonNulls(Object o0, Object o1, Object o2, Object o3, Object o4, Object o5, Object o6, Object o7); @SafeVarargs // Iterating over an array is safe @SuppressWarnings("varargs") static Map<K, V> requireKeys(Map<K, V> map, K... requiredKeys); static Map<K, V> requireKeys(Map<K, V> map, K requiredKey); static Map<K, V> requireKeys(Map<K, V> map, K requiredKeyA, K requiredKeyB); static Map<K, V> requireKeys(Map<K, V> map, K requiredKeyA, K requiredKeyB, K requiredKeyC);  }
@Test void testRequireNonNulls_Object() { assertThrows(NullPointerException.class, () -> { final String o0 = null; NullUtil.requireNonNulls(o0); }); }
@Test void testRequireNonNulls_Object_NotNull() { assertDoesNotThrow(() -> { final String o0 = "A"; NullUtil.requireNonNulls(o0); }); }
@Test void testRequireNonNulls_Object_Object() { final String obj0 = "A"; final String obj1 = "B"; requireNullPointerException(() -> NullUtil.requireNonNulls(obj0, null)); requireNullPointerException(() -> NullUtil.requireNonNulls(null, obj0)); NullUtil.requireNonNulls(obj0, obj1); }
@Test void testRequireNonNulls_3args() { final String obj0 = "A"; final String obj1 = "B"; final String obj2 = "C"; requireNullPointerException(() -> NullUtil.requireNonNulls(null, obj1, obj2)); requireNullPointerException(() -> NullUtil.requireNonNulls(obj0, null, obj2)); requireNullPointerException(() -> NullUtil.requireNonNulls(obj0, obj1, null)); NullUtil.requireNonNulls(obj0, obj1, obj2); }
@Test void testRequireNonNulls_4args() { final String obj0 = "A"; final String obj1 = "B"; final String obj2 = "C"; final String obj3 = "D"; requireNullPointerException(() -> NullUtil.requireNonNulls(null, obj1, obj2, obj3)); requireNullPointerException(() -> NullUtil.requireNonNulls(obj0, null, obj2, obj3)); requireNullPointerException(() -> NullUtil.requireNonNulls(obj0, obj1, null, obj3)); requireNullPointerException(() -> NullUtil.requireNonNulls(obj0, obj1, obj2, null)); NullUtil.requireNonNulls(obj0, obj1, obj2, obj3); }
@Test void testRequireNonNulls_5args() { final String obj0 = "A"; final String obj1 = "B"; final String obj2 = "C"; final String obj3 = "D"; final String obj4 = "E"; requireNullPointerException(() -> NullUtil.requireNonNulls(null, obj1, obj2, obj3, obj4)); requireNullPointerException(() -> NullUtil.requireNonNulls(obj0, null, obj2, obj3, obj4)); requireNullPointerException(() -> NullUtil.requireNonNulls(obj0, obj1, null, obj3, obj4)); requireNullPointerException(() -> NullUtil.requireNonNulls(obj0, obj1, obj2, null, obj4)); requireNullPointerException(() -> NullUtil.requireNonNulls(obj0, obj1, obj2, obj3, null)); NullUtil.requireNonNulls(obj0, obj1, obj2, obj3, obj4); }
@Test void testRequireNonNulls_6args() { final String obj0 = "A"; final String obj1 = "B"; final String obj2 = "C"; final String obj3 = "D"; final String obj4 = "E"; final String obj5 = "F"; requireNullPointerException(() -> NullUtil.requireNonNulls(null, obj1, obj2, obj3, obj4, obj5)); requireNullPointerException(() -> NullUtil.requireNonNulls(obj0, null, obj2, obj3, obj4, obj5)); requireNullPointerException(() -> NullUtil.requireNonNulls(obj0, obj1, null, obj3, obj4, obj5)); requireNullPointerException(() -> NullUtil.requireNonNulls(obj0, obj1, obj2, null, obj4, obj5)); requireNullPointerException(() -> NullUtil.requireNonNulls(obj0, obj1, obj2, obj3, null, obj5)); requireNullPointerException(() -> NullUtil.requireNonNulls(obj0, obj1, obj2, obj3, obj4, null)); NullUtil.requireNonNulls(obj0, obj1, obj2, obj3, obj4, obj5); }
@Test void testRequireNonNulls_7args() { final String obj0 = "A"; final String obj1 = "B"; final String obj2 = "C"; final String obj3 = "D"; final String obj4 = "E"; final String obj5 = "F"; final String obj6 = "G"; requireNullPointerException(() -> NullUtil.requireNonNulls(null, obj1, obj2, obj3, obj4, obj5, obj6)); requireNullPointerException(() -> NullUtil.requireNonNulls(obj0, null, obj2, obj3, obj4, obj5, obj6)); requireNullPointerException(() -> NullUtil.requireNonNulls(obj0, obj1, null, obj3, obj4, obj5, obj6)); requireNullPointerException(() -> NullUtil.requireNonNulls(obj0, obj1, obj2, null, obj4, obj5, obj6)); requireNullPointerException(() -> NullUtil.requireNonNulls(obj0, obj1, obj2, obj3, null, obj5, obj6)); requireNullPointerException(() -> NullUtil.requireNonNulls(obj0, obj1, obj2, obj3, obj4, null, obj6)); requireNullPointerException(() -> NullUtil.requireNonNulls(obj0, obj1, obj2, obj3, obj4, obj5, null)); NullUtil.requireNonNulls(obj0, obj1, obj2, obj3, obj4, obj5, obj6); }
@Test void testRequireNonNulls_8args() { final String obj0 = "A"; final String obj1 = "B"; final String obj2 = "C"; final String obj3 = "D"; final String obj4 = "E"; final String obj5 = "F"; final String obj6 = "G"; final String obj7 = "H"; requireNullPointerException(() -> NullUtil.requireNonNulls(null, obj1, obj2, obj3, obj4, obj5, obj6, obj7)); requireNullPointerException(() -> NullUtil.requireNonNulls(obj0, null, obj2, obj3, obj4, obj5, obj6, obj7)); requireNullPointerException(() -> NullUtil.requireNonNulls(obj0, obj1, null, obj3, obj4, obj5, obj6, obj7)); requireNullPointerException(() -> NullUtil.requireNonNulls(obj0, obj1, obj2, null, obj4, obj5, obj6, obj7)); requireNullPointerException(() -> NullUtil.requireNonNulls(obj0, obj1, obj2, obj3, null, obj5, obj6, obj7)); requireNullPointerException(() -> NullUtil.requireNonNulls(obj0, obj1, obj2, obj3, obj4, null, obj6, obj7)); requireNullPointerException(() -> NullUtil.requireNonNulls(obj0, obj1, obj2, obj3, obj4, obj5, null, obj7)); requireNullPointerException(() -> NullUtil.requireNonNulls(obj0, obj1, obj2, obj3, obj4, obj5, obj6, null)); NullUtil.requireNonNulls(obj0, obj1, obj2, obj3, obj4, obj5, obj6, obj7); }