### Question:
ThreeArraysInAscendingOrder { public static int getMinimumSum(int[] a, int[] b, int[] c) { if ((a == null) || (a.length == 0)) { throw new IllegalArgumentException("First array is null or empty"); } if ((b == null) || (b.length == 0)) { throw new IllegalArgumentException("Second array is null or empty"); } if ((c == null) || (c.length == 0)) { throw new IllegalArgumentException("Third array is null or empty"); } int sum = Integer.MAX_VALUE; int i = 0; int j = 0; int k = 0; while ((i < a.length) && (j < b.length) && (k < c.length)) { int s = Math.abs(a[i] - b[j]) + Math.abs(b[j] - c[k]) + Math.abs(c[k] - a[i]); if (s < sum) { sum = s; } if ((a[i] <= b[j]) && (a[i] <= c[k])) { i++; } else if ((b[j] <= a[i]) && (b[j] <= c[k])) { j++; } else if ((c[k] <= a[i]) && (c[k] <= b[j])) { k++; } } return sum; }  static int getMinimumSum(int[] a, int[] b, int[] c);  }### Answer:
@Test(expected = IllegalArgumentException.class) public void testGetMinimumSumFirstArrayIsNull() { getMinimumSum(null, new int[] { 1 }, new int[] { 2 }); }
@Test(expected = IllegalArgumentException.class) public void testGetMinimumSumFirstArrayIsEmpty() { getMinimumSum(new int[0], new int[] { 1 }, new int[] { 2 }); }
@Test(expected = IllegalArgumentException.class) public void testGetMinimumSumSecondArrayIsNull() { getMinimumSum(new int[] { 1 }, null, new int[] { 2 }); }
@Test(expected = IllegalArgumentException.class) public void testGetMinimumSumSecondArrayIsEmpty() { getMinimumSum(new int[] { 1 }, new int[0], new int[] { 2 }); }
@Test(expected = IllegalArgumentException.class) public void testGetMinimumSumThirdArrayIsNull() { getMinimumSum(new int[] { 1 }, new int[] { 2 }, null); }
@Test(expected = IllegalArgumentException.class) public void testGetMinimumSumThirdArrayIsEmpty() { getMinimumSum(new int[] { 1 }, new int[] { 2 }, new int[0]); }
@Test public void testGetMinimumSum1() { int[] first = new int[] { 1, 2, 5 }; int[] second = new int[] { 0, 2, 7 }; int[] third = new int[] { 1, 3, 5 }; assertThat(getMinimumSum(first, second, third), is(2)); }
@Test public void testGetMinimumSum2() { int[] first = new int[] { 1, 2, 5 }; int[] second = new int[] { 0, 2, 7 }; int[] third = new int[] { -3, -1, 0 }; assertThat(getMinimumSum(first, second, third), is(2)); }
@Test public void testGetMinimumSum3() { int[] first = new int[] { 1, 2, 5, 6, 7 }; int[] second = new int[] { 0, 2, 7 }; int[] third = new int[] { -3, -1, 7 }; assertThat(getMinimumSum(first, second, third), is(0)); }
@Test public void testGetMinimumSum4() { int[] first = new int[] { 1, 2, 5, 6, 7 }; int[] second = new int[] { 0, 2 }; int[] third = new int[] { -3, -1, 7 }; assertThat(getMinimumSum(first, second, third), is(4)); }