function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
mamatha devarajmamatha devaraj 

Please write a test class for below method i tried but failed

I got below exception msg
USER_DEBUG [283]|DEBUG|exception2Insert failed. First exception on row 0 with id a7o3K000000DwPWQA0; first error: INVALID_FIELD_FOR_INSERT_UPDATE, cannot specify Id in an insert call: [Id]




public static string billSpecSoInsert(Customer_Billing_Spec_Template__c billSpecins, List<Customer_Billing_Spec_SOMap__c> SoMapList, List<Cust_Billing_Spec_Extra_Parameter__c> billingExtParamList){
     
        System.debug('In ECOB_CloneBillingSpecsAccessor class for billSpecSoInsert  billSpecins:'+billSpecins);
        System.debug('In ECOB_CloneBillingSpecsAccessor class for billSpecSoInsert SoMapList:'+SoMapList);
        
        
        System.debug('In ECOB_CloneBillingSpecsAccessor class for billSpecSoInsert SoMapList size:'+SoMapList.size());
        string status='Success';
        try{
            insert billSpecins;            
            
            //NAD-4567(SF-8490): Order Extra Parameters Phase 2
            if(!billingExtParamList.isEmpty()){
                for(Cust_Billing_Spec_Extra_Parameter__c ep : billingExtParamList){
                    ep.Customer_Billing_Spec_Template__c = billSpecins.id;
                }
                insert billingExtParamList;
            }
            
            if(!SoMapList.isEmpty()){
            
                for(Customer_Billing_Spec_SOMap__c billspecId : SoMapList){
                    
                    billspecId.Customer_Billing_Spec__c = billSpecins.id;
                }
            
                insert SoMapList;                
            }
        }catch(DMLexception ex) {
            ECOB_LogUtility.createDMLExceptionLog(ex); 
            system.debug('exception1 '+ex.getCause());
            system.debug('exception2'+ex.getMessage());
            status = ex.getMessage();
        }
      return status;
    }
    
    
Sai PraveenSai Praveen (Salesforce Developers) 
Hi Mamatha,

Can you confirm  how you are passing the parameters to billSpecSoInsert method?

Thanks,
 
mamatha devarajmamatha devaraj
Hi Praveen,
Below is entair apex class and test class, I am new to development , help me to increse the code caverage of the test class from 76 to 86%.


   
     
public static map<id,Customer_Product__c> getproductcrelatedtoCP(Id cpid){ 
        //M-0003
        map<id,Customer_Product__c> prodmap = new map<id,Customer_Product__c>([Select Id, Product_Type_Product_Code__c, Product__c, Product__r.Product_Code__c, Customer_Program__c, Account_Name__c,
                                              Product__r.Product_Grouping_Name__c, Product__r.Product_Category__c, Product__r.Product_Family__c From Customer_Product__c where Customer_Program__c=:cpid]);
        return prodmap;
    }
    
    /**
     * Fetches all customer billing spec records for that particular customer program
     * @param String : customer program id
     * @return : map<id,Customer_Product__c>
     **/
     public static Map<id, Customer_Billing_Spec_Template__c> getBillingcrelatedtoCP(Id fromProgramid){ 
        //M-0003//M-0010
        Map<id, Customer_Billing_Spec_Template__c> billingSpecs = New Map<id, Customer_Billing_Spec_Template__c>( [SELECT Id, Name, Account_Name__c, Adapter_Model__c, Billing_Category__c, HNS_Product__c,Billing_Spec_Category__c, 
                                                                  HNS_Product__r.Product_Code__c, Customer_Product__c, Product_Code__c, Product_Type_NEP__c, User_Defined_Customer_Billing_Spec_Name__c,Description__c,
                                                                  Customer_Product__r.Product_Type_Product_Code__c, Customer_Product__r.Name, Customer_Product__r.Product__c, Customer_Product__r.Product_Name__c, 
                                                                  DSS_Package_Name__c, DSS_Program_Code__c, DSS_Program_Name__c, Downlink_Uplink_Speed_NEP__c, Help_Desk_Support_Level__c,Install_Country__c, 
                                                                  Install_State__c, Install_Support__c, Installation_Type__c, Lease_Purchase__c, Lease_Term__c, NapSource_NapSubType_NEP__c,   Ordered_Downlink_Speed_NEP__c, Ordered_Uplink_Speed_NEP__c, Product_Category__c, 
                                                                  Product_Type__c, Remote_Maintenance__c, Min_Quantity__c, Max_Quantity__c, Customer_Product__r.Product__r.Product_Code__c, HAN_Type__c, VSAT_Antenna__c,
                                                                  Service_Commitment_Term__c, Is_Active__c,Customer_Store_Configuration__c,All_Installation_Extras__c FROM Customer_Billing_Spec_Template__c WHERE DSS_Program_Name__c =: fromProgramid and Is_Active__c = true]);
        //M-0003 //M-0008
        return billingSpecs;
    }
    
    /**
     * Fetches all customer billing spec SO records for that particular customer billing spec templates
     * @param String : billing spec ids
     * @return : List<Customer_Billing_Spec_SOMap__c>
     **/
    public static List<Customer_Billing_Spec_SOMap__c> pullSOsByBSpecId(Set<Id> bSpecIds){
        List<Customer_Billing_Spec_SOMap__c> SOs = New List<Customer_Billing_Spec_SOMap__c>( [SELECT id , Name, Customer_Billing_Spec__c,Customer_Billing_Spec__r.Customer_Product__c, Markup__c, Pricing_Model__c, Unit_Price__c, Free_Units__c,
                        Customer_Billing_Spec__r.HNS_Product__c,DSS_Svc_Offering__c, DSS_Svc_Offering__r.Path_ID__c FROM Customer_Billing_Spec_SOMap__c WHERE Customer_Billing_Spec__c IN: bSpecIds] );
        return SOs;
    }

     /**
     * Fetches all customer Service Offering records for that particular customer program
     * @param String : List of Path Ids
     * @return : Map<id, Service_Offerings__c>
     **/
    public static Map<id, Service_Offerings__c> pullToProgramServiceOfferings(Set<String> toPathIds){
        Map<id, Service_Offerings__c> SOs = New Map<id, Service_Offerings__c>( [SELECT Id, Name, Path_ID__c, Service_Offering_ID__c FROM Service_Offerings__c WHERE Path_ID__c IN: toPathIds]);
        System.debug('@@ SOs '+SOs);
        System.debug('@@ SOs '+[SELECT Id, Name, Path_ID__c, Service_Offering_ID__c FROM Service_Offerings__c WHERE Path_ID__c IN: toPathIds]);
        return SOs;
    }

    /**
     * Fetches all so maps records for that particular billing spec
     * @param String : customer program id
     * @return : List<Customer_Billing_Spec_Template__c>
     **/
      // @ashwani field change
     public static list<Customer_Billing_Spec_Template__c> getallsomaps(list<Customer_Billing_Spec_Template__c> bspecs){
        //M-0003 //M-0008//M-0010
  
        list<Customer_Billing_Spec_Template__c> prodmap = [Select c.Customer_Product__r.Product__c,c.Billing_Spec_Category__c, c.User_Defined_Customer_Billing_Spec_Name__c, c.Transport_Name__c, c.Remote_Maintenance__c, c.RecordTypeId, c.Product_Type__c,Product_Type_NEP__c, c.Product_Category__c, 
                                                           c.Ordered_Uplink_Speed_NEP__c, c.Ordered_Downlink_Speed_NEP__c, c.Name, c.Min_Quantity__c, c.Max_Quantity__c, c.Lease_Term__c, c.Lease_Purchase__c, 
                                                           c.Install_Support__c, c.Installation_Type__c, c.Install_State__c, c.Install_Country__c, c.Id, c.Help_Desk_Support_Level__c, c.HNS_Product__c, 
                                                           c.Downlink_Uplink_Speed_NEP__c, c.DSS_Program_Name__c, c.DSS_Program_Code__c, c.DSS_Package_Name__c, c.Customer_Product__c,
                                                           c.Billing_Category__c, c.Adapter_Model__c, c.Account_Name__c, c.OrderType_OrderSubType_NEP__c,
                                                           c.Product_Code__c, c.Product_Level__c, c.Product_Level_Value__c, c.NapSource_NapSubType_NEP__c, c.Description__c,
                                                           c.Remote_Maintenance__r.Product__r.Product_Code__c, c.Install_Support__r.Product__r.Product_Code__c, c.Help_Desk_Support_Level__r.Product__r.Product_Code__c,
                                                           c.HAN_Type__c,c.VSAT_Antenna__c,c.Service_Commitment_Term__c,c.Is_Active__c,c.Customer_Store_Configuration__c,c.All_Installation_Extras__c,
                                                           (Select Name, Customer_Billing_Spec__c, DSS_Plan_Name__c, DSS_Svc_Offering__c, Billing_Deal_Name__c, Override_Billing_Deal__c, 
                                                           Override_Price__c, Do_Not_Cancel_On_Terminate__c, WBS__c, Invoice_Description__c, ALU_Prod_Name__c, Portal_Invoice_Identifier__c, 
                                                           Leasing_Invoice_Identifier__c, Hold_Charges_in_Billing__c, Billing_PO_Number__c, Notes__c, Billing_Type__c, Is_Billing_Deal_Overridable__c, 
                                                           Billing_Deal_Description__c, Is_Transport_Service_Offering__c, Markup__c, Pricing_Model__c, Unit_Price__c, Free_Units__c, Include_in_Franchisee_Cust_Quote__c From Customer_Billing_Spec_SOMaps__r) 
                                                           ,(select Name , Parameter_Name__c, Parameter_Value__c,Customer_Billing_Spec_Template__c from Cust_Billing_Spec_Extra_Parameters__r) From Customer_Billing_Spec_Template__c c where id in:bspecs];
        
        return prodmap;
    }
    
    /** M-0005
     * Description: Fetches all Service Offerings in this plan records for that provided Service offering record ids
     * @param String : List<Service_Offerings__c> SOs
     * @return : List<Service_Offerings_in_this_Plan__c>
    **/
    public static List<Service_Offerings_in_this_Plan__c> SOsInAPlan(List<Service_Offerings__c> SOs){
        return [Select Name, Service_Offerings__c, Plan__c FROM Service_Offerings_in_this_Plan__c WHERE Service_Offerings__c IN: SOs];
    }
    
    /**
     * Description: Fetches all Plans in Package records for that provided plan record Ids
     * @param String : Set<String> planIds
     * @return : List<Plans_in_Package__c>
    **/
    public static List<Plans_in_Package__c> plansInAPackage(Set<String> planIds){
        return [Select Name, Package__c, Plan__c FROM Plans_in_Package__c WHERE Plan__c IN: planIds];
    }//M-0005
    
    
mamatha devarajmamatha devaraj
@isTest
private class ECOB_CloneBillingSpecsAccessor_Test{
    @TestSetup
   
    public static void dataSetup(){
        
        Account acc1 = ECOB_AccountDataUtil.createAccount('LE','abc','accnt'+String.valueof(system.now()),'123');
        acc1.ShippingCity = 'city';
        acc1.ShippingPostalCode = '12345';
        update acc1;
        Account acc = ECOB_AccountDataUtil.createAccount(acc1.Id,'Location','rest','accnt'+String.valueof(system.now()),'1234');
        acc.ShippingCity = 'def';
        acc.ShippingPostalCode = '12855';
        acc.Customer_Location_ID__c = '5000222';
        update acc;
        
        Program__c customerProgram = ECOB_AccountDataUtil.createProgram(acc1.id,'Test Program','Test','Test','Segment Rule','2');
        Program__c customerProgram1 = ECOB_AccountDataUtil.createProgram(acc1.id,'Test Program2','Test1','Test1','Segment Rule','2');
        
        Product_Grouping__c productGrouping=ECOB_AccountDataUtil.createProductGrouping('TestProductGrouping');
        
        HNS_Products__c product=ECOB_AccountDataUtil.createHNSProduct('TestProduct', 'Active Bonding', 'Testtest2', 'BOM', 'Service', productGrouping.id);
        HNS_Products__c product1=ECOB_AccountDataUtil.createHNSProduct('TestProduct', 'Broadband Remote', 'Broadband', 'BOM', 'Hardware', productGrouping.id);
        
        List<Customer_Product__c> custProdList=new List<Customer_Product__c>();
        Customer_Product__c customerProduct=ECOB_AccountDataUtil.createCustomerProduct(acc1.id, '',customerProgram.id, product.id);
        customerProduct.name='Testproduct';
        custProdList.add(customerProduct);
        
        Customer_Product__c customerProduct1=ECOB_AccountDataUtil.createCustomerProduct(acc1.id, '',customerProgram1.id, product.id);
        customerProduct1.name='Testproduct';
        custProdList.add(customerProduct1);
        
        Customer_Product__c customerProduct3=ECOB_AccountDataUtil.createCustomerProduct(acc1.id, '',customerProgram1.id, product.id);
        customerProduct3.name='Testproduct1';
        custProdList.add(customerProduct3);
        
        update custProdList;
        
        Order_Reference__c orderRef= ECOB_AccountDataUtil.createOrderReference('abcd - 1234','abcd', '1234', 'Uplnk_DwnLnk_Spd');
        orderRef.Is_Active__c=false;
        orderRef.On_premise_CentralDB_ID__c='1234';
        update orderRef;
        
        List<Service_Offerings__c> servList = new List<Service_Offerings__c>();
        Service_Offerings__c serOff = ECOB_AccountDataUtil.createDSSServiceOffering('A-B-C',true,'Testofferdata'); 
        Service_Offerings__c serOff1 = ECOB_AccountDataUtil.createDSSServiceOffering('D-E-F',true,'Testofferdata1'); 
        Service_Offerings__c serOff2 = ECOB_AccountDataUtil.createDSSServiceOffering('Test1-B-C',true,'Testofferdata2'); 
        Service_Offerings__c serOff3 = ECOB_AccountDataUtil.createDSSServiceOffering('Test1-E-F',true,'Testofferdata2'); 
        servList.add(serOff);servList.add(serOff1);servList.add(serOff2);servList.add(serOff3);
        Test.startTest();
        Package__c pckg = ECOB_AccountDataUtil.createPackage('abc', 'IDU+ODU', 'Test');
        pckg.Program_Code__c = 'Test';
        pckg.Is_Active__c = True;
        pckg.Package_Term__c = 324;
        pckg.Path__c = '55656564645AS';
        update pckg;
        
        Plan__c plan = ECOB_AccountDataUtil.createPlans('Base','ABC');
        plan.Is_Active__c = True;
        update plan;
        
        Plans_in_Package__c pip = ECOB_AccountDataUtil.createPlansInPackage(pckg.Id,plan.Id);
        
        id servicePlanRecordType = Schema.SObjectType.Service_Offerings_in_this_Plan__c.getRecordTypeInfosByDeveloperName().get(Label.ECOB_DeveloperNameRecordTypeForFoss).getRecordTypeId();
        
        list<Service_Offerings_in_this_Plan__c> plansSOffers = new list<Service_Offerings_in_this_Plan__c>();
        Service_Offerings_in_this_Plan__c soitp =  ECOB_AccountDataUtil.getSerOfferInthePlan(plan.Id,serOff3.Id);
        Service_Offerings_in_this_Plan__c soitp1 =  ECOB_AccountDataUtil.getSerOfferInthePlan(plan.Id,serOff2.Id);
        Service_Offerings_in_this_Plan__c soitp2 =  ECOB_AccountDataUtil.getSerOfferInthePlan(plan.Id,serOff1.Id);
        Service_Offerings_in_this_Plan__c soitp3 =  ECOB_AccountDataUtil.getSerOfferInthePlan(plan.Id,serOff.Id);
        soitp.recordTypeId = servicePlanRecordType;
        soitp1.recordTypeId = servicePlanRecordType;
        soitp2.recordTypeId = servicePlanRecordType;
        soitp3.recordTypeId = servicePlanRecordType;
        plansSOffers.add(soitp);
        plansSOffers.add(soitp1);
        plansSOffers.add(soitp2);
        plansSOffers.add(soitp3);
        update plansSOffers;
        
        ECOB_DuplicateBillingSpecCheck__c cust = ECOB_AccountDataUtil.createODuplicateBillingSpecCheck('Duplicate Check On BillingSpec',true);  
        
        
        Customer_Billing_Spec_Template__c customerBillingSpecs = ECOB_AccountDataUtil.createBillingSpec(acc1.id, null, customerProduct.id, product1.id, 'TestUser',pckg.id,'test','test','test','','','','','');
        customerBillingSpecs.Downlink_Uplink_Speed_NEP__c=orderRef.id;
        customerBillingSpecs.Transport_Name__c='Test Name';
        customerBillingSpecs.HAN_Type__c = 'Prime';
        customerBillingSpecs.Product_Type_NEP__c='Test String1';
        customerBillingSpecs.Product_Code__c = 'Testtest2';
        update customerBillingSpecs;
        
        HNS_Product_Service_Plan__c Hns = ECOB_AccountDataUtil.createHNSservice(product1.id,'');
        HNS_Product_Service_Plan__c Hns1 = ECOB_AccountDataUtil.createHNSservice(product.id,'');
        
        Customer_Product_Service_Plan__c customerProductServicePlan = ECOB_AccountDataUtil.createCustService(customerProduct3.id,Hns.id);
        customerProductServicePlan.Name = 'test1';
        update customerProductServicePlan;
        
        Customer_Product_Service_Plan__c customerProductServicePlan1 = ECOB_AccountDataUtil.createCustService(customerProduct.id,Hns1.id);
        customerProductServicePlan1.Name = 'test2';
        update customerProductServicePlan1;
        
        
        Customer_Billing_Spec_Template__c customerBillingSpecs1 = ECOB_AccountDataUtil.createBillingSpec(acc1.id, customerProgram.Id, customerProduct1.id, product1.id, 'TestUser12',pckg.id,'test','test','test','','','','','');
        customerBillingSpecs1.Downlink_Uplink_Speed_NEP__c = orderRef.id;
        customerBillingSpecs1.Product_Type_NEP__c='Hardware';
        customerBillingSpecs1.HAN_Type__c = 'Backup';
        customerBillingSpecs1.Transport_Name__c='Test Name';
        customerBillingSpecs1.Product_Code__c='Active Bonding;123';
        update customerBillingSpecs1;
        
        Customer_Billing_Spec_Template__c customerBillingSpecs2 = ECOB_AccountDataUtil.createBillingSpec(acc1.id, customerProgram1.Id, customerProduct.id, product1.id, 'TestUser1223',pckg.id,'test','test','test','','','','','');
        customerBillingSpecs2.Downlink_Uplink_Speed_NEP__c=orderRef.id;
        customerBillingSpecs2.HAN_Type__c = 'Prime';
        customerBillingSpecs2.Product_Type_NEP__c='Test String';
        customerBillingSpecs2.Product_Code__c='Active Bonding;123';
        update customerBillingSpecs2;
        
        Cust_Billing_Spec_Extra_Parameter__c custBillingSpecExtraParam1 = ECOB_AccountDataUtil.createCustBillingSpecExtraParams(customerBillingSpecs.Id,'param1','value1');
        Cust_Billing_Spec_Extra_Parameter__c custBillingSpecExtraParam2 = ECOB_AccountDataUtil.createCustBillingSpecExtraParams(customerBillingSpecs1.Id,'param1','value1');
        
        List<Customer_Billing_Spec_SOMap__c> bspecsomaps = new List<Customer_Billing_Spec_SOMap__c>();
        Customer_Billing_Spec_SOMap__c cutomerBilling = ECOB_AccountDataUtil.createBillingSpecSO(customerBillingSpecs.id, serOff2.id,plan.id,'11.00','def','text','abc','123','','','',false,null);
        bspecsomaps.add(cutomerBilling);
        Customer_Billing_Spec_SOMap__c cutomerBillingso = ECOB_AccountDataUtil.createBillingSpecSO(customerBillingSpecs1.id, serOff2.id,plan.id,'11.00','def','text','abc','123','','','',false,null);
        bspecsomaps.add(cutomerBillingso);
        Customer_Billing_Spec_SOMap__c cutomerBillingso1 = ECOB_AccountDataUtil.createBillingSpecSO(customerBillingSpecs2.id, serOff2.id,plan.id,'11.00','def','text','abc','123','','','',false,null);
        bspecsomaps.add(cutomerBillingso1);
        
        HNS_Product_Service_Plan__c hpsp = ECOB_AccountDataUtil.createHNSservice(product1.id,'');
        hpsp.Name='Test Hns';
        update hpsp;
        
        Customer_Product_Service_Plan__c cpsp = ECOB_AccountDataUtil.createCustService(customerProduct3.id,hpsp.id);
        cpsp.Name='Test';
        update cpsp;
        
        List<Customer_BluePrint__c> cblist = new List<Customer_BluePrint__c>();
        Customer_BluePrint__c cbp = ECOB_AccountDataUtil.createBluePrint(acc1.Id,customerProgram1.Id,'Prime');
        cbp.Dependent_On_Options__c = 'Testtest2';
        cblist.add(cbp);
        
        Customer_BluePrint__c cbp1 = ECOB_AccountDataUtil.createBluePrint(acc1.Id,customerProgram1.Id,'Backup');
        cbp1.Dependent_On_Options__c = 'Testtest2';
        cblist.add(cbp1);
        update cblist;
        Test.stopTest();
        
    }
    static testMethod void myUnitTest(){
        List<Account> lstAccount = [select id,name,CBC_ID__c,Default_Gateway__c,Primary_Contact__r.LastName,recordTypeID,DSL_Phone__c,Record_Type_Name__c,Override_Install_Address__c,ShippingLatitude,ShippingLongitude,HNS_Location_ID_Auto_Gen__c,Program_Code__c,BYOB_IP_Address__c,Customer_Location_ID__c,BillingStreet,BillingCity,BillingState,BillingPostalCode,BillingCountry,parentId,parent.parentId,parent.recordTypeId,Parent.Record_Type_Name__c,Parent.BillingStreet,Parent.BillingCity,Parent.BillingState,Parent.BillingPostalCode,Parent.BillingCountry,ShippingStreet,ShippingCity,ShippingState,ShippingCountry,ShippingPostalCode,Subnet_Mask__c,Static_IP_Address_Hughes_router__c,Primary_Contact__c from Account];
        List<Product_Grouping__c> lstPrGrping = [select id, name from Product_Grouping__c];
        List<HNS_Products__c> lstHnsProds = [select id, name, Product_Category__c, Product_Code__c, Product_Grouping_Name__c, Product_Type__c from HNS_Products__c];
        List<Program__c> customerProgram2 = new List<Program__c>([Select id,Name, DSS_Program_Code__c,Status__c , (Select id, Name from Cust_Billing_Spec_Templates__r) From Program__c where Brand_LE_Account__c=:lstAccount[0].id AND Status__c = 'Active' ORDER By Name ASC]);
        List<Customer_BluePrint__c> cblist = [Select id, Name, Rule_Type__c, Dependent_On_Options__c, Product__c, Is_Active__c, Required__c, Dependent_On_product_Level_Value__c, Dependent_On_product_level__c  From Customer_BluePrint__c];
        List<Order_Reference__c> lstOrdRef = [select id, name,Asset_Status__c from Order_Reference__c];
        List<Customer_Product__c> custProdList = [select id, name, Product__r.Product_code__c, Product__r.Product_Type__c, Product__r.Product_Grouping__c, Product__r.Product_Grouping__r.Name, Product__r.Product_Family__c from Customer_Product__c];
        List<Package__c> lstPackage = [Select id, Name, Is_Active__c From Package__c];
        List<Service_Offerings__c> lstServOffer = [Select id, Name, Is_Active__c From Service_Offerings__c]; 
        List<Customer_Billing_Spec_Template__c> lstCBST = [select id, name, Max_Quantity__c, Adapter_Model__c, Billing_Category__c, User_Defined_Customer_Billing_Spec_Name__c, Min_Quantity__c, HAN_Type__c, Service_Commitment_Term__c, Customer_Store_Configuration__c, Installation_Type__c, Install_State__c, Install_Support__c, Install_Country__c, Transport_Name__c, Remote_Maintenance__c, Help_Desk_Support_Level__c, Lease_Purchase__c, Lease_Term__c, VSAT_Antenna__c, NapSource_NapSubType_NEP__c, DSS_Program_Name__c,DSS_Package_Name__r.Name, Product_Code__c, OrderType_OrderSubType_NEP__c,(select id, name,Customer_Billing_Spec__c,Include_in_Franchisee_Cust_Quote__c,DSS_Plan_Name__r.Name from Customer_Billing_Spec_SOMaps__r) from Customer_Billing_Spec_Template__c];
        List<Customer_Billing_Spec_SOMap__c> lstcbsSOmap = [select id, name, DSS_Plan_Name__r.Name, Customer_Billing_Spec__c,Include_in_Franchisee_Cust_Quote__c from Customer_Billing_Spec_SOMap__c];
        List<ECOB_DuplicateBillingSpecCheck__c> lstDupBilSpChck = [Select id, Name, Duplicate_Check__c From ECOB_DuplicateBillingSpecCheck__c];
        List<Plans_in_Package__c> listPIP = [select id, Name, Package__c, Plan__c from Plans_in_Package__c];
        List<Plan__c> listPlan = [select id, Name, Plan_Type__c, Is_Active__c from Plan__c];
        List<Service_Offerings_in_this_Plan__c> listSOTP = [select id, Name, recordTypeId, Plan__c, Service_Offerings__c from Service_Offerings_in_this_Plan__c];
        List<HNS_Product_Service_Plan__c> listHPSP = [select id, Name, HNS_Product__c from HNS_Product_Service_Plan__c];
        List<Customer_Product_Service_Plan__c> cpspList = [select id , Name, Customer_Product__c, HNS_Product_Service_Plan__c from Customer_Product_Service_Plan__c];
        Program__c customerProgram = [select id, Name, Charging_Rule__c, GL_Segment__c, Brand_LE_Account__c, Status__c, DSS_Program_Code__c, DSS_Program_Name__c from Program__c where Name = 'Test Program' Limit 1];
        List<Cust_Billing_Spec_Extra_Parameter__c> listOfCBSpecExtraParams = [Select Id,Customer_Billing_Spec_Template__c,Parameter_Name__c,Parameter_Value__c from Cust_Billing_Spec_Extra_Parameter__c];
        List<Cust_Billing_Spec_Extra_Parameter__c> listOfCBSpecExtraParams1 = new List<Cust_Billing_Spec_Extra_Parameter__c>();
        
        Id acc1RT = Schema.SObjectType.Account.getRecordTypeInfosByDeveloperName().get(Label.ECOB_Account_Developer_Name_LE).getRecordTypeId();
        Id accRT = Schema.SObjectType.Account.getRecordTypeInfosByDeveloperName().get(Label.ECOB_DeveloperNameRecordTypeForLocation).getRecordTypeId();
        
        Set<id> rectypid = new Set<id>();
        rectypid.add(acc1RT);
        rectypid.add(accRT);
        
        Set<id> cpidsets = new Set<id>();
        for(Customer_Product__c cprod : custProdList){
            cpidsets.add(cprod.id);
        }
        System.assert(cpidsets != null);

        Set<id> idsets = new Set<id>();
        for(Service_Offerings__c svcoffr : lstServOffer){
            idsets.add(svcoffr.id);
        }
        
        Set<String> pathidset = new Set<String>();
        pathidset.add('A-B-C');
        pathidset.add('D-E-F');
        pathidset.add('Test1-B-C');
        
        Set<String> planIds = New Set<String>();
        planIds.add(listPIP[0].Plan__c);
        
        Map<String, Customer_Product__c> customerProductsByProductCode = new Map<String, Customer_Product__c>();
        customerProductsByProductCode.put(lstCBST[0].id, custProdList[0]);
        Map<String, String> productCodesByBillSpecId = New Map<String, String>();
        productCodesByBillSpecId.put(lstCBST[0].Id, lstCBST[0].Product_Code__c);
        
        Set<id> bspecids = new Set<id>();
        
        for(Customer_Billing_Spec_Template__c bspec : lstCBST){
            bspecids.add(bspec.id);
        }
        
        Map<String, List<Customer_Product_Service_Plan__c>> cpServicePlans = new Map<String, List<Customer_Product_Service_Plan__c>>();
        cpServicePlans.put('Test', cpspList);
        Customer_Billing_Spec_Template__c cbspec=[Select id,(Select id,Customer_Billing_Spec__c from Customer_Billing_Spec_SOMaps__r) From Customer_Billing_Spec_Template__c where id =: lstCBST[0].id];
        ECOB_Clone_Limit__c cloneLimit = new ECOB_Clone_Limit__c();
        cloneLimit.Clone_Limit__c='1';
        cloneLimit.Name='Customer_Billing_Spec_Template__c';
        insert cloneLimit;
        
        PageReference myPage=Page.ECOB_CloneBillingSpecs;
        Test.setCurrentpage(myPage); 
        ApexPages.currentPage().getParameters().put('accid',lstAccount[0].id);
        
        Test.startTest();
        ECOB_CloneBillingSpecsAccessor clonebilingacces = new ECOB_CloneBillingSpecsAccessor();
        ECOB_CloneBillingSpecsAccessor.getallcustomerprogram(lstAccount[0].id);
        ECOB_CloneBillingSpecsAccessor.getallbillingspecs(lstAccount[0].id);
        ECOB_CloneBillingSpecsAccessor.getproductcrelatedtoCP(customerProgram.id);
        ECOB_CloneBillingSpecsAccessor.getBillingcrelatedtoCP(customerProgram.id);
        ECOB_CloneBillingSpecsAccessor.pullSOsByBSpecId(bspecids);
        ECOB_CloneBillingSpecsAccessor.pullToProgramServiceOfferings(pathidset);
        ECOB_CloneBillingSpecsAccessor.getallsomaps(lstCBST);
        ECOB_CloneBillingSpecsAccessor.SOsInAPlan(lstServOffer);
        ECOB_CloneBillingSpecsAccessor.plansInAPackage(pathidset);
        ECOB_CloneBillingSpecsAccessor.createbillingspecstemplates(lstCBST);
        ECOB_CloneBillingSpecsAccessor.createbillingspecsSomaps(lstcbsSOmap);
        ECOB_CloneBillingSpecsAccessor.getHNSProduct('Service');
        ECOB_CloneBillingSpecsAccessor.getHNSProductbyID(lstHnsProds[0].id);
        ECOB_CloneBillingSpecsAccessor.getallrecordtypes();
        ECOB_CloneBillingSpecsAccessor.getSOmappings('customerBillingSpecs');
        ECOB_CloneBillingSpecsAccessor.billSpecSoInsert(lstCBST[1],lstcbsSOmap,listOfCBSpecExtraParams);
        ECOB_CloneBillingSpecsAccessor.billSpecSoUpdate(lstCBST[1],lstcbsSOmap,listOfCBSpecExtraParams1);
        ECOB_CloneBillingSpecsAccessor.upsertsomap(lstcbsSOmap[0],lstcbsSOmap);
        ECOB_CloneBillingSpecsAccessor.getallsomappings(idsets);
        ECOB_CloneBillingSpecsAccessor.getCProdById(custProdList[0].id);
        ECOB_CloneBillingSpecsAccessor.Get_All_Accounts(rectypid);
        ECOB_CloneBillingSpecsAccessor.Get_SelAcct_rectype(lstAccount[0].id);
        ECOB_CloneBillingSpecsAccessor.Get_All_Accounts_On_RecType(acc1RT);
        ECOB_CloneBillingSpecsAccessor.getCPServicePlans(cpidsets);
        ECOB_CloneBillingSpecsAccessor.compareMultipleStringValues('qwerty','asdfg');
        ECOB_CloneBillingSpecsAccessor.compareTypeWithSubType('john - sena','ram - sam'); 
        ECOB_CloneBillingSpecsAccessor.getMasterAttribute(lstAccount[0].id);
        Test.stopTest();
    }
    
    static testMethod void myUnitTest1(){
        List<Account> lstAccount = [select id,name,CBC_ID__c,Default_Gateway__c,Primary_Contact__r.LastName,recordTypeID,DSL_Phone__c,Record_Type_Name__c,Override_Install_Address__c,ShippingLatitude,ShippingLongitude,HNS_Location_ID_Auto_Gen__c,Program_Code__c,BYOB_IP_Address__c,Customer_Location_ID__c,BillingStreet,BillingCity,BillingState,BillingPostalCode,BillingCountry,parentId,parent.parentId,parent.recordTypeId,Parent.Record_Type_Name__c,Parent.BillingStreet,Parent.BillingCity,Parent.BillingState,Parent.BillingPostalCode,Parent.BillingCountry,ShippingStreet,ShippingCity,ShippingState,ShippingCountry,ShippingPostalCode,Subnet_Mask__c,Static_IP_Address_Hughes_router__c,Primary_Contact__c from Account];
        List<Product_Grouping__c> lstPrGrping = [select id, name from Product_Grouping__c];
        List<HNS_Products__c> lstHnsProds = [select id, name, Product_Category__c, Product_Code__c, Product_Grouping_Name__c, Product_Type__c from HNS_Products__c];
        List<Program__c> customerProgram2 = new List<Program__c>([Select id,Name, DSS_Program_Code__c,Status__c , (Select id, Name from Cust_Billing_Spec_Templates__r) From Program__c where Brand_LE_Account__c=:lstAccount[0].id AND Status__c = 'Active' ORDER By Name ASC]);
        List<Customer_BluePrint__c> cblist = [Select id, Name, Rule_Type__c, Dependent_On_Options__c, Product__c, Is_Active__c, Required__c, Dependent_On_product_Level_Value__c, Dependent_On_product_level__c  From Customer_BluePrint__c];
        List<Order_Reference__c> lstOrdRef = [select id, name,Asset_Status__c from Order_Reference__c];
        List<Customer_Product__c> custProdList = [select id, name, Product__r.Product_code__c, Product__r.Product_Type__c, Product__r.Product_Grouping__c, Product__r.Product_Grouping__r.Name, Product__r.Product_Family__c from Customer_Product__c];
        List<Package__c> lstPackage = [Select id, Name, Is_Active__c From Package__c];
        List<Service_Offerings__c> lstServOffer = [Select id, Name, Is_Active__c From Service_Offerings__c]; 
        List<Customer_Billing_Spec_Template__c> lstCBST = [select id, name, Max_Quantity__c, Adapter_Model__c, Billing_Category__c, User_Defined_Customer_Billing_Spec_Name__c, Min_Quantity__c, HAN_Type__c, Service_Commitment_Term__c, Customer_Store_Configuration__c, Installation_Type__c, Install_State__c, Install_Support__c, Install_Country__c, Transport_Name__c, Remote_Maintenance__c, Help_Desk_Support_Level__c, Lease_Purchase__c, Lease_Term__c, VSAT_Antenna__c, NapSource_NapSubType_NEP__c, DSS_Program_Name__c,DSS_Package_Name__r.Name, Product_Code__c, OrderType_OrderSubType_NEP__c,(select id, name,Customer_Billing_Spec__c,Include_in_Franchisee_Cust_Quote__c,DSS_Plan_Name__r.Name from Customer_Billing_Spec_SOMaps__r) from Customer_Billing_Spec_Template__c];
        List<Customer_Billing_Spec_SOMap__c> lstcbsSOmap = [select id, name, DSS_Plan_Name__r.Name, Customer_Billing_Spec__c,Include_in_Franchisee_Cust_Quote__c from Customer_Billing_Spec_SOMap__c];
        List<ECOB_DuplicateBillingSpecCheck__c> lstDupBilSpChck = [Select id, Name, Duplicate_Check__c From ECOB_DuplicateBillingSpecCheck__c];
        List<Plans_in_Package__c> listPIP = [select id, Name, Package__c, Plan__c from Plans_in_Package__c];
        List<Plan__c> listPlan = [select id, Name, Plan_Type__c, Is_Active__c from Plan__c];
        List<Service_Offerings_in_this_Plan__c> listSOTP = [select id, Name, recordTypeId, Plan__c, Service_Offerings__c from Service_Offerings_in_this_Plan__c];
        List<HNS_Product_Service_Plan__c> listHPSP = [select id, Name, HNS_Product__c from HNS_Product_Service_Plan__c];
        List<Customer_Product_Service_Plan__c> cpspList = [select id , Name, Customer_Product__c, HNS_Product_Service_Plan__c from Customer_Product_Service_Plan__c];
        Program__c customerProgram = [select id, Name, Charging_Rule__c, GL_Segment__c, Brand_LE_Account__c, Status__c, DSS_Program_Code__c, DSS_Program_Name__c from Program__c where Name = 'Test Program' Limit 1];
        List<Cust_Billing_Spec_Extra_Parameter__c> listOfCBSpecExtraParams = [Select Id,Customer_Billing_Spec_Template__c,Parameter_Name__c,Parameter_Value__c from Cust_Billing_Spec_Extra_Parameter__c];
        List<Cust_Billing_Spec_Extra_Parameter__c> listOfCBSpecExtraParams1 = new List<Cust_Billing_Spec_Extra_Parameter__c>();
        
        Id acc1RT = Schema.SObjectType.Account.getRecordTypeInfosByDeveloperName().get(Label.ECOB_Account_Developer_Name_LE).getRecordTypeId();
        Id accRT = Schema.SObjectType.Account.getRecordTypeInfosByDeveloperName().get(Label.ECOB_DeveloperNameRecordTypeForLocation).getRecordTypeId();
        
        Set<id> rectypid = new Set<id>();
        rectypid.add(acc1RT);
        rectypid.add(accRT);
        
        Set<id> cpidsets = new Set<id>();
        for(Customer_Product__c cprod : custProdList){
            cpidsets.add(cprod.id);
        }
        System.assert(cpidsets != null);

        Set<id> idsets = new Set<id>();
        for(Service_Offerings__c svcoffr : lstServOffer){
            idsets.add(svcoffr.id);
        }
        
        Set<String> pathidset = new Set<String>();
        pathidset.add('A-B-C');
        pathidset.add('D-E-F');
        pathidset.add('Test1-B-C');
        
        Set<String> planIds = New Set<String>();
        planIds.add(listPIP[0].Plan__c);
        
        Map<String, Customer_Product__c> customerProductsByProductCode = new Map<String, Customer_Product__c>();
        customerProductsByProductCode.put(lstCBST[0].id, custProdList[0]);
        Map<String, String> productCodesByBillSpecId = New Map<String, String>();
        productCodesByBillSpecId.put(lstCBST[0].Id, lstCBST[0].Product_Code__c);
        
        Set<id> bspecids = new Set<id>();
        
        for(Customer_Billing_Spec_Template__c bspec : lstCBST){
            bspecids.add(bspec.id);
        }
        
        Map<String, List<Customer_Product_Service_Plan__c>> cpServicePlans = new Map<String, List<Customer_Product_Service_Plan__c>>();
        cpServicePlans.put('Test', cpspList);
        Customer_Billing_Spec_Template__c cbspec=[Select id,(Select id,Customer_Billing_Spec__c from Customer_Billing_Spec_SOMaps__r) From Customer_Billing_Spec_Template__c where id =: lstCBST[0].id];
        ECOB_Clone_Limit__c cloneLimit = new ECOB_Clone_Limit__c();
        cloneLimit.Clone_Limit__c='1';
        cloneLimit.Name='Customer_Billing_Spec_Template__c';
        insert cloneLimit;
        
        PageReference myPage=Page.ECOB_CloneBillingSpecs;
        Test.setCurrentpage(myPage); 
        ApexPages.currentPage().getParameters().put('accid',lstAccount[0].id);

        Test.startTest();
        ECOB_CloneBillingSpecsAccessor clonebilingacces = new ECOB_CloneBillingSpecsAccessor();
        ECOB_CloneBillingSpecsAccessor.getallcustomerprogram(lstAccount[0].id);
        ECOB_CloneBillingSpecsAccessor.getallbillingspecs(lstAccount[0].id);
        ECOB_CloneBillingSpecsAccessor.getproductcrelatedtoCP(customerProgram.id);
        ECOB_CloneBillingSpecsAccessor.getBillingcrelatedtoCP(customerProgram.id);
        ECOB_CloneBillingSpecsAccessor.pullSOsByBSpecId(bspecids);
        ECOB_CloneBillingSpecsAccessor.pullToProgramServiceOfferings(pathidset);
        ECOB_CloneBillingSpecsAccessor.getallsomaps(lstCBST);
        ECOB_CloneBillingSpecsAccessor.SOsInAPlan(lstServOffer);
        ECOB_CloneBillingSpecsAccessor.plansInAPackage(pathidset);
        ECOB_CloneBillingSpecsAccessor.createbillingspecstemplates(lstCBST);
        ECOB_CloneBillingSpecsAccessor.createbillingspecsSomaps(lstcbsSOmap);
        ECOB_CloneBillingSpecsAccessor.getHNSProduct('Service');
        ECOB_CloneBillingSpecsAccessor.getHNSProductbyID(lstHnsProds[0].id);
        ECOB_CloneBillingSpecsAccessor.getallrecordtypes();
        ECOB_CloneBillingSpecsAccessor.getSOmappings('customerBillingSpecs');
        ECOB_CloneBillingSpecsAccessor.billSpecSoInsert(lstCBST[1],lstcbsSOmap,listOfCBSpecExtraParams);
        ECOB_CloneBillingSpecsAccessor.billSpecSoUpdate(lstCBST[1],lstcbsSOmap,listOfCBSpecExtraParams1);
        ECOB_CloneBillingSpecsAccessor.upsertsomap(lstcbsSOmap[0],lstcbsSOmap);
        ECOB_CloneBillingSpecsAccessor.getallsomappings(idsets);
        ECOB_CloneBillingSpecsAccessor.getCProdById(custProdList[0].id);
        ECOB_CloneBillingSpecsAccessor.Get_All_Accounts(rectypid);
        ECOB_CloneBillingSpecsAccessor.Get_SelAcct_rectype(lstAccount[0].id);
        ECOB_CloneBillingSpecsAccessor.Get_All_Accounts_On_RecType(acc1RT);
        ECOB_CloneBillingSpecsAccessor.getCPServicePlans(cpidsets);
        ECOB_CloneBillingSpecsAccessor.compareMultipleStringValues('','');
        ECOB_CloneBillingSpecsAccessor.compareTypeWithSubType('john : sena','ram : sam');    
        Test.stopTest();
    }
}