### Question:
ArrayAddition { public int[] addition(int[] a1, int[] a2) { int[] a3 = new int[a1.length + a2.length]; int a1Index = 0; int a2Index = 0; for (int a3Index = 0; a3Index < a3.length; a3Index++) { if (a1Index < a1.length && a2Index < a2.length) { if (a1[a1Index] <= a2[a2Index]) { a3[a3Index] = a1[a1Index]; a1Index++; } else { a3[a3Index] = a2[a2Index]; a2Index++; } } else if (a1Index < a1.length) { a3[a3Index] = a1[a1Index]; a1Index++; } else { a3[a3Index] = a2[a2Index]; a2Index++; } } return a3; }  int[] addition(int[] a1, int[] a2);  }### Answer:
@Test public void arrayAdditionIfArrayOneMoreThenArrayTwo() { int[] array1 = {1, 2, 50, 180, 290, 300, 1024}; int[] array2 = {54, 66, 75, 84}; int[] except = {1, 2, 50, 54, 66, 75, 84, 180, 290, 300, 1024}; ArrayAddition array = new ArrayAddition(); int[] result = array.addition(array1, array2); assertThat(result, is(except)); }
@Test public void arrayAdditionIfArrayTwoMoreThenArrayOne() { int[] array1 = {6, 100}; int[] array2 = {8, 45, 55, 250}; int[] except = {6, 8, 45, 55, 100, 250}; ArrayAddition array = new ArrayAddition(); int[] result = array.addition(array1, array2); assertThat(result, is(except)); }
@Test public void arrayAdditionIfArrayOneHaveAllZero() { int[] array1 = {0, 0, 0, 0}; int[] array2 = {1, 4, 6}; int[] except = {0, 0, 0, 0, 1, 4, 6}; ArrayAddition array = new ArrayAddition(); int[] result = array.addition(array1, array2); assertThat(result, is(except)); }