@Test public void checkNotNull_valid() { String data = "string"; String sameAsData = Utils.checkNotNull(data, "data == null"); assertEquals(data, sameAsData); Object o1 = Arrays.asList(1, 2, 3); Object sameAsO1 = Utils.checkNotNull(o1, "o1 == null"); assertEquals(o1, sameAsO1); }
static <T> T checkNotNull(T object, String message) { if (object == null) { throw new NullPointerException(message); } return object; }
Utils { static <T> T checkNotNull(T object, String message) { if (object == null) { throw new NullPointerException(message); } return object; } }
Utils { static <T> T checkNotNull(T object, String message) { if (object == null) { throw new NullPointerException(message); } return object; } private  Utils(); }
Utils { static <T> T checkNotNull(T object, String message) { if (object == null) { throw new NullPointerException(message); } return object; } private  Utils();  }
Utils { static <T> T checkNotNull(T object, String message) { if (object == null) { throw new NullPointerException(message); } return object; } private  Utils();   }