### Question:
Preconditions { public static <T> T checkNotNull(T reference) { if (reference == null) { throw new NullPointerException(); } return reference; } private  Preconditions(); static T checkNotNull(T reference); static T checkNotNull(T reference, @Nullable Object errorMessage); @NonNull static String checkNotEmpty(String str, @Nullable Object errorMessage); @NonNull static T checkCollectionNotEmpty(
            T collection, @Nullable Object errorMessage); @NonNull static String checkNullOrNotEmpty(String str, @Nullable Object errorMessage); static void checkArgument(boolean expression); static void checkArgument(boolean expression, @Nullable Object errorMessage); static void checkArgument(
            boolean expression,
            @NonNull String errorTemplate,
            Object... params);  }### Answer:
@Test(expected = NullPointerException.class) public void testNotNull_null() { checkNotNull(null); }
@Test public void testNotNullWithMessage() { checkNotNull(new String(), TEST_MSG); }
@Test public void testNotNullWithMessage_null() { try { checkNotNull(null, TEST_MSG); fail("Expected NullPointerException not thrown."); } catch (NullPointerException ex) { assertEquals(TEST_MSG, ex.getMessage()); } }
@Test public void testNotNull() { checkNotNull(new String()); }