CommonUtil { public static <T> boolean isNotEmpty(final T[] paramTypes) { return !ArrayUtils.isEmpty(paramTypes); }  static String messageFormat(final String message, final Object... params); static String getTransactionID(); static String getRandomCode(); static String getRandomNumber(final int size); static String getRandomChar(final int size); static String getString(final Object obj); static String notNullStr(final String str); static Date getDate(final Long time); static Integer[] splitId(final String idStr, final String splitor); static Long[] splitIdsByLong(final String idStr, final String splitor); static Integer[] splitId(final String idStr); static boolean wildcardMatch(final Collection<String> rules, final String matchValue); static boolean wildcardMatch(final String rule, final String matchValue); static boolean match(final String rule, final String matchValue); static String removeAllSymbol(final String str); static String replaceAllBlank(final String str); static String replaceRedundantBlank(final String str); static boolean isNotEmpty(final T[] paramTypes); static boolean isEmpty(final T[] paramTypes);  }
@Test public void isNotEmpty() { String str = "hello world"; Assert.isTrue(StringUtils.isNotEmpty(str), ErrorCodeDef.SYSTEM_ERROR_10001); System.out.println("str 不是空字符串"); List<String> strList = new ArrayList<>(); strList.add(str); Assert.isTrue(CollectionUtils.isNotEmpty(strList), ErrorCodeDef.SYSTEM_ERROR_10001); System.out.println("strList 不是空集合"); String[] strs = new String[] { str }; Assert.isTrue(CommonUtil.isNotEmpty(strs), ErrorCodeDef.SYSTEM_ERROR_10001); System.out.println("strs 不是空数组"); Map<String, String> strMap = new HashMap<>(); strMap.put("a", str); Assert.isTrue(MapUtils.isNotEmpty(strMap), ErrorCodeDef.SYSTEM_ERROR_10001); System.out.println("strMap 不是空Map"); }