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
Akshay MhetreAkshay Mhetre 

How to write a test classes for API classes

Below are 3 classes connected to each other. Help me to write a TEST CLASS.

public class IND_NeSLAgreementStatusRequest extends ParentAPIRequest{
public string Deal_No {get;set;}
public IND_NeSLAgreementStatusRequest(Applicant__c app,String loanAppId){

this.Deal_No = 'RJG01179D';//app.Opportunity__r.Parent_Deal_number__c;
validate(System.Label.NeSLAgreementStatus);
}

public override Map<String,String> getHttpRequestHeaders(){
Map<String,String> requestHeaderMap = Utilities.getHeaders();
return requestHeaderMap;
}

public override boolean validate(String serviceName){
if(this.Deal_No == null && String.isBlank(this.Deal_No)){
throw new IND_Exception(System.Label.deal_Number);
}
return true;
}
}


==========================

public class IND_NeSLAgreementStatusService {

public static IND_NeSLAgreementStatusRequest getNeSLAgreementStatusRequest(Applicant__c app,String loanAppId){
try{
IND_NeSLAgreementStatusRequest neSLAgreementStatusRequest = new IND_NeSLAgreementStatusRequest(app,loanAppId);//only validation and setting headers
return neSLAgreementStatusRequest;
}
catch(Exception ex){
ErrorLoggerUtil.logErrorEvent('IND_NeSLAgreementStatusRequest', 'getNeSLAgreementStatusRequest', System.Label.Apex, ex,loanAppId);
throw new IND_Exception(ex.getMessage());
}
}
}
=========================================================
public class IND_NeSLAgreementStatusResponse extends ParentAPIResponse {

public class Response {
public String status;
public String respDesc;
public List<Content> content;
}

public Response response;

public class Content {
public String Status_Code;
public String Status_Description;
public String Esign_Link;
}

}

PriyaPriya (Salesforce Developers) 
Hey Akshay,
 

The developer community recommends providing any attempts/code you've started, any errors you're getting, or where exactly you're struggling in achieving this while posting a question.


Thank you
Santos BogisichSantos Bogisich

Thanks for sharing this informative and amazing post here. I found it very interesting and enjoy reading this blog. Will wait for more posts.

https://tradeinvestoil.ru/product/virgin-fuel-d6

Kiera SuttonKiera Sutton

Hello everyone! I often come across a text where a preposition is misspelled, and I want to help you repeat and find out how well you know grammar! On this site you can learn a lot of new, interesting and useful things about the preposition. Come in and try it right now

https://www.prepositionfinder.com/how-to-check-sentences-with-prepositional-phrase-identifier/

Dave Smith 48Dave Smith 48
Very interesting blog. A lot of blogs I see these days don't really provide anything that I'm interested in, but I'm most definitely interested in this one. Just thought that I would post and let you know about mine Punisher Jackets (https://dollarjackets.com/product-category/movies/punisher-jackets/
Alex John 18Alex John 18