@Test public void testReverse() { int[] a = new int[] {1, 3, 5, -3, 6, 7}; int[] toReverse = Arrays.copyOf(a, a.length); RotateString.reverse(toReverse, 0, toReverse.length - 1); assertEquals(a.length, toReverse.length); for (int i = 0; i < a.length; i++) { assertEquals(a[i], toReverse[toReverse.length - 1 - i]); } }
@Test(expected = IllegalArgumentException.class) public void testReverseInExceptionForRightArgument() { int[] a = new int[] {1, 2}; RotateString.reverse(a, 0, 3); }