dimanche 26 juillet 2020

Test class for this apex wrapper class

I need help to write test class for this apex wrapper class. This wrapper class is used in different apex class for Integration. Can anyone help me to write the workaround for this particular test class even if it is not the best practice. Thanks in advance.

public class PincodeDataResponseWrapper {
    
    public Status status;
    
    public PincodeDataResponseWrapper(Status status){
        this.status = status;
    }
    
    public class Status {
        public String pId;
        public String externalStatus;
        public ErrorDetail errorDetail;
        
        public Status(String pId, String externalStatus, ErrorDetail errorDetail ){
            this.pId = pId;
            this.externalStatus = externalStatus;
            this.errorDetail = errorDetail;
        }
    }
    
    public class ErrorDetail {
        public String errCode;
        public String errReason;
        
        public ErrorDetail(String errCode, String errReason){
            this.errCode = errCode;
            this.errReason = errReason;
        }
    }

    public static PincodeDataResponseWrapper parse(String json) {
        return (PincodeDataResponseWrapper) System.JSON.deserialize(json, PincodeDataResponseWrapper.class);
    }
}

Aucun commentaire:

Enregistrer un commentaire