### Question:
ParamUtils { public static <T extends Collection<?>> T nonEmpty(final T collection, final Supplier<String> message) { if (!nonNull(collection, message).isEmpty()) { return collection; } throw new IllegalArgumentException(message.get()); } private  ParamUtils(); static void validate(final boolean condition, final Supplier<String> message); static int validateIndex(final int index, final int length); static T nonNull(final T object, final Supplier<String> message); static T nonNull(final T object); static T nonEmpty(final T collection, final Supplier<String> message); static T nonEmpty(final T collection);  }### Answer:
@Test(dataProvider = "emptyOrNullCollections") public void testNonEmptyCollection(final Collection<?> collection, final String message) { try { ParamUtils.nonEmpty(collection, () -> message); Assert.fail(); } catch (final IllegalArgumentException e) { Assert.assertEquals(e.getMessage(), message); } }
@Test(dataProvider = "emptyOrNullCollections") public void testNonEmptyCollectionWithoutMessage(final Collection<?> collection, final String message) { try { ParamUtils.nonEmpty(collection); Assert.fail(); } catch (final IllegalArgumentException e) { Assert.assertEquals(e.getMessage(), "collection cannot be null or empty"); } }