Here you can find the source of assertNotBlank(final String arg, final String message)
Parameter | Description |
---|---|
arg | the string to test |
message | the message to send back if the string is null or empty |
public static final void assertNotBlank(final String arg, final String message)
//package com.java2s; /*/*from w w w . j a v a 2 s .c om*/ * Copyright (c) 2006 Stephan D. Cote' - All rights reserved. * * This program and the accompanying materials are made available under the * terms of the MIT License which accompanies this distribution, and is * available at http://creativecommons.org/licenses/MIT/ * * Contributors: * Stephan D. Cote * - Initial concept and implementation */ public class Main { /** * Throws an IllegalArgumentException with the given message if null or blank. * * @param arg the string to test * @param message the message to send back if the string is null or empty */ public static final void assertNotBlank(final String arg, final String message) { if (arg == null) { throw new IllegalArgumentException("Null argument not allowed: " + message); } if (arg.trim().equals("")) { throw new IllegalArgumentException("Blank argument not allowed: " + message); } } }