@isTest
global class NFM504HttpCallMock implements HttpCalloutMock {
    // 实现这个接口方法
    global HTTPResponse respond(HTTPRequest request) {
        // 创建一个假的回应
        if (request.getEndpoint().contains('test/v1/token') || request.getEndpoint().contains('v1/token')) {
            System.debug('------------------------------------------------------');
            HttpResponse response = new HttpResponse();
            response.setHeader('Content-Type', 'application/x-www-form-urlencoded');
            response.setBody('{"access_token":"eyJhbGciOiJIUzUxMiJ9.eyJhcHBLZXkiOiIwNzBmMDBiZi02NGYxLTQ3MjAtYThkOC1iYmUxYWE5NzZkMjIiLCJhcHBTZWNyZXQiOiI2N0JCMkJBRkM4QUEwQkEwQ0FCQjM3Q0JGNTBFQzI5MiIsImV4cCI6MTYyNDM1OTkzNH0.IXcAshOMZ08Y_ik7o-Iu4EmUy6o0pI9jz4xcx7orpxn6dTUV7wXVWqmdRl3Ded64Pq7OYKB5Vf_FQFUbgeyYjg","code":"0","msg":"正确返回数据"}');
            response.setStatus('OK');
            response.setStatusCode(0);
            // response.setStatusCode(200);
            return response;
        } else {
            // 创建一个假的回应
            HttpResponse response = new HttpResponse();
            response.setHeader('Content-Type', 'application/x-www-form-urlencoded');
            // response.setBody('{"code":0,"data":[{"SYSTEM_SOURCE_REF_NO":"a0J1000000LmVQU","ETQ_UPLOAD_STATUS":"200","ETQ_COMPLAINT_NUMBER":"111111"},{"SYSTEM_SOURCE_REF_NO":"a0J1000000LmVQU","ETQ_UPLOAD_STATUS":"200","ETQ_COMPLAINT_NUMBER":"222222"}],"msg":"执行成功"}');
            response.setBody('{"Monitoring":{"TransmissionDateTime":"202109031357","Text":"","Tag":"MSGH","Sender":"SFDC","Receiver":"SPO","NumberOfRecord":"2","MessageType":"NFM504","MessageGroupNumber":"60cb546642ec7ed48d3d2a41"},"GeData":[{"oldProjectId":"38_47ebde5f43524f86a7a4d517eb85c678","oldInfoId":"211367118","newProjectId":"1804343"}]}');

            response.setStatus('OK');
            response.setStatusCode(0);
            return response;
        }
    }
}