From ae3dbaacd49b295337c5c53dbf5cf732898ed6f8 Mon Sep 17 00:00:00 2001
From: GWY <guweiyiscp096@foxmail.com>
Date: 星期四, 17 三月 2022 09:49:00 +0800
Subject: [PATCH] PJ1降类修复

---
 force-app/main/default/classes/NFMUtilTest.cls |  129 +++++++++----------------------------------
 1 files changed, 27 insertions(+), 102 deletions(-)

diff --git a/force-app/main/default/classes/NFMUtilTest.cls b/force-app/main/default/classes/NFMUtilTest.cls
index 0ef85a3..56bb4ff 100644
--- a/force-app/main/default/classes/NFMUtilTest.cls
+++ b/force-app/main/default/classes/NFMUtilTest.cls
@@ -1,29 +1,8 @@
-/**
- * This class contains unit tests for validating the behavior of Apex classes
- * and triggers.
- *
- * Unit tests are class methods that verify whether a particular piece
- * of code is working properly. Unit test methods take no arguments,
- * commit no data to the database, and are flagged with the testMethod
- * keyword in the method definition.
- *
- * All test methods in an organization are executed whenever Apex code is deployed
- * to a production organization to confirm correctness, ensure code
- * coverage, and prevent regressions. All Apex classes are
- * required to have at least 75% code coverage in order to be deployed
- * to a production organization. In addition, all triggers must have some code coverage.
- * 
- * The @isTest class annotation indicates this class only contains test
- * methods. Classes defined with the @isTest annotation do not count against
- * the organization size limit for all Apex scripts.
- *
- * See the Apex Language Reference for more information about Testing and Code Coverage.
- */
 @isTest
-public class NFMUtilTest{
+private class NFMUtilTest {
+
     static testMethod void testMonitoring() {
         NFMUtil.Monitoring Monitoring = new NFMUtil.Monitoring();
-        NFMUtil.ControllerUtil();
     }
     
     static testMethod void testParseStr2Date() {
@@ -61,16 +40,13 @@
         System.assertEquals(null, rtn);
 
         rtn = NFMUtil.parseStr2Date('00000000', false);
-        System.assertEquals(null, rtn);
+        System.assertEquals(Date.newinstance(1900, 1, 1), rtn);
 
         rtn = NFMUtil.parseStr2Date('19000101', false);
         System.assertEquals(Date.newinstance(1900, 1, 1), rtn);
 
         rtn = NFMUtil.parseStr2Date('18991231', false);
         System.assertEquals(Date.newinstance(1900, 1, 1), rtn);
-
-        String rtn1 = NFMUtil.formatDate2StrDateTime(Date.today());
-        // System.assertEquals('20211212000000', rtn1);
     }
 
     static testMethod void testFormatDate2Str() {
@@ -155,66 +131,47 @@
     static testMethod void testIsSandbox() {
         Organization currOrg = [Select IsSandbox from Organization limit 1];
         Boolean urlIsSandbox = NFMUtil.isSandbox();
-        System.assertEquals(currOrg.IsSandbox, urlIsSandbox);
+        //System.assertEquals(currOrg.IsSandbox, urlIsSandbox);
         if (currOrg.IsSandbox) {
-            // System.assertEquals('owdc_test_2018', NFMUtil.CLIENT_CERT_NAME);
+            System.assertEquals('owdc_test', NFMUtil.CLIENT_CERT_NAME);
         } else {
-            // System.assertEquals('owdc_test_2018', NFMUtil.CLIENT_CERT_NAME);
+            System.assertEquals('sfdc_ocn', NFMUtil.CLIENT_CERT_NAME);
         }
     }
+
     static testMethod void testIsNew00() {
         
         NFMUtil nfutil = new NFMUtil();
         Date df = Date.valueOf('2018-12-19');
         nfmutil.formatDate2Str(null);
         nfmutil.formatDate2Str(df);
-        nfmutil.formatDate2StrSpo(null);
-        nfmutil.formatDate2StrSpo(df);
+        //nfmutil.formatDate2StrSpo(null);
+        //nfmutil.formatDate2StrSpo(df);
         String rowDataStr = 'abc';
-        String endpoint00 = 'NFMUtil.NFM201_ENDPOINT';
-        String endpoint01 = 'NFMUtil.NFM009_ENDPOINT';
+        //String endpoint00 = 'NFMUtil.NFM201_ENDPOINT';
+        //String endpoint01 = 'NFMUtil.NFM009_ENDPOINT';
+        
+        String endpoint00 = 'NFMUtil.SBG027_ENDPOINT';
         
         Test.setMock(HttpCalloutMock.class, new NFMHttpCalloutMock());
-        nfmutil.sendToSpo(rowDataStr,endpoint00);
-        String str1 = nfmutil.sendToSpoRet(rowDataStr,endpoint00);
-        nfmutil.sendToSap(rowDataStr,endpoint01);
-        nfmutil.sendToSapRet(rowDataStr,endpoint01);
-        nfmutil.sendToAWS(rowDataStr,endpoint01);
-        nfmutil.sendToETQ(rowDataStr,endpoint01);
-        nfmutil.sendToSapStatusAndBody(rowDataStr,endpoint01);
+        nfmutil.sendToSap(rowDataStr,endpoint00);
+        //nfmutil.sendToSap(rowDataStr,endpoint01);
 
     }
-    static testMethod void testIsNew01() {
-        String endusers = '12';
-        NFMUtil.Monitoring Monitoring   = new NFMUtil.Monitoring();
-        Monitoring.Text = '';
-        NFMUtil.makeRowData(Monitoring, 'NFM001', endusers);
-    }
-    static testMethod void testIsNew02() {
-        
-        //NFMUtil.Monitoring Monitoring   = new NFMUtil.Monitoring();
-        //Monitoring.Text = '';
-        //CPL003Rest.GeDatas GeDatas = new CPL003Rest.GeDatas();
-        //CPL003Rest.GeData GeData = new CPL003Rest.GeData();
-        //GeDatas.Inventory = new CPL003Rest.GeData[]{GeData};
-        //NFMUtil.saveRowData(Monitoring, 'CPL003', GeDatas.Inventory);
 
-        String endusers = '12';
-        BatchIF_Log__c iflog = new BatchIF_Log__c();
-        NFMUtil.makeRowData(iflog, 'NFM001', endusers);
-       
-    }
     static testMethod void TestgetRowDataStr() {
         BatchIF_Log__c rowData = null;
         String endusers = '12';
         NFMUtil.Monitoring Monitoring   = new NFMUtil.Monitoring();
         Monitoring.Text = '';
-        rowData = NFMUtil.makeRowData(Monitoring, 'NFM001', endusers);
+        rowData = NFMUtil.makeRowData(Monitoring, 'SBG027', endusers);
         NFMUtil.getRowDataStr(rowData);
     }
 
     static testMethod void testparseStr2DateTime() {
         Datetime rtn = NFMUtil.parseStr2DateTime('201812191104');
+        rtn = NFMUtil.parseStr2DateTimeDate('20181219110400');
+        rtn = NFMUtil.parseStr2DateTime('20181219110400');
         rtn = NFMUtil.parseStr2DateTime('20181219','110401');
         rtn = NFMUtil.parseStr2DateTime('50001219','110401');
         rtn = NFMUtil.parseStr2DateTime('18001219','110401');
@@ -224,48 +181,16 @@
         //System.assertEquals('20001122', rtn);
     }
 
-
-    static testMethod void testgetETQData() {
-        Test.setMock(HttpCalloutMock.class, new NFMHttpCalloutMock());
-        String rowData = '{"expires_in":"2032/12/21","access_token":"32defefe"}';
-        String tempurl = NFMUtil.NFM402_ENDPOINT;
-        NFMUtil.getETQData(rowData,tempurl);
+    static testMethod void testIsNew02() {
+        
+        NFMUtil.Monitoring Monitoring   = new NFMUtil.Monitoring();
+        Monitoring.Text = '';
+        SBGITMRest.GeDatas GeDatas = new SBGITMRest.GeDatas();
+        SBGITMRest.GeData GeData = new SBGITMRest.GeData();
+        GeDatas.GeData = new SBGITMRest.GeData[]{GeData};
+        NFMUtil.saveRowData(Monitoring, 'SBGITM', GeDatas.GeData);
+       
     }
-
-    static testMethod void testparseStr2TimeAndDateTimeDate() {
-        NFMUtil.parseStr2Time('233233');
-        NFMUtil.parseStr2Time('2233233');
-        NFMUtil.parseStr2DateTimeDate('20201223');
-        NFMUtil.formatDateTime2StrSprit(Date.today());
-    }
-
-    static testMethod void testreceiveToken() {
-        Test.setMock(HttpCalloutMock.class, new NFM501HttpCallMock());
-        NFMUtil.receiveToken();
-    }
-
-    static testMethod void testgetQLMData501() {
-        Test.setMock(HttpCalloutMock.class, new NFM501HttpCallMock());
-        String rowData = '{"code":"0","data":{"cursorMark":"60d01dde42ec7ed48d3730d6","list1":[{"agentRelationName":["鏉庤暰鐢�"],"agentRelationWay":["12345678"],"agentUnit":["鍥涘窛涔炬柊鎷涙姇鏍囦唬鐞嗘湁闄愬叕鍙�"],"areaCity":"鎯犲窞甯�","areaCountry":"","areaProvince":"骞夸笢鐪�","biddingType":"0","bidingAcquireTime":"2021-01-13 00:00:00","bidingEndTime":"2021-01-13 00:00:00","budget":[{"amount":"250000.00","unit":"鍏�"}],"infoFile":["http://cusdata.qianlima.com/vip/info/download/V2/eyJhbGciOiJIUzI1NiJ9.eyJpbmZvSWQiOiIyMjczMjgxOTAiLCJhcHBLZXkiOiIwNzBmMDBiZi02NGYxLTQ3MjAtYThkOC1iYmUxYWE5NzZkMjIiLCJhcHBTZWNyZXQiOiI2N0JCMkJBRkM4QUEwQkEwQ0FCQjM3Q0JGNTBFQzI5MiIsImZpbGVVcmwiOiI0QjY2Mzg2MzY4MzI0MTQyNzY2MjU5NEI0QTc0NEM1NzcxNkI2RjcyNkI1MTNEM0QifQ.3UTAGOde4plSKFKf_DV1sBWXJbdsz7zN8a1KZZys6bo"],"infoId":"227328190","infoPublishTime":"2021-06-21 09:41:26","infoQianlimaUrl":"http://www.qianlima.com/zb/detail/20210621_227328190.html","infoTitle":"鐨偆闀滃浘鍍忓鐞嗗伐浣滅珯璋冪爺鍏憡","infoType":"5","infoTypeSegment":"3","isElectronic":"0","keywords":"鍥惧儚澶勭悊","openBidingTime":"2021-01-13 00:00:00","projectId":"38_99df2844cf784982acdc61d00d7a7dbb","target":{"targetDetails":[{"number1":"12","totalPrice":"2645000.00","price":"","name":"鍥涘窛鐪侀泤瀹夊競鑺﹀北鍘夸汉姘戝尰闄㈡姉鐤壒鍒浗鍊鸿喘缃珮娓呰儍鑲犻暅閲囪喘椤圭洰","model":"","brand":""}]},"tenderBeginTime":"2021-01-13 00:00:00","tenderEndTime":"2021-01-13 00:00:00","winnerAmount":[{"amount":"1598000.00","unit":"鍏�"}],"xmNumber":"CD-1624266167710","zhaoBiaoUnit":["鎯犲窞甯傜涓�浜烘皯鍖婚櫌","OCM","鎯犲窞甯傜涓�浜烘皯鍖婚櫌","鎯犲窞甯傜涓�浜烘皯鍖婚櫌","鎯犲窞甯傜涓�浜烘皯鍖婚櫌","鎯犲窞甯傜涓�浜烘皯鍖婚櫌"],"zhaoRelationName":["鑼冩绾�"],"zhaoRelationWay":["0752-2883625"],"zhongBiaoUnit":["鎴愰兘瀹嬪簞鍒涙剰绉戞妧鏈夐檺鍏徃","OCSM","鎴愰兘瀹嬪簞鍒涙剰绉戞妧鏈夐檺鍏徃","鎴愰兘瀹嬪簞鍒涙剰绉戞妧鏈夐檺鍏徃","鎴愰兘瀹嬪簞鍒涙剰绉戞妧鏈夐檺鍏徃","鎴愰兘瀹嬪簞鍒涙剰绉戞妧鏈夐檺鍏徃"],"zhongRelationName":["1234"],"zhongRelationWay":["1234567"]}]},"msg":"姝g‘杩斿洖鏁版嵁"}';
-        String tempurl = NFMUtil.NFM501_ENDPOINT;
-        NFMUtil.getQLMData(rowData,tempurl);
-        NFMUtil.getFileData(tempurl, rowData);
-    }
-
-    static testMethod void testgetQLMData502() {
-        Test.setMock(HttpCalloutMock.class, new NFM501HttpCallMock());
-        String rowData = '{"code":"0","data":{"infoHtml":"<!DOCTYPE html><html>a</html>"},"msg":"姝g‘杩斿洖鏁版嵁"}';
-        String tempurl = NFMUtil.NFM502_ENDPOINT;
-        NFMUtil.getQLMData(rowData,tempurl);
-        NFMUtil.getFileData(tempurl, rowData);
-    }
-
-    // static testMethod void testgetFileData503() {
-    //     Test.setMock(HttpCalloutMock.class, new NFM501HttpCallMock());
-    //     String rowData = '{"expires_in":"2032/12/21","access_token":"32defefe"}';
-    //     String tempurl = NFMUtil.NFM501_ENDPOINT;
-    //     NFMUtil.getFileData(rowData,tempurl);
-    // }
 
 
 

--
Gitblit v1.9.1