Here you can find the source of assertStringNotEmpty(String str, String name)
Parameter | Description |
---|---|
str | the string to check. |
name | the string's name. |
Parameter | Description |
---|---|
IllegalArgumentException | if the object is empty. |
static void assertStringNotEmpty(String str, String name)
//package com.java2s; public class Main { /**/*from w w w .j a v a2 s .c om*/ * Check if the string is empty. * @param str * the string to check. * @param name * the string's name. * @throws IllegalArgumentException * if the object is empty. */ static void assertStringNotEmpty(String str, String name) { assertObjectNotNull(str, name); if (str.trim().length() == 0) { throw new IllegalArgumentException("the string " + name + " should not be empty."); } } /** * Check if the object is null. * @param obj * the object to check. * @param name * the object's name * @throws IllegalArgumentException * if the object is null. */ static void assertObjectNotNull(Object obj, String name) { if (obj == null) { throw new IllegalArgumentException("the object " + name + " should not be null."); } } }