+ Start a Discussion
Nicholas PalattaoNicholas Palattao 

Test class failing

I have a test class that repeatedly fails at the same point when trying to insert one specific object. Insertion of multiple other objects works fine throughout the rest of the class, and every required field has been accounted for. I'm not sure what's wrong here.
Nicholas PalattaoNicholas Palattao
"System.DmlException: Insert failed. First exception on row 0; first error: CANNOT_INSERT_UPDATE_ACTIVATE_ENTITY, SBQQ.QuoteLineAfter: execution of AfterInsert
caused by: System.NullPointerException: Attempt to de-reference a null object
: []"
public class TESTQuoteGenerateStoresBOMs{
    static testMethod void insertNewData() {
        Account acc = new Account();
        acc.Name = 'Test Acc142';
        acc.Industry = 'CPG';
        acc.Type = 'Prospect';
        acc.CurrencyIsoCode = 'EUR';
        acc.BillingCountry = 'Italy';
        insert acc;
        Opportunity opp = new Opportunity();
        opp.AccountId = acc.Id;
        opp.Name = 'Test Opp1599';
        opp.Type = 'New Business';
        opp.Forecast_Stage__c = 'Upside';
        opp.CurrencyIsoCode  = 'EUR';
        opp.Amount = 20;
        opp.StageName = 'Hold';
        opp.CloseDate = date.today();
        opp.Description = 'Test';
        insert opp;
        SBQQ__Quote__c quote = new SBQQ__Quote__c();
        quote.SBQQ__SubscriptionTerm__c = 5;
        quote.SBQQ__Opportunity2__c = opp.id;
        insert quote;
        SBQQ__QuoteLine__c quoteLine = new SBQQ__QuoteLine__c();
        quoteLine.SBQQ__Quote__c = quote.id;
        insert quoteLine;  
        Customer_Deployment__c cD = new Customer_Deployment__c();
        cD.Customer__c = acc.id;
        cD.Brand__c = 'test';
        insert cD;
        Store_Information__c stInfo = new Store_Information__c();
        stInfo.Store_Name_new__c = 'Name';
        stInfo.Customer_Deployment_ID__c = cD.id;
        stInfo.Install_Quote__c = 123;
        stInfo.Task__c = 'Open';
        stInfo.Status__c = 'Open';
        stInfo.Quote__c = quote.id;
        insert stInfo;
        Camera_Information__c bom = new Camera_Information__c();
        bom.Store_Info_ID__c = stInfo.id;
        bom.Quote_Line__c = quoteLine.id;
        insert bom;
        Camera_Information__c bom2 = new Camera_Information__c();
        bom2.Store_Info_ID__c = stInfo.id;
        bom2.Quote_Line__c = quoteLine.Id;
        insert bom2;
        QuoteGenerateStoresBOMs controller = new QuoteGenerateStoresBOMs(new ApexPages.StandardController(quote));
        GenerateStoresBOMs controller2 = new GenerateStoresBOMs(new ApexPages.StandardController(stInfo));

Sudipta DebSudipta Deb
I think the error is coming from here SBQQ.QuoteLineAfter. Can you let me know what this SBQQ.QuoteLineAfter is doing? It will be good if you can post the code snippet.
Nicholas PalattaoNicholas Palattao
Unfortunately that's exactly where I'm stuck. That trigger is part of a installed package and thus I'm unable to see its code. After speaking with their support team it seems they can't view the code either. I seem to be at an impasse
Sudipta DebSudipta Deb
Hi Nicholas,

That's something strange. I believe the reason why you are not able to see the code, because it is a managed package. But their support team should be able to help you. And if you ask me, their support team needs to solve this issue. You can't do anything here. For you this is just the blackbox.