Testing
To test our Apex callouts, we need to generate a mock response for the callout that our code can then handle and validate is processed appropriately. To do this, Salesforce provides the HttpCalloutMock interface, which has a single method to implement, respond, and provides a HttpResponse instance back to the code.
In the following code, I have written a simple class that takes in a string on the constructor to be returned as the response body within our test class:
public with sharing class PostmanEchoCalloutMock implements
    HttpCalloutMock {
    private String response;
    public PostmanEchoCalloutMock(String response) {
        this.response = response;
    }
    public HTTPResponse respond(HTTPRequest req) {
        HttpResponse res = new HttpResponse();
     ...