### Question:
Preconditions { public static <T> T checkArgument(T argument, Function<T, Boolean> predicate, Object errorMessage) { if (!predicate.apply(argument)) { throw new IllegalArgumentException(String.valueOf(errorMessage)); } else { return argument; } }  static T checkArgument(T argument, Function<T, Boolean> predicate, Object errorMessage); static T checkNotNull(T argument); static String checkNotNullOrEmpty(String argument, Object errorMessage); static T checkNotNull(T argument, Object errorMessage);  }### Answer:
@Test(expected = IllegalArgumentException.class) public void should_return_error_when_argument_is_invalid(){ Preconditions.checkArgument(null, Objects::nonNull, "value cannot be null"); }
@Test public void should_check_when_argument_is_valid(){ Preconditions.checkArgument("", Objects::nonNull, "value cannot be null"); }