Timeline for Testing a REST Service POST method question
Current License: CC BY-SA 3.0
5 events
when toggle format | what | by | license | comment | |
---|---|---|---|---|---|
Sep 28, 2017 at 22:47 | vote | accept | VeMan | ||
Sep 26, 2017 at 13:20 | comment | added | sfdcfox♦ | @VeMan You'd end up calling JSON.deserialize. If you wanted to pretend it was a real callout, you'd write an HttpCalloutMock that would call JSON.deserialize and then call your method. In other words, you would still be constructing your own data. If you wanted to use your JSON string, though, you could deserialize it yourself with JSON.deserialize. It doesn't matter how the UserData gets constructed, in the end, but you will be calling your code as a static method no matter how you get there. | |
Sep 26, 2017 at 7:25 | comment | added | VeMan | Thanks for your response!! So, as far as testing, I created a JSON string in the test, which I blobbed into the RestRequest body. I see that I could just create my own Userdata class instance with the values and run the method, but is there some way to test from the RestRequest to see the backend process deserialize the request body? | |
Sep 26, 2017 at 3:23 | history | edited | sfdcfox♦ | CC BY-SA 3.0 |
added 2 characters in body
|
Sep 26, 2017 at 1:24 | history | answered | sfdcfox♦ | CC BY-SA 3.0 |