### Question:
FrogJumping { public static int findShortestWay(int[] array) { if (array == null || array.length == 0) { throw new IllegalArgumentException("Input array is null or empty"); } int[] jumping = new int[array.length - 1]; for (int i = jumping.length - 1; i >= 0; i--) { if (array[i] < 0) { throw new IllegalArgumentException("Element #" + i + " is negative: " + array[i]); } if (i + array[i] >= jumping.length) { jumping[i] = 1; continue; } jumping[i] = MAX_VALUE; if (array[i] == 0) { continue; } for (int j = 1; j <= array[i] && i + j < jumping.length; j++) { if (jumping[i + j] != MAX_VALUE) { jumping[i] = min(1 + jumping[i + j], jumping[i]); } } } return jumping[0] == MAX_VALUE ? -1 : jumping[0]; }  static int findShortestWay(int[] array);  }### Answer:
@Test(expected = IllegalArgumentException.class) public void testFindShortestWayInputArrayIsNull() { findShortestWay(null); }
@Test(expected = IllegalArgumentException.class) public void testFindShortestWayInputArrayIsEmpty() { findShortestWay(new int[0]); }
@Test(expected = IllegalArgumentException.class) public void testFindShortestWayInputArrayWithNegativeElements() { findShortestWay(new int[]{1, 2, 3, 2, 9, -1, 5, 7}); }
@Test public void testFindShortestWay1() { assertThat(findShortestWay(new int[]{1, 5, 4, 6, 9, 3, 0, 0, 1, 3}), is(3)); }
@Test public void testFindShortestWay2() { assertThat(findShortestWay(new int[]{1, 5, 4, 6, 9, 3, 0, 0, 0, 0}), is(3)); }
@Test public void testFindShortestWay3() { assertThat(findShortestWay(new int[]{1, 5, 4, 6, 5, 3, 0, 0, 0, 0}), is(3)); }
@Test public void testFindShortestWay4() { assertThat(findShortestWay(new int[]{0, 5, 4, 6, 9, 3, 0, 0, 1, 3}), is(-1)); }
@Test public void testFindShortestWay5() { assertThat(findShortestWay(new int[]{1, 0, 4, 6, 9, 3, 0, 0, 1, 3}), is(-1)); }
@Test public void testFindShortestWay6() { assertThat(findShortestWay(new int[]{2, 7, 3, 6, 9, 3, 0, 0, 1, 3}), is(3)); }
@Test public void testFindShortestWay7() { assertThat(findShortestWay(new int[]{2, 8, 3, 6, 9, 3, 0, 0, 1, 3}), is(2)); }
@Test public void testFindShortestWay8() { assertThat(findShortestWay(new int[]{2, 7, 7, 6, 9, 3, 0, 0, 1, 3}), is(2)); }