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
RahulRahul 

Hi friends, Need help in test class for this class, Thanks

/*
*Author: Vivek
*Date: 01/05/2018
*Description: Generic Domian Layer methods for SOQL/DML operations
*/
//TODO: add method headers
public virtual class AC_GenericDomainUtility{

//inserting sObjects
public list<sObject> insertSObjectLst(list<sObject> sObjLst){

        try{
            
            Database.insert(sObjLst);
            system.debug('*********in BD_ApplicationDomain, insert success, returning :'+sObjLst);
            return sObjLst;
        
        }catch(exception ex){
          //log exceptions in log object
          system.debug('*********Exception in BD_ApplicationDomain:'+ex.getMessage());
          //throw ex;
   
        }
        return Null;
        

}//insertSObjectLst


//updating sObjects
public list<sObject> updateSObjectLst(list<sObject> sObjLst){

        try{
            
            Database.update(sObjLst);
            system.debug('*********in BD_ApplicationDomain, update success, returning :'+sObjLst);
            return sObjLst;
        
        }catch(exception ex){
          //log exceptions in log object
          system.debug('*********Exception in BD_ApplicationDomain:'+ex.getMessage());
          //throw ex;
        }
        
        return Null;

}//updateSObjectLst

//fetching structure of all fields for respective object
public static string retrieveFieldLstForObject(String SobjectApiName){
        
        string query = '';
        Map<String, Schema.SObjectType> schemaMap = Schema.getGlobalDescribe();
        Map<String, Schema.SObjectField> fieldMap = schemaMap.get(SobjectApiName).getDescribe().fields.getMap();
 
        String commaSepratedFields = '';
        for(String fieldName : fieldMap.keyset()){
            if(commaSepratedFields == null || commaSepratedFields == ''){
                commaSepratedFields = fieldName;
            }else{
                commaSepratedFields = commaSepratedFields + ', ' + fieldName;
            }
        }
 
        query = BD_InterfaceConstants.SELECTSTR +BD_InterfaceConstants.SPACE+ commaSepratedFields +BD_InterfaceConstants.SPACE+ BD_InterfaceConstants.FROMSTR+ BD_InterfaceConstants.SPACE + SobjectApiName ;
 
        return query;
        



//Fetching error codes for respective Service name and sending map<ErrorCode,Description>
public map<string,string> retrieveServiceErrorCodes(string servName){
   
   map<string,string> retMap = new map<string,string>();
   try{
     
     list<BD_GlobalErrorCodes__c> custLst = BD_GlobalErrorCodes__c.getAll().values();
     
     for(BD_GlobalErrorCodes__c cd: custLst){
       if(cd.BD_ServiceName__c.equals(servName)){
         retMap.put(cd.BD_ErrorCode__c,cd.BD_Description__c);
       }
     }
     
   }catch(Exception ex){
      //log ex
      system.debug('*********exception in BD_GenericDomainUtility.retrieveServiceErrorCodes:'+ex.getMessage());
   }
   
   return retMap;
}  

}