function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
Shikha RahejaShikha Raheja 

Not able to make second mock callout

Hi. I have a test class that makes a mock REST API callout . Now,I need to make another callout in test class and the response body would be response received from first mock callout. The first callout is made and correct response is returned . However,I am unable to use the response returned as body for another mock callout. This comes out to be null. How can I accomplish this? Has anyone encountered a scenario like this.
sravan velamasravan velama
Hi Shikha,

Are you saying that you are using same mock class in differrent method and you are  getting the response as Null.
(OR)
In the same test method you are calling two callouts and one mock class is used

For thid scenario : Try to call  one callout on one  test method and use same mock class and issue will be resolved.

If any of my assumed scenarios are not matched with your scenario. Post your whole scenario clearly with a code snippet.
It will be helpful for me to understand