mardi 31 mars 2015

How to convert integration tests to unit tests

I've been tasked with changing someone else's integration tests into unit tests. We have business objects that talk to the database. And so our tests currently reflect that. The problem is that I have code that calls the db directly within the method - and I want it to hit mock data instead of the db. How do you do that?



List<listOfStuff> listing = getDataFromDB(DBStuff); //this is what I want to
//not happen in my test.


I can't change the method, and I read something about wrapping the method in an interface, but I'm unsure of how do that...


Aucun commentaire:

Enregistrer un commentaire