You need to sign in to do that
Don't have an account?
sona gaikwad
how to write test class for below methods
public void validateData() {
Boolean isErrorLogACall = FALSE;
Boolean isErrorFollowUpTask = FALSE;
Boolean isErrorOpenTasks = FALSE;
Boolean PropState;
if(AccountInfo.PersonMobilePhone!=null && AccountInfo.PersonMobilePhone!='')
{
if(LeadHandlerClass.AccountDuplicateCheckOnEdit(AccountInfo.PersonMobilePhone,AccountInfo.Id))
{
System.debug('Duplicate Mobile 1: ');
AccountInfo.PersonMobilePhone.addError('Duplicate : '+AccountInfo.PersonMobilePhone);
isError = TRUE;
return;
}
}
if(AccountInfo.Mobile_2__c !=null && AccountInfo.Mobile_2__c!='')
{
if(LeadHandlerClass.AccountDuplicateCheckOnEdit(AccountInfo.Mobile_2__c ,AccountInfo.Id))
{
AccountInfo.Mobile_2__c.addError('Duplicate : '+AccountInfo.Mobile_2__c );
isError = TRUE;
return;
}
}
if(AccountInfo.PersonEmail!=null &&AccountInfo.PersonEmail!='')
{
if(LeadHandlerClass.AccountDuplicateCheckOnEdit(AccountInfo.PersonEmail,AccountInfo.Id))
{
AccountInfo.PersonEmail.addError('Duplicate : '+AccountInfo.PersonEmail);
isError = TRUE;
return;
}
}
//JJ - 04/27/2016
if(AccountInfo.City_Village__c != null && AccountInfo.City_Village__c != '')
{
List<Village_City__c> lstCityVill = new List<Village_City__c>();
lstCityVill = HandlerClass.getVillageCityAutocomplete(AccountInfo.City_Village__c, '');
//Case Sensitive Logic
for(Village_City__c recTaluka :lstCityVill)
{
PropState = AccountInfo.City_Village__c.equals(recTaluka.Name);
if(PropState) break;
}
//Case Sensitive Logic - End.
if(lstCityVill.isEmpty())
{
AccountInfo.City_Village__c.addError('This Communication City/Village value is not available.');
isError = true;
}
else if(PropState == FALSE)
{
AccountInfo.City_Village__c.addError('This Case Sensitive Communication City/Village value is not available.');
isError = true;
}
}
}
Boolean isErrorLogACall = FALSE;
Boolean isErrorFollowUpTask = FALSE;
Boolean isErrorOpenTasks = FALSE;
Boolean PropState;
if(AccountInfo.PersonMobilePhone!=null && AccountInfo.PersonMobilePhone!='')
{
if(LeadHandlerClass.AccountDuplicateCheckOnEdit(AccountInfo.PersonMobilePhone,AccountInfo.Id))
{
System.debug('Duplicate Mobile 1: ');
AccountInfo.PersonMobilePhone.addError('Duplicate : '+AccountInfo.PersonMobilePhone);
isError = TRUE;
return;
}
}
if(AccountInfo.Mobile_2__c !=null && AccountInfo.Mobile_2__c!='')
{
if(LeadHandlerClass.AccountDuplicateCheckOnEdit(AccountInfo.Mobile_2__c ,AccountInfo.Id))
{
AccountInfo.Mobile_2__c.addError('Duplicate : '+AccountInfo.Mobile_2__c );
isError = TRUE;
return;
}
}
if(AccountInfo.PersonEmail!=null &&AccountInfo.PersonEmail!='')
{
if(LeadHandlerClass.AccountDuplicateCheckOnEdit(AccountInfo.PersonEmail,AccountInfo.Id))
{
AccountInfo.PersonEmail.addError('Duplicate : '+AccountInfo.PersonEmail);
isError = TRUE;
return;
}
}
//JJ - 04/27/2016
if(AccountInfo.City_Village__c != null && AccountInfo.City_Village__c != '')
{
List<Village_City__c> lstCityVill = new List<Village_City__c>();
lstCityVill = HandlerClass.getVillageCityAutocomplete(AccountInfo.City_Village__c, '');
//Case Sensitive Logic
for(Village_City__c recTaluka :lstCityVill)
{
PropState = AccountInfo.City_Village__c.equals(recTaluka.Name);
if(PropState) break;
}
//Case Sensitive Logic - End.
if(lstCityVill.isEmpty())
{
AccountInfo.City_Village__c.addError('This Communication City/Village value is not available.');
isError = true;
}
else if(PropState == FALSE)
{
AccountInfo.City_Village__c.addError('This Case Sensitive Communication City/Village value is not available.');
isError = true;
}
}
}
All Answers
Please find the below test method for your above method validateData() Please let me know if it helps!