• srinu namani 12
  • NEWBIE
  • 15 Points
  • Member since 2015

  • Chatter
    Feed
  • 0
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 9
    Questions
  • 4
    Replies
global  class TerritoryAssignmentWebService {
    public static boolean isRecursive = false;

    @future(callout=true)
    global static void invokeTerritoryAssignmentRules(Set<Id> accountIds, String sessionId, Map<Id,String> accountAssignedTerrMap){
        isRecursive = true;
        try{
        system.debug('accountAssignedTerrMap Print>>>'+accountAssignedTerrMap);
        system.debug('accountIds Print>>>'+accountIds);
        HttpRequest req = new HttpRequest(); 
        //Set HTTPRequest Method
        req.setMethod('POST');
        //Set HTTPRequest header properties
        req.setHeader('content-type', 'text/xml');
        req.setHeader('SOAPAction','""');
        req.setEndpoint(Label.SFDC_Webservice_Endpoint);
        String sobjectUpdateString = '';
        FieldSalesProperties__c fsprops =  FieldSalesProperties__c.getValues('IsRecursive');
        if(fsprops!=null && fsprops.value__c=='False'){
          if(accountIds!=null){
              for(Id accId : accountIds){
                   sobjectUpdateString +=  '<urn:sObjects  xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:type="Account">'
                                              + '<urn1:Id>' + accId + '</urn1:Id>'
                                           + '</urn:sObjects>';
                                       
              }
          }else if(accountAssignedTerrMap!=null){
           system.debug('>>Inside else if'+accountAssignedTerrMap);
              for(Id accId: accountAssignedTerrMap.keyset()){
                  sobjectUpdateString +=  '<urn:sObjects  xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:type="Account">'
                                              + '<urn1:Id>' + accId + '</urn1:Id>'
                                              + '<urn1:Assigned_Territories__c>' + accountAssignedTerrMap.get(accId)+ '</urn1:Assigned_Territories__c>'
                                              + '</urn:sObjects>';
              }
              system.debug('fsprops ...'+fsprops);
              sobjectUpdateString +=  '<urn:sObjects  xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:type="FieldSalesProperties__c">'
                                              + '<urn1:Id>' + fsprops.Id+ '</urn1:Id>'
                                              + '<urn1:Value__c>True</urn1:Value__c>'
                                              + '</urn:sObjects>';
          
          }
          
        }
        
        //Preapre SOAP envelope
        String body = '<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:urn="urn:enterprise.soap.sforce.com" '
                                + 'xmlns:urn1="urn:sobject.enterprise.soap.sforce.com">'
                         + '<soapenv:Header>'
                             + '<urn:AssignmentRuleHeader>'
                                + '<urn:useDefaultRule>true</urn:useDefaultRule>'
                              + '</urn:AssignmentRuleHeader>'
                              + '<urn:SessionHeader>'
                                 + '<urn:sessionId>' + sessionId + '</urn:sessionId>'
                              + '</urn:SessionHeader>'
                         + '</soapenv:Header>'
                         + '<soapenv:Body>'
                              + '<urn:update>'
                                 + sobjectUpdateString
                               + '</urn:update>'
                         + '</soapenv:Body>'
                      + '</soapenv:Envelope>';
    
        //Set the HTTPRequest body
        system.debug('>>>> Value'+fsprops.value__c);
        if(fsprops !=null && fsprops.value__c=='False'){
        req.setBody(body);
        Http http = new Http();
        HTTPResponse res;
        //Execute web service call here 
        system.debug('>>>>SobjString'+body );
        System.debug('userinfo:'+Userinfo.getUserId());
        System.debug('sessionId:'+UserInfo.getSessionId()); 
        if (!Test.isRunningTest())
            res = http.send(req);
        }else{
            fsprops.value__c = 'False';
            update     fsprops;
        }
       /** System.debug(res.toString());
        System.debug('STATUS:'+body);
        System.debug('STATUS:'+res.getStatus());
        System.debug('STATUS_CODE:'+res.getStatusCode());
        System.debug('STATUS_CODE:'+res.getBody());*/
        }catch(Exception e){
            ApplicationDebugLog.captureExceptionDetails(e);
        }
    } 
    
}
I am trying to pass values to a master detail field in my Test Class. I tried to pass values as I do for normal fields, but it is throwing Error.

Can any one suggest me how can i do this
This is my Class and you can see the test class I have written for this but covering only 50%.

public class OverrideNewButtonComponentController {
    Public string sObjectType {get; set;}
    Public string keyPrefix {get; set;}
    Public string infoProLabel {get; set;}
    Public string infoProLawonLabel {get; set;}
    
    List<Line_of_Business__c > listInfoProLawson = new List<Line_of_Business__c >();
    public OverrideNewButtonComponentController(String sobjectName, String objPrefix) {
        sObjectType=sobjectName;
        keyPrefix=objPrefix;
    }
    public OverrideNewButtonComponentController(){}

    public PageReference init() {
           
          if (ApexPages.currentPage().getParameters().get('RecordType') == null) {
          Schema.DescribeSObjectResult describeLead = Schema.SObjectType.Lead;
          List<Schema.RecordTypeInfo> rtInfos = describeLead.getRecordTypeInfos();
          for(Schema.RecordTypeInfo rtInfo : rtInfos) {
            if(rtInfo.getName() != 'Master' && rtInfo.isAvailable()) {
            ApexPages.currentPage().getParameters().put('RecordType', rtInfo.getRecordTypeId());
           }
          }
          
         }

        String userLawson = String.Valueof([Select id, Lawson_Division__c from User where id = : Userinfo.getUSerId()].Lawson_Division__c);




        if (userLawson != null) {
            listInfoProLawson = [SELECT Id, Name, Lawson_Division__c, Infopro_Division__r.Name from Line_of_Business__c where Lawson_Division__r.Name = :userLawson];
            system.debug('sObjectType==' + sObjectType);
            if (listInfoProLawson.size() >= 1 && listInfoProLawson.get(0).Name != null && listInfoProLawson.get(0).Infopro_Division__r.Name != null) {
                String labelVal ;
                if(sObjectType=='Opportunity')
                    labelVal = System.Label.OpportunityNewButtonOverRideLabel;
                else if(sObjectType=='Lead')
                    labelVal= System.Label.LeadNewButtonOverRideLabel;
                labelVal = labelVal.trim();
                List<String> labels = labelVal.split(',');
                System.debug('labels==' + labels);
                infoProLawonLabel = labels.get(0).trim();
                infoProLabel = labels.get(1).trim();
                System.debug(sObjectType+'sObjectTypes---');

                //return new PageReference('/setup/ui/recordtypeselect.jsp?ent=' + sObjectType + '&nooverride=1&retURL=%2F'+keyPrefix+'%2Fo&save_new_url=%2F'+keyPrefix+'%2Fe%3FretURL%3D%252F'+keyPrefix+'%252Fo&' + infoProLawonLabel + '=' + listInfoProLawson.get(0).Name + '&' + infoProLawonLabel + '_lkid=' + listInfoProLawson.get(0).Id + '&' + infoProLabel + '=' + listInfoProLawson.get(0).Infopro_Division__r.Name);
                if(sObjectType=='Lead' && (ApexPages.currentPage().getParameters().get('RecordType') == Schema.SObjectType.Lead.getRecordTypeInfosByName().get('Field Sales Lead').getRecordTypeId() || ApexPages.currentPage().getParameters().get('RecordType') == Schema.SObjectType.Lead.getRecordTypeInfosByName().get('Refer Republic Lead').getRecordTypeId())){
                    Pagereference page = new PageReference('/'+keyPrefix+'/e?nooverride=1&retURL=%2F'+keyPrefix+'%2Fo&save_new_url=%2F'+keyPrefix+'%2Fe%3FretURL%3D%252F'+keyPrefix+'%252Fo&' + infoProLawonLabel + '=' + listInfoProLawson.get(0).Name + '&' + infoProLawonLabel + '_lkid=' + listInfoProLawson.get(0).Id + '&' + infoProLabel + '=' + listInfoProLawson.get(0).Infopro_Division__r.Name + '&lea16country=USA');
                    //page.setRedirect(true);
                    return page;
                }
                else if(sObjectType=='Opportunity' && (ApexPages.currentPage().getParameters().get('RecordType') == Schema.SObjectType.Opportunity.getRecordTypeInfosByName().get('Field Sales Opportunity').getRecordTypeId())){
                System.debug(sObjectType+'inside sObjectTypes---');
                    Pagereference page = new PageReference('/'+keyPrefix+'/e?nooverride=1&retURL=%2F'+keyPrefix+'%2Fo&save_new_url=%2F'+keyPrefix+'%2Fe%3FretURL%3D%252F'+keyPrefix+'%252Fo&' + infoProLawonLabel + '=' + listInfoProLawson.get(0).Name + '&' + infoProLawonLabel + '_lkid=' + listInfoProLawson.get(0).Id + '&' + infoProLabel + '=' + listInfoProLawson.get(0).Infopro_Division__r.Name);
                    //page.setRedirect(true);
                    return page;
                }
                return new PageReference('/'+keyPrefix+'/e?nooverride=1&retURL=%2F'+keyPrefix+'%2Fo&save_new_url=%2F'+keyPrefix+'%2Fe%3FretURL%3D%252F'+keyPrefix+'%252Fo&' + infoProLawonLabel + '=' + listInfoProLawson.get(0).Name + '&' + infoProLawonLabel + '_lkid=' + listInfoProLawson.get(0).Id + '&' + infoProLabel + '=' + listInfoProLawson.get(0).Infopro_Division__r.Name + '&RecordType='+ApexPages.currentPage().getParameters().get('RecordType'));
            }
        }

            //return new PageReference('/setup/ui/recordtypeselect.jsp?ent=' + sObjectType + '&nooverride=1&retURL=%2F'+keyPrefix+'%2Fo&save_new_url=%2F'+keyPrefix+'%2Fe%3FretURL%3D%252F'+keyPrefix+'%252Fo');
        if(sObjectType=='Lead' && (ApexPages.currentPage().getParameters().get('RecordType') == Schema.SObjectType.Lead.getRecordTypeInfosByName().get('Field Sales Lead').getRecordTypeId() || ApexPages.currentPage().getParameters().get('RecordType') == Schema.SObjectType.Lead.getRecordTypeInfosByName().get('Refer Republic Lead').getRecordTypeId())){
            return new PageReference('/'+keyPrefix+'/e?nooverride=1&retURL=%2F'+keyPrefix+'%2Fo&save_new_url=%2F'+keyPrefix+'%2Fe%3FretURL%3D%252F'+keyPrefix+'%252Fo&lea16country=USA&RecordType='+ApexPages.currentPage().getParameters().get('RecordType'));
        }
        else if(sObjectType=='Opportunity' && (ApexPages.currentPage().getParameters().get('RecordType') == Schema.SObjectType.Opportunity.getRecordTypeInfosByName().get('Field Sales Opportunity').getRecordTypeId())){
            return new PageReference('/'+keyPrefix+'/e?nooverride=1&retURL=%2F'+keyPrefix+'%2Fo&save_new_url=%2F'+keyPrefix+'%2Fe%3FretURL%3D%252F'+keyPrefix+'%252Fo');
        }
        else if(sObjectType=='Lead' && (ApexPages.currentPage().getParameters().get('RecordType') == Schema.SObjectType.Lead.getRecordTypeInfosByName().get('Special Waste Leads').getRecordTypeId())){
           return new PageReference('/apex/SPWLead?ent=Lead&RecordType='+ApexPages.currentPage().getParameters().get('RecordType')+'&retURL=SPWLead&save_new_url=00Q/e');
        }    
        return new PageReference('/'+keyPrefix+'/e?nooverride=1&retURL=%2F'+keyPrefix+'%2Fo&save_new_url=%2F'+keyPrefix+'%2Fe%3FretURL%3D%252F'+keyPrefix+'%252Fo&RecordType='+ApexPages.currentPage().getParameters().get('RecordType'));
    }


}




Here is the test class I have written.


@istest private class TestOverrideNewButtonComponentController { Static testmethod void OverrideNewButtonComponentController() { OverrideNewButtonComponentController ride = new OverrideNewButtonComponentController();  ride.init(); OverrideNewButtonComponentController controller = new OverrideNewButtonComponentController();      String sbjname='Lead';       String  sbjprefix='00Q';              List<Line_of_Business__c > lst = new List<Line_of_Business__c >(); Line_of_Business__c  lb1=new Line_of_Business__c(); Lawson_Division__c   ld1 = new Lawson_Division__c(); Infopro_Division__c  id1 = new Infopro_Division__c(); Profile p = [SELECT Id FROM Profile WHERE Name='field sales']; User u = new User(Alias = 'standt1', Email='standarduser1@testorg.com', EmailEncodingKey='UTF-8', LastName='Testing', LanguageLocaleKey='en_US', LocaleSidKey='en_US', ProfileId = p.Id, TimeZoneSidKey='America/Los_Angeles', UserName='myorg1@testorg.com'); System.runAs(u) { ld1.name = 'test'; insert ld1; id1.name = 'testinfo'; insert id1; lb1.name = 'testLawson'; //lb1.Infopro_Division__c = 'testinfo1'; //lb1.Lawson_Division__c = 'test1'; //insert lb1; } } //user U = new user (  }


Please help me in covering the full class.


global  class TerritoryAssignmentWebService {
    public static boolean isRecursive = false;

    @future(callout=true)
    global static void invokeTerritoryAssignmentRules(Set<Id> accountIds, String sessionId, Map<Id,String> accountAssignedTerrMap){
        isRecursive = true;
        try{
        system.debug('accountAssignedTerrMap Print>>>'+accountAssignedTerrMap);
        system.debug('accountIds Print>>>'+accountIds);
        HttpRequest req = new HttpRequest(); 
        //Set HTTPRequest Method
        req.setMethod('POST');
        //Set HTTPRequest header properties
        req.setHeader('content-type', 'text/xml');
        req.setHeader('SOAPAction','""');
        req.setEndpoint(Label.SFDC_Webservice_Endpoint);
        String sobjectUpdateString = '';
        FieldSalesProperties__c fsprops =  FieldSalesProperties__c.getValues('IsRecursive');
        if(fsprops!=null && fsprops.value__c=='False'){
          if(accountIds!=null){
              for(Id accId : accountIds){
                   sobjectUpdateString +=  '<urn:sObjects  xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:type="Account">'
                                              + '<urn1:Id>' + accId + '</urn1:Id>'
                                           + '</urn:sObjects>';
                                       
              }
          }else if(accountAssignedTerrMap!=null){
           system.debug('>>Inside else if'+accountAssignedTerrMap);
              for(Id accId: accountAssignedTerrMap.keyset()){
                  sobjectUpdateString +=  '<urn:sObjects  xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:type="Account">'
                                              + '<urn1:Id>' + accId + '</urn1:Id>'
                                              + '<urn1:Assigned_Territories__c>' + accountAssignedTerrMap.get(accId)+ '</urn1:Assigned_Territories__c>'
                                              + '</urn:sObjects>';
              }
              system.debug('fsprops ...'+fsprops);
              sobjectUpdateString +=  '<urn:sObjects  xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:type="FieldSalesProperties__c">'
                                              + '<urn1:Id>' + fsprops.Id+ '</urn1:Id>'
                                              + '<urn1:Value__c>True</urn1:Value__c>'
                                              + '</urn:sObjects>';
          
          }
          
        }
        
        //Preapre SOAP envelope
        String body = '<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:urn="urn:enterprise.soap.sforce.com" '
                                + 'xmlns:urn1="urn:sobject.enterprise.soap.sforce.com">'
                         + '<soapenv:Header>'
                             + '<urn:AssignmentRuleHeader>'
                                + '<urn:useDefaultRule>true</urn:useDefaultRule>'
                              + '</urn:AssignmentRuleHeader>'
                              + '<urn:SessionHeader>'
                                 + '<urn:sessionId>' + sessionId + '</urn:sessionId>'
                              + '</urn:SessionHeader>'
                         + '</soapenv:Header>'
                         + '<soapenv:Body>'
                              + '<urn:update>'
                                 + sobjectUpdateString
                               + '</urn:update>'
                         + '</soapenv:Body>'
                      + '</soapenv:Envelope>';
    
        //Set the HTTPRequest body
        system.debug('>>>> Value'+fsprops.value__c);
        if(fsprops !=null && fsprops.value__c=='False'){
        req.setBody(body);
        Http http = new Http();
        HTTPResponse res;
        //Execute web service call here 
        system.debug('>>>>SobjString'+body );
        System.debug('userinfo:'+Userinfo.getUserId());
        System.debug('sessionId:'+UserInfo.getSessionId()); 
        if (!Test.isRunningTest())
            res = http.send(req);
        }else{
            fsprops.value__c = 'False';
            update     fsprops;
        }
       /** System.debug(res.toString());
        System.debug('STATUS:'+body);
        System.debug('STATUS:'+res.getStatus());
        System.debug('STATUS_CODE:'+res.getStatusCode());
        System.debug('STATUS_CODE:'+res.getBody());*/
        }catch(Exception e){
            ApplicationDebugLog.captureExceptionDetails(e);
        }
    } 
    
}
//Generated by wsdl2apex

public class InformaticaAddressBulkVerification {
    public class NEWOUTPUT_element {
        public String ID;
        public String AddressLine1;
        public String AddressLine2;
        public String AddressLine3;
        public String City;
        public String State;
        public String PostalCode;
        public String PostalCodeSuffix;
        public String Country;
        public String County;
        public String AddressHashID;
        public String MailabilityScore;
        public String MatchCode;
        public String Latitude;
        public String Longitude;
        public String GeoCodeStatus;
        private String[] ID_type_info = new String[]{'ID','http://www.informatica.com/dis/ws/',null,'0','1','false'};
        private String[] AddressLine1_type_info = new String[]{'AddressLine1','http://www.informatica.com/dis/ws/',null,'0','1','false'};
        private String[] AddressLine2_type_info = new String[]{'AddressLine2','http://www.informatica.com/dis/ws/',null,'0','1','false'};
        private String[] AddressLine3_type_info = new String[]{'AddressLine3','http://www.informatica.com/dis/ws/',null,'0','1','false'};
        private String[] City_type_info = new String[]{'City','http://www.informatica.com/dis/ws/',null,'0','1','false'};
        private String[] State_type_info = new String[]{'State','http://www.informatica.com/dis/ws/',null,'0','1','false'};
        private String[] PostalCode_type_info = new String[]{'PostalCode','http://www.informatica.com/dis/ws/',null,'0','1','false'};
        private String[] PostalCodeSuffix_type_info = new String[]{'PostalCodeSuffix','http://www.informatica.com/dis/ws/',null,'0','1','false'};
        private String[] Country_type_info = new String[]{'Country','http://www.informatica.com/dis/ws/',null,'0','1','false'};
        private String[] County_type_info = new String[]{'County','http://www.informatica.com/dis/ws/',null,'0','1','false'};
        private String[] AddressHashID_type_info = new String[]{'AddressHashID','http://www.informatica.com/dis/ws/',null,'0','1','false'};
        private String[] MailabilityScore_type_info = new String[]{'MailabilityScore','http://www.informatica.com/dis/ws/',null,'0','1','false'};
        private String[] MatchCode_type_info = new String[]{'MatchCode','http://www.informatica.com/dis/ws/',null,'0','1','false'};
        private String[] Latitude_type_info = new String[]{'Latitude','http://www.informatica.com/dis/ws/',null,'0','1','false'};
        private String[] Longitude_type_info = new String[]{'Longitude','http://www.informatica.com/dis/ws/',null,'0','1','false'};
        private String[] GeoCodeStatus_type_info = new String[]{'GeoCodeStatus','http://www.informatica.com/dis/ws/',null,'0','1','false'};
        private String[] apex_schema_type_info = new String[]{'http://www.informatica.com/dis/ws/','true','false'};
        private String[] field_order_type_info = new String[]{'ID','AddressLine1','AddressLine2','AddressLine3','City','State','PostalCode','PostalCodeSuffix','Country','County','AddressHashID','MailabilityScore','MatchCode','Latitude','Longitude','GeoCodeStatus'};
    }
    public class Group_element {
        public String ID;
        public String AddressLine1;
        public String AddressLine2;
        public String AddressLine3;
        public String City;
        public String State;
        public String PostalCode;
        public String Country;
        private String[] ID_type_info = new String[]{'ID','http://www.informatica.com/dis/ws/',null,'0','1','false'};
        private String[] AddressLine1_type_info = new String[]{'AddressLine1','http://www.informatica.com/dis/ws/',null,'0','1','false'};
        private String[] AddressLine2_type_info = new String[]{'AddressLine2','http://www.informatica.com/dis/ws/',null,'0','1','false'};
        private String[] AddressLine3_type_info = new String[]{'AddressLine3','http://www.informatica.com/dis/ws/',null,'0','1','false'};
        private String[] City_type_info = new String[]{'City','http://www.informatica.com/dis/ws/',null,'0','1','false'};
        private String[] State_type_info = new String[]{'State','http://www.informatica.com/dis/ws/',null,'0','1','false'};
        private String[] PostalCode_type_info = new String[]{'PostalCode','http://www.informatica.com/dis/ws/',null,'0','1','false'};
        private String[] Country_type_info = new String[]{'Country','http://www.informatica.com/dis/ws/',null,'0','1','false'};
        private String[] apex_schema_type_info = new String[]{'http://www.informatica.com/dis/ws/','true','false'};
        private String[] field_order_type_info = new String[]{'ID','AddressLine1','AddressLine2','AddressLine3','City','State','PostalCode','Country'};
    }
    public class mplt_AddressValidation_OperationResponse_element {
        public InformaticaAddressBulkVerification.NEWOUTPUT_element[] NEWOUTPUT;
        private String[] NEWOUTPUT_type_info = new String[]{'NEWOUTPUT','http://www.informatica.com/dis/ws/',null,'0','-1','false'};
        private String[] apex_schema_type_info = new String[]{'http://www.informatica.com/dis/ws/','true','false'};
        private String[] field_order_type_info = new String[]{'NEWOUTPUT'};
    }
    public class mplt_AddressValidation_Operation_element {
        public InformaticaAddressBulkVerification.Group_element[] Group_x;
        private String[] Group_x_type_info = new String[]{'Group','http://www.informatica.com/dis/ws/',null,'0','-1','false'};
        private String[] apex_schema_type_info = new String[]{'http://www.informatica.com/dis/ws/','true','false'};
        private String[] field_order_type_info = new String[]{'Group_x'};
    }
    public class ws_AddressValidation {
        //public String endpoint_x = 'http://DEVINFOMAPP01:9095/DataIntegrationService/WebService/ws_AddressValidation';
        public String endpoint_x = Label.Informatica_Bulk_Verification;
        public Map<String,String> inputHttpHeaders_x;
        public Map<String,String> outputHttpHeaders_x;
        public String clientCertName_x;
        public String clientCert_x;
        public String clientCertPasswd_x;
        public Integer timeout_x;
        private String[] ns_map_type_info = new String[]{'http://www.informatica.com/dis/ws/', 'InformaticaAddressBulkVerification'};
        public InformaticaAddressBulkVerification.NEWOUTPUT_element[] mplt_AddressValidation_Operation(InformaticaAddressBulkVerification.Group_element[] Group_x) {
            InformaticaAddressBulkVerification.mplt_AddressValidation_Operation_element request_x = new InformaticaAddressBulkVerification.mplt_AddressValidation_Operation_element();
            request_x.Group_x = Group_x;
            InformaticaAddressBulkVerification.mplt_AddressValidation_OperationResponse_element response_x;
            Map<String, InformaticaAddressBulkVerification.mplt_AddressValidation_OperationResponse_element> response_map_x = new Map<String, InformaticaAddressBulkVerification.mplt_AddressValidation_OperationResponse_element>();
            response_map_x.put('response_x', response_x);
            WebServiceCallout.invoke(
              this,
              request_x,
              response_map_x,
              new String[]{endpoint_x,
              '',
              'http://www.informatica.com/dis/ws/',
              'mplt_AddressValidation_Operation',
              'http://www.informatica.com/dis/ws/',
              'mplt_AddressValidation_OperationResponse',
              'InformaticaAddressBulkVerification.mplt_AddressValidation_OperationResponse_element'}
            );
            response_x = response_map_x.get('response_x');
            return response_x.NEWOUTPUT;
        }
    }
}
public with sharing class AccountBeforeUpdateTriggerHandler extends TriggerHandlerBase{
    
    //This method is called when trigger is called for the first time. Functionality defined in this function will be executed only once
    public override void mainEntry(){
        changeAccountOwnership();
        if(!CONSTANTS.SICTRANSLATIONLOGIC_TRIGGERED)
     CommonUtility.FS_SICTranslationToGeneralIndustries(Trigger.new);   

    } 
    //When trigger is i
    public override void inProgressEntry(){
        
    }
/*Approval process Final Approval and rejection actions*/
    public void changeAccountOwnership(){
        if(Trigger.new!=null && Trigger.new.size()==1){
            Account oldAcc = (Account) Trigger.old[0];
            Account newAcc = (Account) Trigger.new[0];
            //Case of OwnershipChange : Approved
            if (oldAcc.Change_Owner_Approval_Status__c == 'In Process' &&
            oldAcc.Eligible_for_Owner_Change__c == true &&
            newAcc.Change_Owner_Approval_Status__c == 'Approved'){
                newAcc.OwnerId = oldAcc.Potential_Account_Owner__c;
                newAcc.Eligible_for_Owner_Change__c = false;
                newAcc.Potential_Account_Owner__c = null;
                newAcc.Change_Owner_Approval_Status__c = null;
            }
            //Case : Rejected
            else if(oldAcc.Change_Owner_Approval_Status__c == 'In Process' &&
            oldAcc.Eligible_for_Owner_Change__c == true &&
            newAcc.Change_Owner_Approval_Status__c == 'Rejected'){
                newAcc.Eligible_for_Owner_Change__c = false;
                newAcc.Potential_Account_Owner__c = null;
                newAcc.Change_Owner_Approval_Status__c = null;
            }
        
        }
    }
     

}
I am trying to pass values to a master detail field in my Test Class. I tried to pass values as I do for normal fields, but it is throwing Error.

Can any one suggest me how can i do this
//Generated by wsdl2apex

public class InformaticaAddressBulkVerification {
    public class NEWOUTPUT_element {
        public String ID;
        public String AddressLine1;
        public String AddressLine2;
        public String AddressLine3;
        public String City;
        public String State;
        public String PostalCode;
        public String PostalCodeSuffix;
        public String Country;
        public String County;
        public String AddressHashID;
        public String MailabilityScore;
        public String MatchCode;
        public String Latitude;
        public String Longitude;
        public String GeoCodeStatus;
        private String[] ID_type_info = new String[]{'ID','http://www.informatica.com/dis/ws/',null,'0','1','false'};
        private String[] AddressLine1_type_info = new String[]{'AddressLine1','http://www.informatica.com/dis/ws/',null,'0','1','false'};
        private String[] AddressLine2_type_info = new String[]{'AddressLine2','http://www.informatica.com/dis/ws/',null,'0','1','false'};
        private String[] AddressLine3_type_info = new String[]{'AddressLine3','http://www.informatica.com/dis/ws/',null,'0','1','false'};
        private String[] City_type_info = new String[]{'City','http://www.informatica.com/dis/ws/',null,'0','1','false'};
        private String[] State_type_info = new String[]{'State','http://www.informatica.com/dis/ws/',null,'0','1','false'};
        private String[] PostalCode_type_info = new String[]{'PostalCode','http://www.informatica.com/dis/ws/',null,'0','1','false'};
        private String[] PostalCodeSuffix_type_info = new String[]{'PostalCodeSuffix','http://www.informatica.com/dis/ws/',null,'0','1','false'};
        private String[] Country_type_info = new String[]{'Country','http://www.informatica.com/dis/ws/',null,'0','1','false'};
        private String[] County_type_info = new String[]{'County','http://www.informatica.com/dis/ws/',null,'0','1','false'};
        private String[] AddressHashID_type_info = new String[]{'AddressHashID','http://www.informatica.com/dis/ws/',null,'0','1','false'};
        private String[] MailabilityScore_type_info = new String[]{'MailabilityScore','http://www.informatica.com/dis/ws/',null,'0','1','false'};
        private String[] MatchCode_type_info = new String[]{'MatchCode','http://www.informatica.com/dis/ws/',null,'0','1','false'};
        private String[] Latitude_type_info = new String[]{'Latitude','http://www.informatica.com/dis/ws/',null,'0','1','false'};
        private String[] Longitude_type_info = new String[]{'Longitude','http://www.informatica.com/dis/ws/',null,'0','1','false'};
        private String[] GeoCodeStatus_type_info = new String[]{'GeoCodeStatus','http://www.informatica.com/dis/ws/',null,'0','1','false'};
        private String[] apex_schema_type_info = new String[]{'http://www.informatica.com/dis/ws/','true','false'};
        private String[] field_order_type_info = new String[]{'ID','AddressLine1','AddressLine2','AddressLine3','City','State','PostalCode','PostalCodeSuffix','Country','County','AddressHashID','MailabilityScore','MatchCode','Latitude','Longitude','GeoCodeStatus'};
    }
    public class Group_element {
        public String ID;
        public String AddressLine1;
        public String AddressLine2;
        public String AddressLine3;
        public String City;
        public String State;
        public String PostalCode;
        public String Country;
        private String[] ID_type_info = new String[]{'ID','http://www.informatica.com/dis/ws/',null,'0','1','false'};
        private String[] AddressLine1_type_info = new String[]{'AddressLine1','http://www.informatica.com/dis/ws/',null,'0','1','false'};
        private String[] AddressLine2_type_info = new String[]{'AddressLine2','http://www.informatica.com/dis/ws/',null,'0','1','false'};
        private String[] AddressLine3_type_info = new String[]{'AddressLine3','http://www.informatica.com/dis/ws/',null,'0','1','false'};
        private String[] City_type_info = new String[]{'City','http://www.informatica.com/dis/ws/',null,'0','1','false'};
        private String[] State_type_info = new String[]{'State','http://www.informatica.com/dis/ws/',null,'0','1','false'};
        private String[] PostalCode_type_info = new String[]{'PostalCode','http://www.informatica.com/dis/ws/',null,'0','1','false'};
        private String[] Country_type_info = new String[]{'Country','http://www.informatica.com/dis/ws/',null,'0','1','false'};
        private String[] apex_schema_type_info = new String[]{'http://www.informatica.com/dis/ws/','true','false'};
        private String[] field_order_type_info = new String[]{'ID','AddressLine1','AddressLine2','AddressLine3','City','State','PostalCode','Country'};
    }
    public class mplt_AddressValidation_OperationResponse_element {
        public InformaticaAddressBulkVerification.NEWOUTPUT_element[] NEWOUTPUT;
        private String[] NEWOUTPUT_type_info = new String[]{'NEWOUTPUT','http://www.informatica.com/dis/ws/',null,'0','-1','false'};
        private String[] apex_schema_type_info = new String[]{'http://www.informatica.com/dis/ws/','true','false'};
        private String[] field_order_type_info = new String[]{'NEWOUTPUT'};
    }
    public class mplt_AddressValidation_Operation_element {
        public InformaticaAddressBulkVerification.Group_element[] Group_x;
        private String[] Group_x_type_info = new String[]{'Group','http://www.informatica.com/dis/ws/',null,'0','-1','false'};
        private String[] apex_schema_type_info = new String[]{'http://www.informatica.com/dis/ws/','true','false'};
        private String[] field_order_type_info = new String[]{'Group_x'};
    }
    public class ws_AddressValidation {
        //public String endpoint_x = 'http://DEVINFOMAPP01:9095/DataIntegrationService/WebService/ws_AddressValidation';
        public String endpoint_x = Label.Informatica_Bulk_Verification;
        public Map<String,String> inputHttpHeaders_x;
        public Map<String,String> outputHttpHeaders_x;
        public String clientCertName_x;
        public String clientCert_x;
        public String clientCertPasswd_x;
        public Integer timeout_x;
        private String[] ns_map_type_info = new String[]{'http://www.informatica.com/dis/ws/', 'InformaticaAddressBulkVerification'};
        public InformaticaAddressBulkVerification.NEWOUTPUT_element[] mplt_AddressValidation_Operation(InformaticaAddressBulkVerification.Group_element[] Group_x) {
            InformaticaAddressBulkVerification.mplt_AddressValidation_Operation_element request_x = new InformaticaAddressBulkVerification.mplt_AddressValidation_Operation_element();
            request_x.Group_x = Group_x;
            InformaticaAddressBulkVerification.mplt_AddressValidation_OperationResponse_element response_x;
            Map<String, InformaticaAddressBulkVerification.mplt_AddressValidation_OperationResponse_element> response_map_x = new Map<String, InformaticaAddressBulkVerification.mplt_AddressValidation_OperationResponse_element>();
            response_map_x.put('response_x', response_x);
            WebServiceCallout.invoke(
              this,
              request_x,
              response_map_x,
              new String[]{endpoint_x,
              '',
              'http://www.informatica.com/dis/ws/',
              'mplt_AddressValidation_Operation',
              'http://www.informatica.com/dis/ws/',
              'mplt_AddressValidation_OperationResponse',
              'InformaticaAddressBulkVerification.mplt_AddressValidation_OperationResponse_element'}
            );
            response_x = response_map_x.get('response_x');
            return response_x.NEWOUTPUT;
        }
    }
}