Java Assert assertQualifiedString(String str, String argName)

Here you can find the source of assertQualifiedString(String str, String argName)

Description

assert Qualified String

License

Apache License

Declaration

public static void assertQualifiedString(String str, String argName) 

Method Source Code

//package com.java2s;
//License from project: Apache License 

public class Main {
    public static void assertQualifiedString(String str, String argName) {
        if (!isQualifiedString(str)) {
            throw new IllegalArgumentException(
                    "Null or zero length string found. str[" + str
                            + "] argumentName[" + argName + "]");
        }//from w  ww  . jav a2 s  . co  m
    }

    /**
     * This method will check for the null string
     * 
     * @param str to be check
     * @return true if string is not null
     */
    public static boolean isQualifiedString(String str) {
        return str != null && str.trim().length() > 0;
    }
}

Related

  1. assertPasswordMeetsRequirements(String password, boolean expected)
  2. assertPositive(int num, String err)
  3. assertPositive(int val, String msg)
  4. assertPositive(int value)
  5. assertPrecondition(boolean b)
  6. assertRange(String label, double value, double min, double max)
  7. assertRequiredArgs(Object[] methodArgs, int requiredArgs, String methodName)
  8. assertSame(Object expected, Object actual)
  9. assertSame(Object targetObject0, Object targetObject1)