Here you can find the source of assertStringNotEmpty(String str, String name)
Parameter | Description |
---|---|
str | the given string to check |
name | the name to identify the string. |
Parameter | Description |
---|---|
IllegalArgumentException | if the given string is not null and empty (trimmed). |
static void assertStringNotEmpty(String str, String name)
//package com.java2s; public class Main { /**//from w w w . jav a 2 s . c om * Check if the given string is empty (trimmed). * * @param str the given string to check * @param name the name to identify the string. * * @throws IllegalArgumentException if the given string is not null and empty (trimmed). */ static void assertStringNotEmpty(String str, String name) { if (str != null && str.trim().length() == 0) { throw new IllegalArgumentException(name + " should not be empty (trimmed)."); } } }