You need to sign in to do that
Don't have an account?
Laura Livesey
Assertion fails in test class when deploying to production - works in sandbox
Hi,
I'm trying to deploy and am getting an error with a test class that works fine in sandbox - please help! Here is the test class:
public class BTProbityCheckTest {
static testMethod void myBTSendProbityCheckTest(){
Contact newCandy = new Contact (FirstName='Fred', LastName='Flintstone', email='test@testing.com');
insert newCandy;
BT_Probity_Check__c newBTPC = new BT_Probity_Check__c(Candidate__c= newCandy.id);
insert newBTPC;
PageReference pageRef = Page.BTSendProbityCheck;
pageRef.getParameters().put('id', newBTPC.id);
Test.setCurrentPageReference(pageRef);
ApexPages.StandardController sc = new ApexPages.standardController(newBTPC);
BTSendProbityCheckExtension e = new BTSendProbityCheckExtension(sc);
System.assertEquals(newBTPC.id, e.btpc.id );
System.assertEquals('test@testing.com', e.btpcEmail);
System.assertEquals('Fred Flintstone',e.btpc.Full_Name__c);
System.assertEquals(String.valueOf(newCandy.Id), e.btpcCandy);
e.Cancel();
e.SendEmail();
}
The error I get when trying to deploy is:
System.AssertException: Assertion Failed: Expected: Fred Flintstone, Actual: null
Stack Trace: Class.BTProbityCheckTest.myBTSendProbityCheckTest: line 24, column 1
The line is
System.assertEquals('test@testing.com', e.btpcEmail);
Thanks in advance.
I'm trying to deploy and am getting an error with a test class that works fine in sandbox - please help! Here is the test class:
public class BTProbityCheckTest {
static testMethod void myBTSendProbityCheckTest(){
Contact newCandy = new Contact (FirstName='Fred', LastName='Flintstone', email='test@testing.com');
insert newCandy;
BT_Probity_Check__c newBTPC = new BT_Probity_Check__c(Candidate__c= newCandy.id);
insert newBTPC;
PageReference pageRef = Page.BTSendProbityCheck;
pageRef.getParameters().put('id', newBTPC.id);
Test.setCurrentPageReference(pageRef);
ApexPages.StandardController sc = new ApexPages.standardController(newBTPC);
BTSendProbityCheckExtension e = new BTSendProbityCheckExtension(sc);
System.assertEquals(newBTPC.id, e.btpc.id );
System.assertEquals('test@testing.com', e.btpcEmail);
System.assertEquals('Fred Flintstone',e.btpc.Full_Name__c);
System.assertEquals(String.valueOf(newCandy.Id), e.btpcCandy);
e.Cancel();
e.SendEmail();
}
The error I get when trying to deploy is:
System.AssertException: Assertion Failed: Expected: Fred Flintstone, Actual: null
Stack Trace: Class.BTProbityCheckTest.myBTSendProbityCheckTest: line 24, column 1
The line is
System.assertEquals('test@testing.com', e.btpcEmail);
Thanks in advance.
System.assertEquals('test@testing.com', newCandy.Email);
System.assertEquals('Fred Flintstone',newCandy.Name);
I don't see where you are inserting the field "Full_Name__c", which is probably why it gets the assertion exception Assertion Failed: Expected: Fred Flintstone, Actual: null