@Test public void assertStringNotEmpty_NonEmptyString_ReturnsSameString() { final String string = "foo"; assertEquals(string, ValidationUtils.assertStringNotEmpty(string, "someString")); }
public static String assertStringNotEmpty(String string, String fieldName) throws IllegalArgumentException { assertNotNull(string, fieldName); if (string.isEmpty()) { throw new IllegalArgumentException(String.format("%s cannot be empty", fieldName)); } return string; }
ValidationUtils { public static String assertStringNotEmpty(String string, String fieldName) throws IllegalArgumentException { assertNotNull(string, fieldName); if (string.isEmpty()) { throw new IllegalArgumentException(String.format("%s cannot be empty", fieldName)); } return string; } }
ValidationUtils { public static String assertStringNotEmpty(String string, String fieldName) throws IllegalArgumentException { assertNotNull(string, fieldName); if (string.isEmpty()) { throw new IllegalArgumentException(String.format("%s cannot be empty", fieldName)); } return string; }  }
ValidationUtils { public static String assertStringNotEmpty(String string, String fieldName) throws IllegalArgumentException { assertNotNull(string, fieldName); if (string.isEmpty()) { throw new IllegalArgumentException(String.format("%s cannot be empty", fieldName)); } return string; }  static T assertNotNull(T object, String fieldName); static void assertAllAreNull(String messageIfNull, Object... objects); static int assertIsPositive(int num, String fieldName); static T assertNotEmpty(T collection, String fieldName); static T[] assertNotEmpty(T[] array, String fieldName); static String assertStringNotEmpty(String string, String fieldName); }
ValidationUtils { public static String assertStringNotEmpty(String string, String fieldName) throws IllegalArgumentException { assertNotNull(string, fieldName); if (string.isEmpty()) { throw new IllegalArgumentException(String.format("%s cannot be empty", fieldName)); } return string; }  static T assertNotNull(T object, String fieldName); static void assertAllAreNull(String messageIfNull, Object... objects); static int assertIsPositive(int num, String fieldName); static T assertNotEmpty(T collection, String fieldName); static T[] assertNotEmpty(T[] array, String fieldName); static String assertStringNotEmpty(String string, String fieldName);  }