function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
Ivan WinzerIvan Winzer 

system assert is failing in sandbox

So i have test class that keeps failing when run in sandbox. The main error i am getting is:

Error MessageSystem.AssertException: Assertion Failed: Expected: , Actual: Collection
Stack TraceClass.Test_DataPushtoAccount.testDataPushtoAccount: line 19, column 1

Below is the code and im not sure why its saying its expecting a null i query it in my c = statement and the filed is set in hte creation of the customer. Can anyone let me know what im not seeing.
@isTest
public with sharing class Test_DataPushtoAccount {
	@isTest
    public static void testDataPushtoAccount(){
        Account a = new Account(Name = 'Test MainContactTrigger', RecordTypeID = '01240000000UZ4V');
 //       a.RecordType = 'Household';
        insert a;
        
        Contact c = new Contact(AccountID = a.id, firstName = 'Test MainContactTrigger', lastName = 'Tester', email = 'testfake@gmail.com', Pricing_Profile__c = 'Collection');
        insert c;
        
 //       System.debug('Contact record num: ' + [SELECT Id FROM Contact].size());
        
          
        c = [select AccountId, Account.Name, Pricing_Profile__c from Contact where id = :c.id limit 1];
           System.assertEquals('Test MainContactTrigger', a.Name);
           System.assertEquals(1, [SELECT Id FROM Contact].size());
           System.assertEquals(a.id, c.AccountId);
           System.assertEquals(a.Pricing_Profile__c, c.Pricing_Profile__c);
    }
    
}

 
Best Answer chosen by Ivan Winzer
pranab khatuapranab khatua

Hi,

You have missed the populating the field Pricing_Profile__c  in account.

Modified Code will be:


 

Account a = new Account(Name = 'Test MainContactTrigger',Pricing_Profile__c = 'Collection', RecordTypeID = '01240000000UZ4V');

If you will get help from this docs Please give me Best Answer.

Thanks,

All Answers

pranab khatuapranab khatua

Hi,

You have missed the populating the field Pricing_Profile__c  in account.

Modified Code will be:


 

Account a = new Account(Name = 'Test MainContactTrigger',Pricing_Profile__c = 'Collection', RecordTypeID = '01240000000UZ4V');

If you will get help from this docs Please give me Best Answer.

Thanks,
This was selected as the best answer
Ivan WinzerIvan Winzer
thanks pranab khatua that was the issue...