### Question:
Preconditions { public static <T> T notNull(T object) { return notNull(object, "Object must not be null"); } private  Preconditions(); static T notNull(T object); static T notNull(T object, String message); static T notNull(T object, Supplier<String> messageSupplier); static Collection<T> doesNotContainNull(Collection<T> collection); static Collection<T> doesNotContainNull(Collection<T> collection, String message); static Collection<T> doesNotContainNull(Collection<T> collection, Supplier<String> messageSupplier); static void check(boolean expression); static void check(boolean expression, String message); static void check(boolean expression, Supplier<String> messageSupplier);  }### Answer:
@Test void checkNotNullThrowsExceptionIfNull() { assertThrows(NullPointerException.class, () -> Preconditions.notNull(null)); }
@Test void checkNotNullExceptionHasGivenMessage() { final Throwable throwable = assertThrows(NullPointerException.class, () -> Preconditions.notNull(null, "test")); assertEquals("test", throwable.getMessage()); }
@Test void checkNotNullEvaluatesSupplier() { final Throwable throwable = assertThrows(NullPointerException.class, () -> Preconditions.notNull(null, () -> "test")); assertEquals("test", throwable.getMessage()); }
@Test @SuppressWarnings("ObviousNullCheck") void resultIsReturnedIfNotNull() { assertEquals("test", Preconditions.notNull("test")); }