• sfdc wizard
  • NEWBIE
  • 0 Points
  • Member since 2016

  • Chatter
    Feed
  • 0
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 1
    Questions
  • 0
    Replies
Hello All,

So far I've had experience writing Apex Triggers & the Test Classes. I am looking for some pointers that will help me modify the test class, which will give me a better coverage of the Apex Class. I've always written Test classes separately, and not within the class. It was written by our previous developer that is a part of the syncing (salesforce & remedy).

I am open to either modify the existing class/test class or just write a separate test class that will give me a better code coverage( Current 29%). The lines not covered by the test class are highlighted in Bold, Italic.

Below is the complete Class and the Test class within:


global class WS_RemedyEW{
 WebService static list<list<String>> getRemedyEW(String serialNumber, String SONumber){

    fxExtendedWarranty.FX_Extended_WarrantySoap syncRem = new  fxExtendedWarranty.FX_Extended_WarrantySoap();
    fxExtendedWarranty.AuthenticationInfo syncRemAuth = new fxExtendedWarranty.AuthenticationInfo();
    syncRemAuth.userName = 'mthomas';
    syncRemAuth.password= 'tinu@1980';
    syncRem.parameters = syncRemAuth;
    try{              
        fxExtendedWarranty.getListValues_element[] getResponce = syncRem.OpGetList('','','','','','','','','','','','','','','','','',serialNumber,SONumber,'');

        list<list<string>> ewDetails = new list<list<string>>();
        
        for(fxExtendedWarranty.getListValues_element ewItem: getResponce){
            list<string> ewElement = new list<string>();
            ewElement.add(ewItem.Serial_Number);
            ewElement.add(ewItem.SO_Number);
            ewElement.add(ewItem.CommencementMonth);
            ewElement.add(ewItem.CommencementYear);
            ewElement.add(ewItem.Company_Name);
            ewElement.add(ewItem.Customer_Company_Name);
            ewElement.add(ewItem.CustomerName);
            ewElement.add(ewItem.Dealer);            
            ewElement.add(ewItem.ExpirationMonth);
            ewElement.add(ewItem.ExpirationYear);
            ewElement.add(ewItem.Full_EW);
            ewElement.add(ewItem.HW_EW);
            ewElement.add(ewItem.Part_Number);
            ewElement.add(ewItem.PONumber);
            ewElement.add(ewItem.Product);
            ewElement.add(ewItem.ProductName);
            ewElement.add(ewItem.SW_FW_EW);
            ewElement.add(ewItem.ADV_EW);
            if (string.valueof(ewItem.POS_Date).length() > 0) {ewElement.add(ewItem.POS_Date.substring(0,10));} else {ewElement.add(ewItem.POS_Date);}
            ewDetails.add(ewElement);            
        }
       return ewDetails;        

     }catch(Exception e){   
        //Write to the error log file
    }  
  return null;
 }
   private static testMethod void myTest() {
    getRemedyEW('MSN%','1');
  }
}