### Question:
CollectionFactory extends ConcurrentCollectionFactory { public static <T> T[] arrayMerge(T[]... arrays) { Class objectClass = null; int count = 0; for(T[] array: arrays) { if(array != null) { count +=array.length; if(array.length > 0) objectClass = array[0].getClass(); } } if(objectClass == null) return null; List<T> mergedList = new ArrayList<T>(); for(T[] array: arrays) if(array != null) mergedList.addAll(Arrays.asList(array)); return mergedList.toArray((T[])Array.newInstance(objectClass, count)); } private  CollectionFactory(); static HashMap<T, K> createHashMap(); static Set<T> copySet(Set<T> source); static Set<T> copyListToSet(List<T> source); static List<T> copySetToList(Set<T> source); static ImmutableList<T> copyListToImmutableList(List<T> source); static T[] arrayMerge(T[]... arrays);  }### Answer:
@Test public void testArrayMergeSuccess() { Integer[] arr1 = new Integer[] { 1, 2 }; Integer[] arr2 = new Integer[] { 3, 4, 5 }; verifyResult(new Integer[] { 1, 2, 3, 4, 5 }, CollectionFactory.arrayMerge(arr1, arr2)); }
@Test public void testArrayMergeEmpty() { Integer[] arr1 = new Integer[] {}; Integer[] arr2 = new Integer[] { 3, 4, 5 }; verifyResult(new Integer[] { 3, 4, 5 }, CollectionFactory.arrayMerge(arr1, arr2)); }
@Test public void testArrayMergeEmptyBoth() { Integer[] arr1 = new Integer[] {}; Integer[] arr2 = new Integer[] {}; Assert.assertNull(CollectionFactory.arrayMerge(arr1, arr2)); }
@Test public void testArrayMergeNull() { Integer[] arr1 = null; Integer[] arr2 = new Integer[] { 3, 4, 5 }; verifyResult(new Integer[] { 3, 4, 5 }, CollectionFactory.arrayMerge(arr1, arr2)); }
@Test public void testArrayMergeNullBoth() { Integer[] arr1 = null; Integer[] arr2 = null; Assert.assertNull(CollectionFactory.arrayMerge(arr1, arr2)); }