StringHelper { public static boolean isEmpty(String s) { return s == null || s.trim().length() == 0; }  static String appendSlant(String url); static byte[] getBytes(String s); static String getString(byte[] bytes); static String[] mergeArray(String[] a, String[] b); static String[] emptyArray(); static String emptyString(); static boolean isEmpty(String s); static boolean isEmpty(String[] s); static String[] checkEmpty(String[] s); static String isEmpty(String value, String defaultValue); static String[] split(String s); static List<String> splitToList(String s);  }
@Test public void isEmpty() throws UnsupportedEncodingException { Assert.assertTrue(StringHelper.isEmpty((String)null)); Assert.assertTrue(StringHelper.isEmpty(StringHelper.emptyString())); Assert.assertFalse(StringHelper.isEmpty("1")); Assert.assertTrue(StringHelper.isEmpty((String[])null)); Assert.assertTrue(StringHelper.isEmpty(StringHelper.emptyArray())); Assert.assertFalse(StringHelper.isEmpty(new String[]{"1"})); Assert.assertEquals("1", StringHelper.isEmpty(null, "1")); Assert.assertEquals("1", StringHelper.isEmpty(StringHelper.emptyString(), "1")); Assert.assertEquals("2", StringHelper.isEmpty("2", "1")); }