@Test public void parameterNotNullWithMissingParameterName() throws Exception { exception.expect(IllegalArgumentException.class); exception.expectMessage("You must provide a parameter name!"); Assert.assertNotNull("", null); }
public static <T> T assertNotNull(T value, String parameterName) { if (parameterName == null) { throw new IllegalArgumentException("You must provide a parameter name!"); } if (value == null) { throw new IllegalArgumentException("Parameter >" + parameterName + "< must not be null!"); } return value; }
Assert { public static <T> T assertNotNull(T value, String parameterName) { if (parameterName == null) { throw new IllegalArgumentException("You must provide a parameter name!"); } if (value == null) { throw new IllegalArgumentException("Parameter >" + parameterName + "< must not be null!"); } return value; } }
Assert { public static <T> T assertNotNull(T value, String parameterName) { if (parameterName == null) { throw new IllegalArgumentException("You must provide a parameter name!"); } if (value == null) { throw new IllegalArgumentException("Parameter >" + parameterName + "< must not be null!"); } return value; } private  Assert(); }
Assert { public static <T> T assertNotNull(T value, String parameterName) { if (parameterName == null) { throw new IllegalArgumentException("You must provide a parameter name!"); } if (value == null) { throw new IllegalArgumentException("Parameter >" + parameterName + "< must not be null!"); } return value; } private  Assert(); static T assertNotNull(T value, String parameterName); }
Assert { public static <T> T assertNotNull(T value, String parameterName) { if (parameterName == null) { throw new IllegalArgumentException("You must provide a parameter name!"); } if (value == null) { throw new IllegalArgumentException("Parameter >" + parameterName + "< must not be null!"); } return value; } private  Assert(); static T assertNotNull(T value, String parameterName);  }