### Question:
ParamChecker { public static String validateActionName(String actionName) { ParamChecker.notEmpty(actionName, "action name"); if (actionName.length() > MAX_NODE_NAME_LEN) { throw new IllegalArgumentException(XLog.format("name [{0}] must be {1} chars or less", actionName, MAX_NODE_NAME_LEN)); } char c = actionName.charAt(0); if (!(c >= 'A' && c <= 'Z') && !(c >= 'a' && c <= 'z') && !(c == '_')) { throw new IllegalArgumentException(XLog.format("name [{0}], must start with [A-Za-z_]", actionName)); } for (int i = 1; i < actionName.length(); i++) { c = actionName.charAt(i); if (!(c >= '0' && c <= '9') && !(c >= 'A' && c <= 'Z') && !(c >= 'a' && c <= 'z') && !(c == '_' || c == '-')) { throw new IllegalArgumentException(XLog.format("name [{0}] must be [A-Za-z_][0-9A-Za-z_]*", actionName)); } } return actionName; }  static String notEmpty(String str, String name); static String notEmpty(String str, String name, String info); static List<String> notEmptyElements(List<String> list, String name); static String validateActionName(String actionName); static boolean isValidIdentifier(String token); static int checkGTZero(int value, String name); static int checkGEZero(int value, String name); static int checkLEZero(int value, String name); static int checkInteger(String val, String name); static String checkFrequency(String val); static Date checkDateOozieTZ(String date, String name); static TimeZone checkTimeZone(String tzStr, String name); static boolean isMember(String item, String[] members, String name);  }### Answer:
@Test public void testValidToken() { ParamChecker.validateActionName("azAZ09_-"); try { ParamChecker.validateActionName(null); fail(); } catch (IllegalArgumentException ex) { } try { ParamChecker.validateActionName(""); fail(); } catch (IllegalArgumentException ex) { } try { ParamChecker.validateActionName("@"); fail(); } catch (IllegalArgumentException ex) { } }
@Test public void testValidateActionName() { String actionName = "actionName"; ParamChecker.validateActionName(actionName); actionName = "actionName01"; ParamChecker.validateActionName(actionName); actionName = "actionName01_02"; ParamChecker.validateActionName(actionName); actionName = "actionName01_02-test"; ParamChecker.validateActionName(actionName); StringBuilder sb = new StringBuilder(); sb.append("a"); for (int i = 0; i < 127; i++) { sb.append(i % 10); } ParamChecker.validateActionName(sb.toString()); try { actionName = "1actionName"; ParamChecker.validateActionName(actionName); fail(); } catch (IllegalArgumentException ex) { } try { actionName = "-actionName"; ParamChecker.validateActionName(actionName); fail(); } catch (IllegalArgumentException ex) { } try { sb.setLength(0); sb.append("ab"); for (int i = 0; i < 128; i++) { sb.append(i); } ParamChecker.validateActionName(sb.toString()); fail(); } catch (IllegalArgumentException ex) { } }