### Question:
ArrayExample { public static int sum(int[] array){ if(array == null){ return 0; } int sum = 0; for(int i=0; i< array.length; i++){ sum += array[i]; } return sum; }  static int sum(int[] array);  }### Answer:
@Test public void testBase(){ int[] array = {1, 2, 3}; int res = ArrayExample.sum(array); assertEquals(6, res); }
@Test public void testNegative(){ int[] array = new int[3]; array[0] = -2; array[1] = -1; int res = ArrayExample.sum(array); assertEquals(-3, res); }
@Test public void testLarge(){ int x = 1_000_000_000; int[] array = {x, x, x}; int res = ArrayExample.sum(array); assertTrue(res < 0); }