高章伟
2022-02-18 8b5f4c6c281cfa548f92de52c8021e37aa81901e
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
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
@isTest
private class NFM104RestTest {
    
 
    public static Integer count = 0;
 
    // 使用testSetup定义初始化函数
    @testSetup 
    static void setup() {
      //   StaticParameter.EventOpportunityPileUpExeFlg = true;
      // // EventC⇒Event処理後、逆更新をスルー用
      // StaticParameter.NotUpdEventCFlg = true;
      // // 積み上げ処理後、トリガをスルー用
      // StaticParameter.EscapeNFM001Trigger = true;
      // 
      // StaticParameter.EscapeNFM001AgencyContractTrigger = true;
      // StaticParameter.EscapeNFM001AgencyContractTrigger2 = true;
      // StaticParameter.EscapeNFM007Trigger = true;
      // StaticParameter.EscapeOpportunityBefUpdTrigger = true;
      // StaticParameter.EscapeOpportunityHpDeptUpdTrigger = true;
      // StaticParameter.EscapeSyncOpportunityTrigger = true;
      // StaticParameter.EscapeMaintenanceContractAfterUpdateTrigger = true;
      // StaticParameter.EscapeSyncProduct2Trigger = true;
      // // trueのとき、リードのトリガーをスルーする
      // StaticParameter.EscapeLeadTrigger = true;
      // StaticParameter.EscapeAccountTrigger = true;
 
      // StaticParameter.EscapeConsumableOrderDetail2Trigger = true;
 
      // StaticParameter.EscapeNFM010UpsertStatuAchievementsTrigger = true;
      // // 直销耗材不直销 ConsumableAssetHander
      // StaticParameter.ConsumableAssetHanderTrigger = true;
 
      // // 跳过不涉及备品借出的逻辑
      // StaticParameter.rentalApplyIsRunning = true;
 
      // // accountdailyUpdate 跳过 更新询价
      // StaticParameter.EscapeOpportunityownerUpdate  = true;
 
        
        List<RecordType> rects   = [select Id, Name from RecordType where IsActive = true and SobjectType = 'Account'];
        List<RecordType> rectCo  = new List<RecordType>();
        List<RecordType> rectSct = new List<RecordType>();
        List<RecordType> rectDpt = new List<RecordType>();
        List<RecordType> rectAg  = new List<RecordType>();
        for(RecordType rect : rects){
            if('病院'.equals(rect.Name)){
                rectCo.add(rect);
            }
            if('戦略科室分類 消化科'.equals(rect.Name)){
                rectSct.add(rect);
            }
            if('診療科 消化科'.equals(rect.Name)){
                rectDpt.add(rect);
            }
            if('販売店'.equals(rect.Name)){
                rectAg.add(rect);
            }
        }
        if (rectCo.size() == 0) {
            return;
        }
        if (rectSct.size() == 0) {
            return;
        }
        if (rectDpt.size() == 0) {
            return;
        }
       if (rectAg.size() == 0) {
            return;
        }        
        // テストデータ
        Account company = new Account();
        company.RecordTypeId = rectCo[0].Id;
        company.Name         = 'NFM104TestCompany';
        upsert company;
 
        Account section = new Account();
        // section.RecordTypeId = rectSct[0].Id;
        // section.Name         = 'NFM104TestSection';
        // section.ParentId     = company.Id;
        // upsert section;
        list<Account> sections = [Select Management_Code__c, Management_Code_Auto__c, Name, Id from Account where ParentId = :company.Id and RecordTypeId = :rectSct[0].Id];
        section = sections[0];
        
        Account depart = new Account();
        depart.RecordTypeId        = rectDpt[0].Id;
        depart.Name                = '*';
        depart.Department_Name__c  = 'NFM104TestDepart';
        depart.ParentId            = section.Id;
        depart.Department_Class__c = section.Id;
        depart.Hospital__c         = company.Id;
        upsert depart;
        Account agency1 = new Account(name='Testhosp001',AgentCode_Ext__c = '0000021598', Dealer_discount__c =10,RecordTypeId = rectCo[0].Id);
        upsert agency1;
        // 再取得
        List<Account> accList = new List<Account>();
        company = [select Management_Code__c, Management_Code_Auto__c, Name, Id from Account where Id = :company.Id];
        accList.add(company);
        accList.add(section);
        depart = [select Management_Code__c, Management_Code_Auto__c, Name, Id from Account where Id = :depart.Id];
        accList.add(depart);
 
        List<Product2> prdList = new List<Product2>();
        Product2 prd1 = new Product2();
        prd1.ProductCode_Ext__c     = 'NFM104Prd1';
        prd1.ProductCode            = 'NFM104Prd1';
        prd1.Repair_Product_Code__c = 'NFM104Prd1_RP';
        prd1.Name                   = 'NFM104Prd1';
        prd1.Manual_Entry__c        = false;
        prdList.add(prd1);
        Product2 prd2 = new Product2();
        prd2.ProductCode_Ext__c     = 'NFM104Prd2';
        prd2.ProductCode            = 'NFM104Prd2';
        prd2.Repair_Product_Code__c = 'NFM104Prd2_RP';
        prd2.Name                   = 'NFM104Prd2';
        prd2.Manual_Entry__c        = false;
        prdList.add(prd2);
        insert prdList;
        System.Test.startTest();
        Asset ast = new Asset();
        ast.Name                             = 'NFM104Ast1';
        ast.AccountId                        = depart.Id;
        ast.Department_Class__c              = section.Id;
        ast.Hospital__c                      = company.Id;
        ast.Product2Id                       = prd1.Id;
        ast.SerialNumber                     = 'NFM104SerialNumber';
        ast.Guarantee_period_for_products__c = Date.today();
        ast.InstallDate                      = Date.today();
        insert ast;
        /*ast = [select Id, Name, Product_Serial_No__c, AccountId, Department_Class__c, Department_Class__r.Management_Code_Auto__c, Hospital__c, Product2Id, Product2.ProductCode, Product2.Repair_Product_Code__c, SerialNumber
                                 from Asset
                                where Id = :ast.Id];
        */
        Repair__c rpr = new Repair__c();
        rpr.SAPRepairNo__c         = 'NFM104Rpr1';
        rpr.Account__c             = depart.Id;
        rpr.Department_Class__c    = section.Id;
        rpr.Hospital__c            = company.Id;
        rpr.Delivered_Product__c   = ast.Id;
        rpr.SalesOfficeCode_selection__c = '北京';
        // rpr.Status__c              = '1.受理完毕';
        rpr.Status__c              = '草案中';
        rpr.Incharge_Staff__c = Userinfo.getUserId();
        rpr.Repair_Detail__c = 'test';
        insert rpr;
 
        System.Test.stopTest();   
    }
 
    static testMethod void testNFM104() {
        StaticParameter.EventOpportunityPileUpExeFlg = true;
      // EventC⇒Event処理後、逆更新をスルー用
      StaticParameter.NotUpdEventCFlg = true;
      // 積み上げ処理後、トリガをスルー用
      StaticParameter.EscapeNFM001Trigger = true;
      StaticParameter.EscapeNFM001AgencyContractTrigger = true;
      StaticParameter.EscapeNFM001AgencyContractTrigger2 = true;
      StaticParameter.EscapeNFM007Trigger = true;
      StaticParameter.EscapeOpportunityBefUpdTrigger = true;
      StaticParameter.EscapeOpportunityHpDeptUpdTrigger = true;
      StaticParameter.EscapeSyncOpportunityTrigger = true;
      StaticParameter.EscapeMaintenanceContractAfterUpdateTrigger = true;
      StaticParameter.EscapeSyncProduct2Trigger = true;
      // trueのとき、リードのトリガーをスルーする
      StaticParameter.EscapeLeadTrigger = true;
      StaticParameter.EscapeAccountTrigger = true;
 
      StaticParameter.EscapeConsumableOrderDetail2Trigger = true;
 
      StaticParameter.EscapeNFM010UpsertStatuAchievementsTrigger = true;
      // 直销耗材不直销 ConsumableAssetHander
      StaticParameter.ConsumableAssetHanderTrigger = true;
 
      // 跳过不涉及备品借出的逻辑
      StaticParameter.rentalApplyIsRunning = true;
 
      // accountdailyUpdate 跳过 更新询价
      StaticParameter.EscapeOpportunityownerUpdate  = true;
        Repair__c rpr = [select Id, Name, Account__c,Department_Class__c,
            Delivered_Product__c,Hospital__c,SalesOfficeCode_selection__c,
             SAPRepairNo__c,Status__c,Incharge_Staff__c,Repair_Detail__c 
             from Repair__c];
 
        Repair_Quotation__c rq = new Repair_Quotation__c();
        rq.Name                  = 'testNFM104';
        rq.Repair__c             = rpr.Id;
        rq.MessageGroupNumber__c = '1';
        insert rq;
        // そのままreturn
        System.Test.startTest();
        NFM104RestTest.testNFM104_void();
       
        
        //TODO insert
        NFM104RestTest.testNFM104_insert(rpr);
        //TODO upsert
        //NFM104WebServiceTest.testNFM104_upsert();
        System.Test.stopTest();
    }
 
    static testMethod void test_method_two() {
        StaticParameter.EventOpportunityPileUpExeFlg = true;
      // EventC⇒Event処理後、逆更新をスルー用
      StaticParameter.NotUpdEventCFlg = true;
      // 積み上げ処理後、トリガをスルー用
      StaticParameter.EscapeNFM001Trigger = true;
      StaticParameter.EscapeNFM001AgencyContractTrigger = true;
      StaticParameter.EscapeNFM001AgencyContractTrigger2 = true;
      StaticParameter.EscapeNFM007Trigger = true;
      StaticParameter.EscapeOpportunityBefUpdTrigger = true;
      StaticParameter.EscapeOpportunityHpDeptUpdTrigger = true;
      StaticParameter.EscapeSyncOpportunityTrigger = true;
      StaticParameter.EscapeMaintenanceContractAfterUpdateTrigger = true;
      StaticParameter.EscapeSyncProduct2Trigger = true;
      // trueのとき、リードのトリガーをスルーする
      StaticParameter.EscapeLeadTrigger = true;
      StaticParameter.EscapeAccountTrigger = true;
 
      StaticParameter.EscapeConsumableOrderDetail2Trigger = true;
 
      StaticParameter.EscapeNFM010UpsertStatuAchievementsTrigger = true;
      // 直销耗材不直销 ConsumableAssetHander
      StaticParameter.ConsumableAssetHanderTrigger = true;
 
      // 跳过不涉及备品借出的逻辑
      StaticParameter.rentalApplyIsRunning = true;
 
      // accountdailyUpdate 跳过 更新询价
      StaticParameter.EscapeOpportunityownerUpdate  = true;
        Test.startTest();
        
        RestRequest req = new RestRequest();
        RestResponse res = new RestResponse();
 
        String JsonMsg = '{"RepairQuotation": {"Monitoring":{"TransmissionDateTime":"201812201320","Text":"","Tag":"MSGH","Sender":"SFDC","Receiver":"SPO","NumberOfRecord":"1","MessageType":"NFM104","MessageGroupNumber":"20180001722190"},"QuotationHeaderInformation":null}}';
        req.requestURI = 'services/apexrest/NFM104/execute';
        req.httpMethod = 'POST';
        req.requestBody = Blob.valueof(JsonMsg);
        RestContext.request = req;
        RestContext.response= res;
 
        NFM104Rest.execute();
 
        Test.stopTest();
    }
 
    static void testNFM104_void() {
        StaticParameter.EventOpportunityPileUpExeFlg = true;
      // EventC⇒Event処理後、逆更新をスルー用
      StaticParameter.NotUpdEventCFlg = true;
      // 積み上げ処理後、トリガをスルー用
      StaticParameter.EscapeNFM001Trigger = true;
      StaticParameter.EscapeNFM001AgencyContractTrigger = true;
      StaticParameter.EscapeNFM001AgencyContractTrigger2 = true;
      StaticParameter.EscapeNFM007Trigger = true;
      StaticParameter.EscapeOpportunityBefUpdTrigger = true;
      StaticParameter.EscapeOpportunityHpDeptUpdTrigger = true;
      StaticParameter.EscapeSyncOpportunityTrigger = true;
      StaticParameter.EscapeMaintenanceContractAfterUpdateTrigger = true;
      StaticParameter.EscapeSyncProduct2Trigger = true;
      // trueのとき、リードのトリガーをスルーする
      StaticParameter.EscapeLeadTrigger = true;
      StaticParameter.EscapeAccountTrigger = true;
 
      StaticParameter.EscapeConsumableOrderDetail2Trigger = true;
 
      StaticParameter.EscapeNFM010UpsertStatuAchievementsTrigger = true;
      // 直销耗材不直销 ConsumableAssetHander
      StaticParameter.ConsumableAssetHanderTrigger = true;
 
      // 跳过不涉及备品借出的逻辑
      StaticParameter.rentalApplyIsRunning = true;
 
      // accountdailyUpdate 跳过 更新询价
      StaticParameter.EscapeOpportunityownerUpdate  = true;
        // null
        //NFM104Rest.NFM104(null);
        //NFM104Rest.execute();
        NFM104Rest.RepairQuotation RepairQuotation                         = new NFM104Rest.RepairQuotation();
        NFM104Rest.QuotationHeaderInformation QuotationHeaderInformation   = new NFM104Rest.QuotationHeaderInformation();
        NFM104Rest.DiscountInformation DiscountInformation                 = new NFM104Rest.DiscountInformation();
        NFM104Rest.InspectionResultInformation InspectionResultInformation = new NFM104Rest.InspectionResultInformation();
        NFM104Rest.FailureInformation FailureInformation                   = new NFM104Rest.FailureInformation();
        NFM104Rest.ActivityInformation ActivityInformation                 = new NFM104Rest.ActivityInformation();
 
        QuotationHeaderInformation.DiscountInformation         = new NFM104Rest.DiscountInformation[] { DiscountInformation };
        QuotationHeaderInformation.InspectionResultInformation = new NFM104Rest.InspectionResultInformation[] { InspectionResultInformation };
        QuotationHeaderInformation.FailureInformation          = new NFM104Rest.FailureInformation[] { FailureInformation };
        QuotationHeaderInformation.ActivityInformation         = new NFM104Rest.ActivityInformation[] { ActivityInformation };
        RepairQuotation.QuotationHeaderInformation             = new NFM104Rest.QuotationHeaderInformation[] { QuotationHeaderInformation };
 
        // Monitoringをセットしない
        //BatchIF_Log__c rowData1 = NFMUtil.saveRowData(RepairQuotation.Monitoring, 'NFM104', RepairQuotation.QuotationHeaderInformation);
        //NFM104Rest.executefuture(rowData1.Id);
 
        Datetime nowDT = Datetime.now();
        String nowStr  = nowDT.format('yyyyMMddHHmm');
        RepairQuotation.Monitoring = new NFMUtil.Monitoring();
        RepairQuotation.Monitoring.MessageGroupNumber = nowStr + count + '1';
        // 必須項目をセットしない
        BatchIF_Log__c rowData2 = NFMUtil.saveRowData(RepairQuotation.Monitoring, 'NFM104', RepairQuotation.QuotationHeaderInformation);
        NFM104Rest.main(rowData2.Id);
 
        // 商品コードが存在しない
        RepairQuotation.Monitoring.MessageGroupNumber = nowStr + count + '2';
        count++;
        QuotationHeaderInformation.SAPQuotationNo = 'NFM104X';
        BatchIF_Log__c rowData3 = NFMUtil.saveRowData(RepairQuotation.Monitoring, 'NFM104', RepairQuotation.QuotationHeaderInformation);
        NFM104Rest.main(rowData3.Id);
 
        Repair_Quotation__c[] rslts = [select Id from Repair_Quotation__c where Name = :QuotationHeaderInformation.SAPQuotationNo];
        System.assertEquals(0, rslts.size());
    }
 
    static void testNFM104_insert(Repair__c rpr) {
      StaticParameter.EventOpportunityPileUpExeFlg = true;
      // EventC⇒Event処理後、逆更新をスルー用
      StaticParameter.NotUpdEventCFlg = true;
      // 積み上げ処理後、トリガをスルー用
      StaticParameter.EscapeNFM001Trigger = true;
      StaticParameter.EscapeNFM001AgencyContractTrigger = true;
      StaticParameter.EscapeNFM001AgencyContractTrigger2 = true;
      StaticParameter.EscapeNFM007Trigger = true;
      StaticParameter.EscapeOpportunityBefUpdTrigger = true;
      StaticParameter.EscapeOpportunityHpDeptUpdTrigger = true;
      StaticParameter.EscapeSyncOpportunityTrigger = true;
      StaticParameter.EscapeMaintenanceContractAfterUpdateTrigger = true;
      StaticParameter.EscapeSyncProduct2Trigger = true;
      // trueのとき、リードのトリガーをスルーする
      StaticParameter.EscapeLeadTrigger = true;
      StaticParameter.EscapeAccountTrigger = true;
 
      StaticParameter.EscapeConsumableOrderDetail2Trigger = true;
 
      StaticParameter.EscapeNFM010UpsertStatuAchievementsTrigger = true;
      // 直销耗材不直销 ConsumableAssetHander
      StaticParameter.ConsumableAssetHanderTrigger = true;
 
      // 跳过不涉及备品借出的逻辑
      StaticParameter.rentalApplyIsRunning = true;
 
      // accountdailyUpdate 跳过 更新询价
      StaticParameter.EscapeOpportunityownerUpdate  = true;
        NFM104Rest.RepairQuotation RepairQuotation                         = new NFM104Rest.RepairQuotation();
        NFM104Rest.QuotationHeaderInformation QuotationHeaderInformation   = new NFM104Rest.QuotationHeaderInformation();
        NFM104Rest.DiscountInformation DiscountInformation                 = new NFM104Rest.DiscountInformation();
        NFM104Rest.InspectionResultInformation InspectionResultInformation = new NFM104Rest.InspectionResultInformation();
        NFM104Rest.FailureInformation FailureInformation                   = new NFM104Rest.FailureInformation();
        NFM104Rest.FailureInformation FailureInformation2                  = new NFM104Rest.FailureInformation();
        NFM104Rest.ActivityInformation ActivityInformation                 = new NFM104Rest.ActivityInformation();
 
        QuotationHeaderInformation.DiscountInformation         = new NFM104Rest.DiscountInformation[] { DiscountInformation };
        QuotationHeaderInformation.InspectionResultInformation = new NFM104Rest.InspectionResultInformation[] { InspectionResultInformation };
        QuotationHeaderInformation.FailureInformation          = new NFM104Rest.FailureInformation[] { FailureInformation };
        QuotationHeaderInformation.ActivityInformation         = new NFM104Rest.ActivityInformation[] { ActivityInformation };
        RepairQuotation.QuotationHeaderInformation             = new NFM104Rest.QuotationHeaderInformation[] { QuotationHeaderInformation };
 
        // Monitoringの設定
        Datetime nowDT = Datetime.now();
        String nowStr = nowDT.format('yyyyMMddHHmm');
        RepairQuotation.Monitoring = new NFMUtil.Monitoring();
        RepairQuotation.Monitoring.MessageGroupNumber = nowStr + count + '1';
        // insert
        QuotationHeaderInformation.SFDCRepairNo          = rpr.Name;
        QuotationHeaderInformation.SAPRepairNo           = rpr.SAPRepairNo__c;
        QuotationHeaderInformation.SAPQuotationNo        = 'NFM104I';
        QuotationHeaderInformation.FirstQuotationDate    = '20140101';
        QuotationHeaderInformation.LatestQuotationDate   = '20140101';
        QuotationHeaderInformation.TotalPrice            = '64300.34';
        QuotationHeaderInformation.RepairRank            = 'A';
        QuotationHeaderInformation.CafeteriaFlag         = '0000021598';
 
        DiscountInformation.DiscountType                 = '11';
        DiscountInformation.DiscountAmount               = '32000.12';
 
        InspectionResultInformation.InspectionResultFlag = '0000021598';
        InspectionResultInformation.InspectionComment    = 'CCD线长度: 248MM  把手、S盖脱漆、磨损,旋纽划痕,吸引口、水气口、1号外皮轻磨损。';
        InspectionResultInformation.FailureCause         = '先端部金属磨损严重,插入部发黄结晶,角度不足,钳子口磨损,2、3号外皮变色,水气不畅,CCD玻璃缺损大于1/10,涂胶后无阴影。B级不修理故障:CCD玻璃缺损大于1/10';
 
        FailureInformation.LocationGroupName             = '内镜连接座部';
        FailureInformation.LocationName                  = 'LG导光杆部';
        FailureInformation.PhenomenonName                = 'IG导光束异常(红裂缝、折损、彩虹斑)';
        FailureInformation.CauseName                     = '劣化, 老化';
        FailureInformation.DescriptionName               = '由于送气・送水圆筒的刮痕导致气囊送水量不能达到规格值。';
 
        ActivityInformation.ActivityDescription          = '插入部护套更换';
 
        //NFM104WebService.NFM104(RepairQuotation);
        BatchIF_Log__c rowData = NFMUtil.saveRowData(RepairQuotation.Monitoring, 'NFM104', RepairQuotation.QuotationHeaderInformation);
        if (String.isBlank(rowData.Log__c) == false) 
            NFM104Rest.main(rowData.Id);
        rpr = [select Id, Name, Delivered_Product__c, Repair_Quotation_Id__c, SAPRepairNo__c from Repair__c]; 
        List<Repair_Quotation__c> quotationList = [select Id, Name, Repair_Rank__c, Repair__c
                                                          , InspectionComment__c, InspectionResultFlag__c
                                                          , InspectionFailureCause__c
                                                          , LatestQuotationDate__c
                                                          , FirstQuotationDate__c, TotalPrice__c
                                                          , sales_discount__c, maintenance_pj__c
                                                          , CafeteriaFlag__c, MessageGroupNumber__c
                                                     from Repair_Quotation__c
                                                    where MessageGroupNumber__c =: RepairQuotation.Monitoring.MessageGroupNumber
                                                      and Name = :QuotationHeaderInformation.SAPQuotationNo ];
        count++;
        // System.assertEquals(0, quotationList.size());
        if (quotationList.size() == 1) {
            System.assertEquals(QuotationHeaderInformation.SAPQuotationNo, quotationList[0].Name);
            System.assertEquals(NFMUtil.parseStr2Date(QuotationHeaderInformation.FirstQuotationDate), quotationList[0].FirstQuotationDate__c);
            System.assertEquals(NFMUtil.parseStr2Date(QuotationHeaderInformation.LatestQuotationDate),quotationList[0].LatestQuotationDate__c);
            System.assertEquals(QuotationHeaderInformation.RepairRank, quotationList[0].Repair_Rank__c);
            System.assertEquals(null, quotationList[0].maintenance_pj__c);
            System.assertEquals(InspectionResultInformation.InspectionResultFlag == 'X' ? 'OK' : 'NG', quotationList[0].InspectionResultFlag__c);
            System.assertEquals(InspectionResultInformation.InspectionComment, quotationList[0].InspectionComment__c);
            System.assertEquals(InspectionResultInformation.FailureCause, quotationList[0].InspectionFailureCause__c);
            System.assertEquals(RepairQuotation.Monitoring.MessageGroupNumber, quotationList[0].MessageGroupNumber__c);
            System.assertEquals(rpr.Id, quotationList[0].Repair__c);
            System.assertEquals(rpr.Repair_Quotation_Id__c, quotationList[0].Id);
            System.assertEquals(rpr.SAPRepairNo__c, QuotationHeaderInformation.SAPRepairNo);
            
            List<Repair_quotation_reason__c> qrsnList = [select ActivityDescription__c, Repair_quotation__c, LocationGroupName__c, LocationName__c, PhenomenonName__c, CauseName__c, DescriptionName__c from Repair_quotation_reason__c];
            System.assertEquals(2, qrsnList.size());
            System.assertEquals(quotationList[0].Id, qrsnList[0].Repair_quotation__c);
            System.assertEquals(ActivityInformation.ActivityDescription, qrsnList[0].ActivityDescription__c);
            System.assertEquals(quotationList[0].Id, qrsnList[1].Repair_quotation__c);
            //System.assertEquals(FailureInformation.LocationGroupName, qrsnList[1].LocationGroupName__c);
            System.assertEquals(FailureInformation.LocationName, qrsnList[1].LocationName__c);
            System.assertEquals(FailureInformation.PhenomenonName, qrsnList[1].PhenomenonName__c);
            System.assertEquals(FailureInformation.CauseName, qrsnList[1].CauseName__c);
            System.assertEquals(FailureInformation.DescriptionName, qrsnList[1].DescriptionName__c);
 
            List<Repair_reason__c> rrsnList = [select Repair__c, Repair_quotation__c, LocationGroupName__c, LocationName__c, PhenomenonName__c, CauseName__c, DescriptionName__c from Repair_reason__c];
            System.assertEquals(0, rrsnList.size());
        }
    }
}