@Test public void shouldReturnSameObjectWhenCollectionHasItems() throws Exception { List<String> list = new ArrayList<>(); list.add("0"); Collection<String> returnedList = ConsistencyUtils.checkNotEmpty(list); assertSame(list, returnedList); }
public static <T> Collection<T> checkNotEmpty(Collection<T> container) { if (checkNotNull(container).isEmpty()) { throw new IllegalArgumentException("Container cannot be null or empty"); } return container; }
ConsistencyUtils { public static <T> Collection<T> checkNotEmpty(Collection<T> container) { if (checkNotNull(container).isEmpty()) { throw new IllegalArgumentException("Container cannot be null or empty"); } return container; } }
ConsistencyUtils { public static <T> Collection<T> checkNotEmpty(Collection<T> container) { if (checkNotNull(container).isEmpty()) { throw new IllegalArgumentException("Container cannot be null or empty"); } return container; } private  ConsistencyUtils(); }
ConsistencyUtils { public static <T> Collection<T> checkNotEmpty(Collection<T> container) { if (checkNotNull(container).isEmpty()) { throw new IllegalArgumentException("Container cannot be null or empty"); } return container; } 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); }
ConsistencyUtils { public static <T> Collection<T> checkNotEmpty(Collection<T> container) { if (checkNotNull(container).isEmpty()) { throw new IllegalArgumentException("Container cannot be null or empty"); } return container; } 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);  }