When we are writing test class for integration parsing class, The easiest way to for code coverage and validate is uploading sample response in static resource and retrieve in test class. Here is code snippet.
1. Create static resource upload text file containing response
StaticResource r = [SELECT Body FROM StaticResource WHERE Name = 'Static_ResourceName'];
String jsonString = r.Body.toString();
Apexclass obj = Apexclass .parse(jsonString);
No comments:
Post a Comment