@Test public void testSort() { String[] arr = {4, 5, 3}; String[] expected = {3, 4, 5}; sort(arr); // or whatever your sort method call it like assertArrayEquals(expected, arr); }
1. Set up an array. 2. Set up another array with the expected result. 3. Call swap on the first array 4. use an assertArrayEquals call.