### Question:
QuickSort { public static List<Integer> sort(List<Integer> sourceDatas) { switch (sourceDatas.size()) { case 0: return new ArrayList<>(); case 1: return sourceDatas; default: int pivot = sourceDatas.get(0); List<Integer> smallerDatas = new ArrayList<>(), biggerDatas = new ArrayList<>(); for (int i = 1; i < sourceDatas.size(); i++) { if (pivot > sourceDatas.get(i)) { smallerDatas.add(sourceDatas.get(i)); smallerDatas = sort(smallerDatas); } else { biggerDatas.add(sourceDatas.get(i)); biggerDatas = sort(biggerDatas); } } smallerDatas.add(pivot); smallerDatas.addAll(biggerDatas); return smallerDatas; } }  static List<Integer> sort(List<Integer> sourceDatas); static void sort(int[] sourceDatas, int from, int to);  }### Answer:
@Test public void sort_When_Single_One() throws Exception { list = Collections.singletonList(1); QuickSort.sort(list); assertThat(QuickSort.sort(list), is(contains(1))); }
@Test public void sort_When_Two() throws Exception { list = Arrays.asList(3, 1); assertThat(QuickSort.sort(list), is(contains(1, 3))); }
@Test public void sort_When_Over_Two() throws Exception { list = Arrays.asList(3, 1, 4, 6, 10); assertThat(QuickSort.sort(list), is(contains(1, 3, 4, 6, 10))); }
@Test public void sort_When_Duplicated() throws Exception { list = Arrays.asList(3, 1, 3, 4, 6, 10); assertThat(QuickSort.sort(list), is(contains(1, 3, 3, 4, 6, 10))); }
@Test public void sort_Array_When_Single_One() throws Exception { int[] array = { 1 }; QuickSort.sort(array, 0, array.length - 1); assertThat(array, equalTo(new int[] { 1 })); }
@Test public void sort_Array_When_Two() throws Exception { int[] array = { 2, 1 }; QuickSort.sort(array, 0, array.length - 1); assertThat(array, equalTo(new int[] { 1, 2 })); }
@Test public void sort_Array_When_Over_Two() throws Exception { int[] array = { 3, 2, 4, 1 }; QuickSort.sort(array, 0, array.length - 1); assertThat(array, equalTo(new int[] { 1, 2, 3, 4 })); }
@Test public void sort_Array_When_Multi() throws Exception { int[] array = { 2, 1, 3, 2, 3, 2 }; QuickSort.sort(array, 0, array.length - 1); assertThat(array, equalTo(new int[] { 1, 2, 2, 2, 3, 3 })); }