'Is a (unit) test that mocks the result of a method call really valid?
I created a test method for a controller, but I am not sure if the test is really valid.
Inside the controller there's a method call that returns an object which one of the properties is a XML string.
I want to test if that XML contains a specific tag and so I created a text file with that xml and mocked the method call setting as result the xml read from the text file then I assert that the wanted tag is there.
So my question is, if the real method call changes and stop returning the correct XML with the tags I want, will my test fail or keep passing?
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|
