I have a method that sorts an array of numbers in ascending order and I want to test this method. I created two unit tests, one that loops through all the elements and asserts that the current element is less than the one coming after, and another method that asserts that the sorted array has the same elements as another sorted array I create myself.
Is there any other way to test this method or those two are fine?
I am working with java
I would also add tests to cover the desired behaviour when:
However, unless you have a good reason, you should probably be using the built-in Arrays.sort() rather than implementing your own sort.