### Question:
Validator { public static void checkNotNullAndNotEmpty(@Nullable String value, String propertyName) { Preconditions.checkNotNull(value, "Property '" + propertyName + "' cannot be null"); Preconditions.checkArgument( !value.trim().isEmpty(), "Property '" + propertyName + "' cannot be an empty string"); }  static void checkNotNullAndNotEmpty(@Nullable String value, String propertyName); static void checkNullOrNotEmpty(@Nullable String value, String propertyName); static void checkNotNullAndNotEmpty(@Nullable Collection<?> value, String propertyName); static void checkNullOrNonNullNonEmptyEntries(
      @Nullable Collection<String> values, String propertyName); static void checkNullOrNonNullNonEmptyEntries(
      @Nullable Map<String, String> values, String propertyName); static void checkNullOrNonNullEntries(
      @Nullable Collection<?> values, String propertyName); static void checkEquals(
      @Nullable String value, String propertyName, String expectedValue);  }### Answer:
@Test public void testCheckNotNullAndNotEmpty_stringPass() { Validator.checkNotNullAndNotEmpty("value", "ignored"); }
@Test public void testCheckNotNullAndNotEmpty_stringFailNull() { try { Validator.checkNotNullAndNotEmpty((String) null, "test"); Assert.fail(); } catch (NullPointerException npe) { Assert.assertEquals("Property 'test' cannot be null", npe.getMessage()); } }
@Test public void testCheckNotNullAndNotEmpty_stringFailEmpty() { try { Validator.checkNotNullAndNotEmpty(" ", "test"); Assert.fail(); } catch (IllegalArgumentException iae) { Assert.assertEquals("Property 'test' cannot be an empty string", iae.getMessage()); } }
@Test public void testCheckNotEmpty_collectionPass() { Validator.checkNotNullAndNotEmpty(ImmutableList.of("value"), "ignored"); }
@Test public void testCheckNotEmpty_collectionFailNull() { try { Validator.checkNotNullAndNotEmpty((Collection<?>) null, "test"); Assert.fail(); } catch (NullPointerException npe) { Assert.assertEquals("Property 'test' cannot be null", npe.getMessage()); } }
@Test public void testCheckNotEmpty_collectionFailEmpty() { try { Validator.checkNotNullAndNotEmpty(ImmutableList.of(), "test"); Assert.fail(); } catch (IllegalArgumentException iae) { Assert.assertEquals("Property 'test' cannot be an empty collection", iae.getMessage()); } }