lundi 19 décembre 2016

How to test a class with a very complex constructor?

I have inherited some code which has some very complicated initialization in the constructor that depends on a very complex environment.

I only want to be able to test some functionality therefore just need an empty object, for example one which would have been generated by the default constructor, however the default constructor has been overwritten by some very complex stuff.

I do not have the ability to touch the source code therefore I just need the empty object to be able to call it's functions and test with.

How would I do this? I've looked at mocking but I can't seem to get the actual functionality of the class into the mock object.

Aucun commentaire:

Enregistrer un commentaire