+ Start a Discussion
test777test777 

covering test coverage for xml stream reade class in apex class

Hi all,

    I want to cover the test coverage for 

public string readXMLResponse(XmlStreamReader reader) {   string retValue; // Read through the XML  while(reader.hasNext())  {    if (reader.getEventType() == XmlTag.START_ELEMENT)    {            if (reader.getLocalName() == 'TransactionDateTime')       {        reader.next();        if (reader.getEventType() == XmlTag.characters)       {          dssTransactionDateTime = reader.getText();       }       }       if (reader.getLocalName() == 'TransactionCode')       {        reader.next();        if (reader.getEventType() == XmlTag.characters)       {          dssTransactionCode= reader.getText();       }       }       if (reader.getLocalName() == 'TransactionSequenceId')       {        reader.next();        if (reader.getEventType() == XmlTag.characters)       {          dssTransactionSequenceId= reader.getText();                   }       }         if (reader.getLocalName() == 'CustomerId')       {        reader.next();        if (reader.getEventType() == XmlTag.characters)       {          dssCustomerId= reader.getText();        Account acc=[select id,Dss_Customer_Id__c,Account_Customer_ID__c from account where id=:accountid limit 1];         acc.Dss_Customer_Id__c=dssCustomerId;         acc.Account_Customer_ID__c=dssCustomerId;         update acc;                 }       }        if (reader.getLocalName() == 'CorrelationTransactionId')       {        reader.next();        system.debug('%%%%%%%%%%%%%%%%');        if (reader.getEventType() == XmlTag.characters)       {          dssCorrelationTransactionId= reader.getText();                   Order_Line_Items__c orc=[ select id,orders__c,Transaction_Sequence_ID__c,TransactionCode__c,TransactionDateTime__c,Correlation_Transaction_ID__c from Order_Line_Items__c  where orders__c =:oid limit 1];       orc.Correlation_Transaction_ID__c=dssCorrelationTransactionId;    update orc;       }       }          if (reader.getLocalName() =='Message')       {        reader.next();                if (reader.getEventType() == XmlTag.characters)       {          dssMessage= reader.getText();          system.debug(dssMessage+'DMMMMMMMMMMMMM');         }                         }       if (reader.getLocalName() =='ConMessage')       {        reader.next();        if (reader.getEventType() == XmlTag.characters)       {          dssMessage1= reader.getText();          system.debug(dssMessage1+'DMMMMMMMMMMMMM1');         }                         }       if (reader.getLocalName() == 'OrderId')       {        reader.next();        if (reader.getEventType() == XmlTag.characters)       {          dss_order_id= reader.getText();         Opportunity opp=[select id,DSS_Order_ID__c from opportunity where id=:opptid limit 1];         opp.DSS_Order_ID__c=dss_order_id;         Order__c orr=[select id,DSS_Order_ID__c from Order__c where id=:oid limit 1];         orr.DSS_Order_ID__c=dss_order_id;         system.debug( orr.DSS_Order_ID__c+'IDDDDDDDDDDDDDDDDDD');         update opp;         update orr;       }       }                    }       reader.next();       }       return null;       }Any one can u plase help me this .

 

Thanks in advance.