高章伟
2022-03-10 1312ba82d4c880bdb5357d28e0d4af5b285f610f
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
@isTest
public class NFM705RestTest {
    static testMethod void testMothodOne(){
        BatchIF_Log__c testLog = new BatchIF_Log__c();
        testLog.CurrencyIsoCode = 'CNY';
        testLog.Type__c = 'NFM705';
        testLog.MessageGroupNumber__c = '123456789987';
        // testLog.Name = '20211207';
        testLog.ErrorLog__c = '';
        testLog.MessageGroupNumber__c = '20211207';
        testLog.RowDataFlg__c = true;
        testLog.Log__c = '[{"WorkshopPlace":"朝阳","StateMaster":"北京市","StartDate":"2022-03-25T00:00:00","SponsorshipCategory":"","SharedEditing":"om002080,om003696,om001646","ProcessState":110,"OfficeCategory":"GI(MEBG),ET(MEBG),","Num":"","Name":"自主主办活动-SFDC测试0310","MeetingType":"线上+线下","MeetingApprovedNo":"ME154P03-0004","IsPaidToSponsor":"N","IsCoOrganizingActivities":"Y","HostName":"","ExpectedOlympusAttendance":10,"ExpectedHcpAttendance":2,"EndDate":"2022-03-30T00:00:00","CooperatorCompany":"","ConveningParticipantsNum":12,"CityMaster":"北京市","BudgetType":"其他","Applicant":"om002021","ActivityTypeName":"自主主办活动"}]';
        //[Select Id, Name, Log__c, ErrorLog__c, Log2__c, Log3__c, Log4__c, Log5__c, Log6__c, Log7__c, Log8__c, Log9__c, Log10__c, Log11__c, Log12__c, MessageGroupNumber__c, retry_cnt__c,NFM624_Secondary_processing__c  from BatchIF_Log__c where RowDataFlg__c = true and Id =: rowData_Id]
        insert testLog;
        NFM705Rest.main(testLog.Id);
    }
 
    static testMethod void testMethodTwo() {
 
        Test.startTest();
        
        RestRequest req = new RestRequest();
        RestResponse res = new RestResponse();
 
        String JsonMsg = '{"Monitoring":{"TransmissionDateTime":"202107131529","Text":null,"Tag":null,"Sender":"OBPM","Receiver":"SFDC","NumberOfRecord":"2","MessageType":"NFM705","MessageGroupNumber":null},"GeData":[{"WorkshopPlace":"未来城","StateMaster":"贵州","StartDate":"20211215","SponsorshipCategory":"Y","ProcessState":110,"OfficeCategory":"1.消化科","Num":"MT-HB-202112-5773","Name":"Test会议","MeetingType":"主办会","MeetingApprovedNo":"TEST99793","IsPaidToSponsor":"白给","HostName":"黔西南州中医院","EndDate":"20211216","CooperatorCompany":"未来城","ConveningParticipantsNum":50,"CityMaster":"安顺","BudgetType":"新产品上市","ActivityTypeName":"嗯?乖乖站好?","ExpectedOlympusAttendance":50,"ExpectedHcpAttendance":100}]}';
        req.requestURI = 'services/apexrest/NFM705/execute';
        req.httpMethod = 'POST';
        req.requestBody = Blob.valueof(JsonMsg);
        RestContext.request = req;
        RestContext.response= res;
 
        NFM705Rest.doPost();
 
        Test.stopTest();
        
    }
}