So, I already know the SFDC proscribed route for testing callouts.
The code I'm testing is rather more sophisticated than SFDC's example. Instead of returning a String, I'm returning a data transfer object (DTO), so to build a response for the mock, my code is like this:
ResponseDTO dto = new ResponseDTO(); dto.accountList = TestAccountFactory.createList(5); response.put('response_x', dto);
However, going this route, it is easily observed I am never dealing with the actual XML being returned by the server.
I have been instructed to test how the system handles a specific message back from the server. For argument's sake, let's say:
<abc:response someAttrib="123"> <def:someValue anotherAttrib="456">Blah blah blah</def:someValue> </abc:response someAttrib="123">
I don't want to deserialize this in my mock since then I'm testing the mock or my testing framework and not the system itself.
Is it possible to develop a test which will allow me to mock the server's response instead of the handled server response?
If so, how?
Also, what arguments, either for or against, might be offered against the proposition that such a test is more of a test of SFDC than our project?