You need to sign in to do that
Don't have an account?
Prashant Kumar 438
getting error in the test class -> I have to match the date and time field of both interview object and the interview_Slot object show trigger fire.
System.DmlException: Insert failed. First exception on row 0; first error: FIELD_CUSTOM_VALIDATION_EXCEPTION, Choose Appropriate Date/Time: [Interview_Date_and_Time__c]
@isTest(seeALLData = true)
public class InterviewerSlotBatch_TestClass {
@isTest
public static void InterviewerSlotBatch_TestMethod(){
List<Contact> conList = [SELECT Id, Name, Interviewer__c FROM Contact];
List<Interviewer_Slot__c> slots = new List<Interviewer_Slot__c>();
Interviewer_Slot__c intSlot = new Interviewer_Slot__c(Date__c = Date.today(), Start_Time__c = Time.newInstance(3, 14, 15, 926), End_Time__c
= Time.newInstance(4, 0, 0, 926), Contact__c = conList[0].Id);
slots.add(intSlot);
insert slots;
test.startTest();
InterviewerSlotBatch InterviewerSlotBatch_TestClass = new InterviewerSlotBatch();
Database.executeBatch(InterviewerSlotBatch_TestClass);
test.stopTest();
}
}
@isTest(seeALLData = true)
public class InterviewerSlotBatch_TestClass {
@isTest
public static void InterviewerSlotBatch_TestMethod(){
List<Contact> conList = [SELECT Id, Name, Interviewer__c FROM Contact];
List<Interviewer_Slot__c> slots = new List<Interviewer_Slot__c>();
Interviewer_Slot__c intSlot = new Interviewer_Slot__c(Date__c = Date.today(), Start_Time__c = Time.newInstance(3, 14, 15, 926), End_Time__c
= Time.newInstance(4, 0, 0, 926), Contact__c = conList[0].Id);
slots.add(intSlot);
insert slots;
test.startTest();
InterviewerSlotBatch InterviewerSlotBatch_TestClass = new InterviewerSlotBatch();
Database.executeBatch(InterviewerSlotBatch_TestClass);
test.stopTest();
}
}
Do you have any validation rules on the interview object or interview_Slot object with the message "Choose Appropriate Date/Time"?
Anudeep