FavoritosJagriti Kukreti (RBC) perguntou em #Apex18 de mar. de 2019, 14:52I am trying to cover the positive scenario of a class but i am receiving assetion fail error.I am trying to cover the positive scenario of a class but i am receiving assetion fail error. Kindly helpClass: public class CTICallInitiationService { public static Id createServiceSessionRecord(String route, String callFrom, String customerType, String language, String branchPhone, String highestAuth, String trustedPhone){ Service_Session__c serviceSessionRecord = new Service_Session__c(); //serviceSessionRecord.Account_ID__c = accountId; serviceSessionRecord.Session_Type__c = 'Phone'; serviceSessionRecord.Highest_Authentication_Level_Achieved__c = highestAuth; serviceSessionRecord.Authentication_Level__c = highestAuth; //serviceSessionRecord.Parent_Case__c=idCase; serviceSessionRecord.Created_Date_Time__c = System.now(); serviceSessionRecord.Status__c = 'Active'; serviceSessionRecord.Initiating_User__c = UserInfo.getUserId(); serviceSessionRecord.Call_Route__c = route; serviceSessionRecord.Call_From_ANI__c = callFrom; serviceSessionRecord.Customer_type__c = customerType; serviceSessionRecord.Language__c = language; serviceSessionRecord.Branch_Phone__c = branchPhone; serviceSessionRecord.trusted_phone__c = trustedPhone; try { insert serviceSessionRecord; } catch(DmlException e) { serviceSessionRecord.id = null; System.debug('The following exception has occurred: ' + e.getMessage()); } return serviceSessionRecord.id; } } Test Class:@isTest(seeAllData=false)private class CtiCallInitiationServiceTest { @isTest private static void ServiceSessionRecordTest(){ /* Positive insertion */ Id idSession1 = CtiCallInitiationService.createServiceSessionRecord('route', 'callFrom' , 'customerType' , 'language' , 'branchPhone' , 'highestAuth' , 'trustedPhone'); /* Negative insertion */ Id idSession2 = CtiCallInitiationService.createServiceSessionRecord('test', '9080942889' , 'Consumer' , 'Test' , '9080942889' , 'Full' , 'Yes'); Test.startTest(); system.assertEquals(False, String.isBlank(idSession1)); system.assertEquals(true, String.isBlank(idSession2)); Test.stopTest(); } }Mostrar mais3 respostasClassificarClassificar por dataClassificar por mais útilClassificar por dataCarregar mais comentários...Jagriti Kukreti (RBC)19 de mar. de 2019, 06:04@Raj Vakati : but i need to keep idSession1 for positive case scenarioAdicionar um comentárioEscrever uma resposta...NegritoItálicoSublinhadoTachadoLista com marcadoresLista numeradaAdicionar linkBloco de códigosInserir imagemAnexar arquivosURL do linkCancelarSalvar0/9000Responder
Jagriti Kukreti (RBC)19 de mar. de 2019, 06:04@Raj Vakati : but i need to keep idSession1 for positive case scenario