Ensure { public static String notNullOrEmpty(String argument, String argumentName) { if (argument == null || argument.trim().isEmpty()) { throw new IllegalArgumentException("Argument " + argumentName + " must not be null or empty."); } return argument; } private  Ensure(); static T notNull(T argument, String argumentName); static String notNullOrEmpty(String argument, String argumentName);  }
@Test(expected = IllegalArgumentException.class) public void shouldThrowExceptionWhenNullStringGiven() { notNullOrEmpty(null, "testString"); }