Skip to Content
1
Aug 26, 2020 at 12:42 PM

Automated Unit testing: Mock a private method

453 Views

Hello all,

I am using Automated Unit testing a lot. All methods i create are now supported by those unit tests.

At the moment i am struggling if it is possible to MOCK a private method. What i want to achieve is that i can simply say that the outcome of a private method must have THAT value. Of course i can achieve this by programming it, but that means a lot of coding which is kind of redundant if you could simply say, outcome of private method is this.

For public methods used within the method i am able to achieve this by using a self reference which is a testdouble.

I hope my question is clear and that there is a solution for this. it would safe me a lot of coding.

Kind regards,

Peter van Alphen