MoveElementsToPositions { public void move(int[] array) { validateInput(array); int size = array.length; boolean swap = true; while (swap) { swap = false; for (int i = 0; i < size - 1; i++) { if (array[i] > array[i + 1]) { swap = true; swapElements(array, i, i + 1); } } } }  void move(int[] array);  }
@Test(expected = IllegalArgumentException.class) public void shouldNotAcceptNullArraysAsInput() { moveElementsToPosition.move(null); }
@Test(expected = IllegalArgumentException.class) public void shouldNotAcceptAnyNumberGreaterThanArrayLengthOrMinorThanOne() { int[] input = { 1, 4 }; moveElementsToPosition.move(input); }
@Test public void shouldMoveElementsToTheCorrectPosition() { int[] input = { 2, 3, 1, 0 }; moveElementsToPosition.move(input); assertNumbersAreInTheCorrectPosition(input); }