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
KapavariVenkatramanaKapavariVenkatramana 

Solution to Trail Head Use Mocks and Stub Objects

Solution to Use Mocks and Stub Objects


YOUR CHALLENGE
Write tests using mocks and stubs
Not every call to a third party service succeeds. So, we need to test both success and failure responses. Write a unit test to cover the ExternalSearch classes’ handling of response codes higher than 200.
Add a unit test method to ExternalSearch_tests.cls that uses the HTTPMockFactory class to return a 500 response
Make sure you have 100% code coverage on the ExternalSearch class