I've already explained this. The way you're passing the mock object through to your HtmlParser, you are copying it into an object of the base class.
HtmlParser:m_http is NOT going to be a HttpFetchMock, it will just be a HttpFetch.
Do you understand how polymorphism works in C++? Do you understand that it is something that applies to pointers and references?
I've already told you how to fix it:
Presumably, what you want is for m_http to be a reference to the object being passed in, so that polymorphism can be used to ensure the mock methods are called. |
EDIT:OK, wait, I've just looked again, and as well as all of the above, there's a more obvious problem:
Nowhere in any of the code you've posted, is there anything that calls
getUrlAsString(). You tell the mock to expect that method to be called once, but it never is.