### Question:
Check { public static void isNotEmptyOrNull(final String field, final String value) throws ValidationException { if (value == null || value.trim().isEmpty()) { throw new ValidationException(NULL_OR_EMPTY, field); } }  static void isNotEmptyOrNull(final String field, final String value); static void isNotEmptyOrNull(final String field, final Collection<?> value); static void isNotNull(final String field, final Object value); static void isValidEmail(final String field, final String email); static void isValidPhoneNumber(final String field, final String phoneNumber); static void contains(final String field, final String value, final CharSequence expectedSubsequence); static void isLength(final String field, final String string, final int expectedLength); static void isBetween(final String field, final int value, final int minValue, final int maxValue); static void matchesPattern(final String field, final String value, final Pattern pattern);  }### Answer:
@Test public void shouldNotThrowValidationException_givenNonEmptyCollection() { final Collection<Object> value = Collections.singletonList(new Object()); ValidationException actualException = null; try { Check.isNotEmptyOrNull(field, value); } catch (final ValidationException e) { actualException = e; } assertNull(actualException); }
@Test public void shouldThrowValidationException_givenNullValue() { final String value = null; ValidationException actualException = null; try { Check.isNotEmptyOrNull(field, value); } catch (final ValidationException e) { actualException = e; } assertNotNull(actualException); assertThat(actualException.getFields()[0], is(field)); }
@Test public void shouldThrowValidationException_givenEmptyValue() { final String value = " \t "; ValidationException actualException = null; try { Check.isNotEmptyOrNull(field, value); } catch (final ValidationException e) { actualException = e; } assertNotNull(actualException); assertThat(actualException.getFields()[0], is(field)); }
@Test public void shouldNotThrowValidationException_givenNonEmptyValue() { final String value = Randoms.randomString(10); ValidationException actualException = null; try { Check.isNotEmptyOrNull(field, value); } catch (final ValidationException e) { actualException = e; } assertNull(actualException); }
@Test public void shouldThrowValidationException_givenNullCollection() { final Collection<Object> value = null; ValidationException actualException = null; try { Check.isNotEmptyOrNull(field, value); } catch (final ValidationException e) { actualException = e; } assertNotNull(actualException); assertThat(actualException.getFields()[0], is(field)); }
@Test public void shouldThrowValidationException_givenEmptyCollection() { final Collection<Object> value = Collections.emptyList(); ValidationException actualException = null; try { Check.isNotEmptyOrNull(field, value); } catch (final ValidationException e) { actualException = e; } assertNotNull(actualException); assertThat(actualException.getFields()[0], is(field)); }