### Question:
BubbleSort { public int[] sort(int[] sorted) { for (int sortArea = sorted.length; sortArea != 0; sortArea--) { for (int i = 0; i < sortArea - 1; i++) { if (sorted[i] > sorted[i + 1]) { int oldArray = sorted[i]; sorted[i] = sorted[i + 1]; sorted[i + 1] = oldArray; } } } return sorted; }  int[] sort(int[] sorted);  }### Answer:
@Test public void whenSortArrayWithTenElementsThenSortedArray() { BubbleSort bubble = new BubbleSort(); int[] array = {1, 5, 4, 2, 3, 1, 7, 8, 0, 5}; int[] result = bubble.sort(array); int[] expect = {0, 1, 1, 2, 3, 4, 5, 5, 7, 8}; assertThat(result, is(expect)); }