Unit-Testing functions which have parameters of classes where source code is not accessible
- by McMannus
Relating to this question, I have another question regarding unit testing functions in the utility classes:
Assume you have function signatures like this:
public function void doSomething(InternalClass obj, InternalElement element)
where InternalClass and InternalElement are both Classes which source code are not available, because they are hidden in the API. Additionally, doSomething only operates on obj and element. I thought about mocking those classes away but this option is not possible due to the fact that they do not implement an interface at all which I could use for my Mocking classes.
However, I need to fill obj with defined data to test doSomething.
How can this problem be solved?