Preconditions { public static <T> T checkNotNull(T reference, Object errorMessage) { if (reference == null) { throw new NullPointerException(String.valueOf(errorMessage)); } return reference; } private  Preconditions(); static void checkArgument(boolean expression, Object errorMessage); static T checkNotNull(T reference, Object errorMessage);  }
@Test(expected = NullPointerException.class) public void testCheckNotNullGivenNullThrowsException() { Preconditions.checkNotNull(null, "message"); }