@Test public void shouldReturnObjectWhenNotNullObjectGiven() { Object testObject = new Object(); assertThat(notNull(testObject, "testObject"), is(equalTo(testObject))); }
public static <T> T notNull(T argument, String argumentName) { if (argument == null) { throw new IllegalArgumentException("Argument " + argumentName + " must not be null."); } return argument; }
Ensure { public static <T> T notNull(T argument, String argumentName) { if (argument == null) { throw new IllegalArgumentException("Argument " + argumentName + " must not be null."); } return argument; } }
Ensure { public static <T> T notNull(T argument, String argumentName) { if (argument == null) { throw new IllegalArgumentException("Argument " + argumentName + " must not be null."); } return argument; } private  Ensure(); }
Ensure { public static <T> T notNull(T argument, String argumentName) { if (argument == null) { throw new IllegalArgumentException("Argument " + argumentName + " must not be null."); } return argument; } private  Ensure(); static T notNull(T argument, String argumentName); static String notNullOrEmpty(String argument, String argumentName); }
Ensure { public static <T> T notNull(T argument, String argumentName) { if (argument == null) { throw new IllegalArgumentException("Argument " + argumentName + " must not be null."); } return argument; } private  Ensure(); static T notNull(T argument, String argumentName); static String notNullOrEmpty(String argument, String argumentName);  }