class... public class ExceptionCreateExceptionRecord{ public static void insertException(Map<string, string> param) { Exception__c newExcept = new Exception__c(); newExcept.ExceptionTypeCode__c = param.get('ExceptionTypeCode__c'); newExcept.RecordType.DeveloperName = 'New Exception'; test class @isTest(SeeAllData=true) public class TestExceptionCreateExceptionRecord { static testmethod void Exception(){ map<String ,String> parm=new map<String,String>(); parm.put('ExceptionTypeCode__c', 'open'); parm.put('entry2','Second entry'); ExceptionCreateExceptionRecord excep=new ExceptionCreateExceptionRecord(); ExceptionCreateExceptionRecord.insertException(Parm); stacktrace Class.ExceptionCreateExceptionRecord.insertException: line 7, column 1( newExcept.RecordType.DeveloperName = 'New Exception'; ) Class.TestExceptionCreateExceptionRecord.Exception: line 8, column 1( ExceptionCreateExceptionRecord.insertException(Parm);)