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
LaaralLaaral 

Test class : Assertion failed: same value :null

I made this testclass which handles cases + and cases contains account + setup information. Now I'm getting this error :

System.AssertException: Assertion Failed: Same value: null and I don't understand where this is coming from?

@isTest
private class AMobileHandlerTest {
   
    static testMethod void saveCaseTest() {
        // String account = ...;
        String connId = '12345678';
        String buyersID = 'bid';
        String classification = 'P3';
        String subject = 'Unit test subject';
        String description = 'Unit test description';
       
        Account ma = new account();
        ma.Name = 'test account';
        RecordType recordTypeMa = [ select Id, Name from RecordType where SObjectType = 'Account' and Name = 'Main Account' LIMIT 1];
        ma.RecordTypeId = recordTypeMa.Id;
        insert ma;
       
        Account ac = new account();
        ac.ParentId = ma.Id;
        ac.Name = 'test account';
        ac.ShippingCity = 'oulu';
        ac.ShippingCountry = 'finland';
        ac.ShippingPostalCode = '90550';
        ac.ShippingState = 'na';
        ac.ShippingStreet = 'eletie';
        RecordType recordType = [ select Id, Name from RecordType where SObjectType = 'Account' and Name = 'Site' LIMIT 1];
        ac.recordTypeId = recordType.Id;
        insert ac;
        System.assertNotEquals(null, ac.Id);
       
        Setup__c setuppi = new Setup__c();
        setuppi.Name = 'test';
        setuppi.SOC_LL_ID__c = connId;
        setuppi.site__c = ac.Id;
        insert setuppi;
        System.assertNotEquals(null, setuppi.Id);
       
       
        // AMobileHandler hndlr = new AMobileHandler();
        Test.startTest();
        string id = AMobileHandler.saveCase(connId, buyersId, classification, subject, description);
        Test.stopTest();
       
        System.assertNotEquals(null, id);

bob_buzzardbob_buzzard

Its impossible to tell without knowing what the AMobileHandler.saveCase() method does.

Ramanjot SidhuRamanjot Sidhu
Hi, Did you figure this out... I am having the same problem