StringHelper { public static String[] mergeArray(String[] a, String[] b) { if (a == null) { return b; } if (b == null) { return a; } String[] newArray = new String[a.length + b.length]; System.arraycopy(a, 0, newArray, 0, a.length); System.arraycopy(b, 0, newArray, a.length, b.length); return newArray; }  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 mergeArray() throws UnsupportedEncodingException { String[] array1 = new String[]{"test1"}; String[] array2 = new String[]{"test2"}; Assert.assertArrayEquals(array1, StringHelper.mergeArray(array1, null)); Assert.assertArrayEquals(array1, StringHelper.mergeArray(null, array1)); Assert.assertNull(StringHelper.mergeArray(null, null)); Assert.assertArrayEquals(new String[]{"test1", "test2"}, StringHelper.mergeArray(array1, array2)); }