@isTest
public with sharing class NFM501HttpCallMock implements HttpCalloutMock {
	// 实现这个接口方法
	public 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 if(request.getEndpoint().contains('test/v1/info/page')){
			System.debug('++++++++++++++++++++++++++++++++++++++++++++++++++++++');
			HttpResponse response = new HttpResponse();
			response.setHeader('Content-Type', 'application/x-www-form-urlencoded');
			response.setBody('{"code":"0","data":{"cursorMark":"60d01dde42ec7ed48d3730d6","list1":[{"infoId":"227328190","infoPublishTime":"2021-06-21 09:41:26","infoQianlimaUrl":"http://www.qianlima.com/zb/detail/20210621_227328190.html","projectId":"38_99df2844cf784982acdc61d00d7a7dbb"}]},"msg":"正确返回数据"}');
			response.setStatus('OK');
			response.setStatusCode(0);
			// response.setStatusCode(200);
			return response;
		}else if(request.getEndpoint().contains('test/v1/info/detailHtml')){
			System.debug('======================================================');
			HttpResponse response = new HttpResponse();
			response.setHeader('Content-Type', 'application/x-www-form-urlencoded');
			response.setBody('{"code":"0","data":{"infoHtml":"<!DOCTYPE html><html>a</html>"},"msg":"正确返回数据"}');
			response.setStatus('OK');
			// Blob responseBody502 = Blob.valueOf(String.valueOf(response));
			// response.setBodyAsBlob(responseBody502);
			response.setStatusCode(0);
			return response;
		}else{
			HttpResponse response = new HttpResponse();
			response.setHeader('Content-Disposition','filename=文件大小超过12M');
			Blob responseBody503 = Blob.valueOf('Blob[497920]');
			response.setBodyAsBlob(responseBody503);
			response.setStatus('OK');
			response.setStatusCode(0);
			return response;
		}
	}
}