Hi, in one of my assignments I was asked to create unit test for a method, lets call it 'unique'. 'unique' returns an list of integers only with the unique values. To do this, 'unique' calls another method, 'sort', that return a sorted list and then processes the unique values. To do that, I first created a interface called 'sorted', that had the definition of a 'sorted' method. Instead of implement 'sorted' I used the already implemented 'sort'.
To process the test of a call to 'unique' a follow the steps:
1-> Created an object of the class that contain 'unique';
2->Created an object of a stub class that implemented the interface 'sorted' (The stub returns the sorted array for a specific input);
3-> Called the 'unique' method giving the list returned by the stub;
4-> Used the asserts.
My question is, because 'sorted' was implemented using one of the methods that might be wrong, should I create a class and define the 'sorted' or keep the interface?