From 2f4492ee18f90274582fcc2bb06f5e9bf64136e8 Mon Sep 17 00:00:00 2001
From: buli <137736985@qq.com>
Date: 星期五, 13 五月 2022 17:32:14 +0800
Subject: [PATCH] ProdBackup0513
---
force-app/main/default/classes/AWSServiceToolTest.cls | 48 ++++++++++++++++++++++++++++++++++++++++++++++++
1 files changed, 48 insertions(+), 0 deletions(-)
diff --git a/force-app/main/default/classes/AWSServiceToolTest.cls b/force-app/main/default/classes/AWSServiceToolTest.cls
index 81d5e73..10d8720 100644
--- a/force-app/main/default/classes/AWSServiceToolTest.cls
+++ b/force-app/main/default/classes/AWSServiceToolTest.cls
@@ -43,4 +43,52 @@
AWSServiceTool.getNoPIContact(searchContactName,accountId);
Test.stopTest();
}
+ @isTest
+ static void Test4(){
+ Test.setMock(HttpCalloutMock.class, new HttpMock());
+
+
+ Test.startTest();
+ AWSServiceTool.sendToPiAWS('String rowDataStr', 'String endpoint','String awsToken');
+ Test.stopTest();
+ }
+ class HttpMock implements HttpCalloutMock{
+
+ string rid = '';
+ public HttpMock(){
+ }
+ public HttpMock(string rid){
+ this.rid = rid;
+ }
+ public HTTPResponse respond(HTTPRequest request) {
+ // 鍒涘缓涓�涓亣鐨勫洖搴�
+ System.debug('------------------------------------------------------');
+ HttpResponse response = new HttpResponse();
+ string body = '';
+ system.debug(request.getEndpoint());
+ string url = request.getEndpoint();
+
+ if(url.contains('token')){
+ system.debug('url=token');
+ response.setHeader('Content-Type', 'application/json');
+ body='{ "message": "", "object": "freqfewqfewewfewfew", "status": "", "success": true, "timestamp": 0, "txId": "" }';
+ } else if(url.toLowerCase().contains('insert')){
+ system.debug('url=Insert');
+ response.setHeader('Content-Type', 'application/json');
+ body='{ "message": "", "object": [ { "dataId": "123456", "directShippmentAddress": "", "directShippmentAddressEncrypt": "", "isDelete": 0, "phoneNumber": "", "phoneNumberEncrypt": "", "sfRecordId": "'+rid+'" } ], "status": "", "success": true, "timestamp": 0, "txId": "" }';
+ } else if(url.toLowerCase().contains('update')){
+ system.debug('url=update');
+ response.setHeader('Content-Type', 'application/json');
+ body='{ "message": "", "object": [ { "dataId": "123456", "directShippmentAddress": "", "directShippmentAddressEncrypt": "", "isDelete": 0, "phoneNumber": "", "phoneNumberEncrypt": "", "sfRecordId": "'+rid+'" } ], "status": "", "success": true, "timestamp": 0, "txId": "" }';
+ } else{
+
+ }
+
+ response.setBody(body);
+ response.setStatus('OK');
+ response.setStatusCode(200);
+ return response;
+ // }
+ }
+ }
}
\ No newline at end of file
--
Gitblit v1.9.1