Test apex rest class Callouts using StaticResourceCalloutMock
Everybody googles about covering the rest callouts and ends up using almost one solution, i.e., creating a Mockup service class and use it in the test class. But there is an easy way and its been out there for quite sometime. It is really so simple that you can end up writing the test class in less than a minute, you need to have the response JSON of the callout that you are making in your actual class. You will have to catch that from either system.debug(res.getBody()) or get it from the other system. That would look something like this: {"status":"OK","message":"Search request completed successfully","result":{"appId":110,"requestId":225877959,"resultCount":9,"pageInfo":{"pageSize":10,"requestedPage":2,"totalPages":2,"totalResults":19},"nextPage":false,"sourceItemIds":"1101-1110-1111"}} 1. Catch that response in a text...