You need to sign in to do that
Don't have an account?
sfg1
Error Message System.QueryException: List has no rows for assignment to SObject in Messaging.InboundEmailHandle test class
I am getting error "Error MessageSystem.QueryException: List has no rows for assignment to SObject" in Test class.
Please guide me in this.
@ISTest
public class Email_TEST {
public static testmethod void testmethod1() {
Location2__c lc= new Location2__c();
lc.Workout_Status__c= 'Past Due 1 Backlog';
lc.Workout_Status_Updated__c= 'test';
insert LC;
Task t = new Task();
t.Subject = 'Fax Packet Successful';
t.Description = 'testdata';
t.Status = 'Completed';
t.Priority = 'Low';
t.WhatId = lc.Id;
lc.Fax_Failed__c = False;
lc.Fax_Verified__c = True;
insert t;
Messaging.InboundEmail email = new Messaging.InboundEmail() ;
Messaging.InboundEnvelope env = new Messaging.InboundEnvelope();
email.subject = 'Test' ;
email.fromname = 'Test Test';
env.fromAddress = 'Test@email.com';
email.plainTextBody = 'Test';
EpiEmailBlast emailProcess = new EpiEmailBlast();
emailProcess.handleInboundEmail(email,env);
System.debug('Email is: ' + Email);
System.debug('Env is: ' + Env);
}
}
Please guide me in this.
@ISTest
public class Email_TEST {
public static testmethod void testmethod1() {
Location2__c lc= new Location2__c();
lc.Workout_Status__c= 'Past Due 1 Backlog';
lc.Workout_Status_Updated__c= 'test';
insert LC;
Task t = new Task();
t.Subject = 'Fax Packet Successful';
t.Description = 'testdata';
t.Status = 'Completed';
t.Priority = 'Low';
t.WhatId = lc.Id;
lc.Fax_Failed__c = False;
lc.Fax_Verified__c = True;
insert t;
Messaging.InboundEmail email = new Messaging.InboundEmail() ;
Messaging.InboundEnvelope env = new Messaging.InboundEnvelope();
email.subject = 'Test' ;
email.fromname = 'Test Test';
env.fromAddress = 'Test@email.com';
email.plainTextBody = 'Test';
EpiEmailBlast emailProcess = new EpiEmailBlast();
emailProcess.handleInboundEmail(email,env);
System.debug('Email is: ' + Email);
System.debug('Env is: ' + Env);
}
}
Please mark as best answer if the information is informative.
Thanks
Rahul