ConsistencyUtils { public static <T> T checkNotNull(T object) { return checkNotNull(object, "The object is null"); } private  ConsistencyUtils(); static T checkNotNull(T object); static T checkNotNull(T object, String message); static String checkEmptyString(String object, String message); static String checkEmptyString(String object); static T checkInstance(Object obj, Class<T> type); static Collection<T> checkNotEmpty(Collection<T> container); static Collection<T> containsNoNulls(Collection<T> container);  }
@Test public void utilsNotNullTestNull() { thrown.expect(Exception.class); thrown.expectMessage("This instance cannot be null"); ConsistencyUtils.checkNotNull(null, "This instance cannot be null"); }
@Test public void utilsNotNullTestOK() { String testString = ConsistencyUtils.checkNotNull("Hello World", "This instance cannot be null"); assertEquals(testString, "Hello World"); }
@Test public void utilsNotNullNoMessageTestOK() { String testString = ConsistencyUtils.checkNotNull("Hello World"); assertEquals(testString, "Hello World"); }