Intro
We want to mock this method
List<Integer> getList() {
return new MyListImpl();
}
The most ideal target would be subclassing MyListImpl.
This might not be possible if MyListImpl is final. What is our next choice?
Previously, we did a DFS on MyListImpl, on the inheritance graph from MyListImpl to List, and use the closest class on the path to List.
But we can actually make a new class that implements every parent class of MyListImpl. This will have better robustness to class casting.
Intro
We want to mock this method
The most ideal target would be subclassing MyListImpl.
This might not be possible if MyListImpl is final. What is our next choice?
Previously, we did a DFS on MyListImpl, on the inheritance graph from MyListImpl to List, and use the closest class on the path to List.
But we can actually make a new class that implements every parent class of MyListImpl. This will have better robustness to class casting.