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
Charlie Chaplin 2017Charlie Chaplin 2017 

System.AssertException: Assertion Failed: Same value: null Stack Trace:

Need some help. I am try to deploy this class to our Production environment. I getting an error: System.AssertException: Assertion Failed: Same value: null
Stack Trace: Class.ManageVendorProductsControllerTest.existingReviewInProgressSupplemental: line 197, column 1
 
Anyone know why i am getting this error message. 
@isTest
private class ManageVendorProductsControllerTest {
    
    static TestMethod void noExistingReviews (){
                
        PageReference ref = Page.ManageVendorProducts;
       
        Account a = new Account();
        a.Name = 'TESTACCOUNT';
        a.Lease_Volume__c = 10000000.00;
        a.BillingState = 'NJ';
        INSERT a;
        
        Reliance_Product__c rp = new Reliance_Product__c();
        rp.Reliance_Level__c = 'Medium';
        rp.Reliance_Sort__c = 1;
        rp.Name = 'TESTRELIANCEPRODUCT';
        INSERT rp;
        
        Account account = [SELECT Id, Lease_Volume__c FROM Account LIMIT 1];
        Reliance_Product__c relianceProduct = [SELECT Id FROM Reliance_Product__c LIMIT 1];
        
        Vendor_Products__c vp = new Vendor_Products__c();
        vp.Account__c = account.Id;
        vp.Reliance_Product__c = relianceProduct.Id;
        INSERT vp;
                
        List<Vendor_Products__c> vendorProduct = [SELECT Id FROM Vendor_Products__c];
        
        Test.setCurrentPage(ref);  
                   
        ref.getParameters().put('retURL', account.Id);     
        ref.getParameters().put('id', account.Id);   
        
        ApexPages.StandardSetController ssc = new ApexPages.StandardSetController(vendorProduct);
        ManageVendorProductsController controller = new ManageVendorProductsController(ssc);
             
        controller.viewModel.products[0].relianceProduct = relianceProduct;
        controller.viewModel.products[0].selected = true;
        controller.viewModel.account = account;
               
        System.assertNotEquals(null, controller.updateVendorProducts());
        
        controller.ViewModel.products[0].selected = false;
        
        System.assertNotEquals(null, controller.updateVendorProducts());
        
        controller.ViewModel.products[0].selected = true;
        
        System.assertNotEquals(null, controller.updateVendorProducts());
        
        System.assertNotEquals(null, controller.cancel());
        
    }
    
    static TestMethod void existingReviewVendorBookInitalApplication (){
                
        PageReference ref = Page.ManageVendorProducts;
       
        Account a = new Account();
        a.Name = 'TESTACCOUNT';
        a.Lease_Volume__c = 10000000.00;
        a.BillingState = 'NJ';
        INSERT a;
        
        Reliance_Product__c rp = new Reliance_Product__c();
        rp.Reliance_Level__c = 'Medium';
        rp.Reliance_Sort__c = 1;
        rp.Name = 'TESTRELIANCEPRODUCT';
        INSERT rp;
        
        Account account = [SELECT Id, Lease_Volume__c FROM Account LIMIT 1];
        Reliance_Product__c relianceProduct = [SELECT Id FROM Reliance_Product__c LIMIT 1];
        
        Vendor_Products__c vp = new Vendor_Products__c();
        vp.Account__c = account.Id;
        vp.Reliance_Product__c = relianceProduct.Id;
        INSERT vp;
        
        Review__c review = new Review__c();
        review.Account__c = account.Id;
        review.RecordTypeId = [SELECT Id, sObjectType, Name FROM RecordType WHERE Name = 'Initial Application' AND sObjectType = 'Review__c' LIMIT 1].Id;
        review.Is_Approved__c = TRUE;
        review.Review_Stat__c = 'Vendor Booked';
        INSERT review;
                
        List<Vendor_Products__c> vendorProduct = [SELECT Id FROM Vendor_Products__c];
        
        Test.setCurrentPage(ref);  
                   
        ref.getParameters().put('retURL', account.Id);     
        ref.getParameters().put('id', account.Id);   
        
        ApexPages.StandardSetController ssc = new ApexPages.StandardSetController(vendorProduct);
        ManageVendorProductsController controller = new ManageVendorProductsController(ssc);
             
        controller.viewModel.products[0].relianceProduct = relianceProduct;
        controller.viewModel.products[0].selected = true;
        controller.viewModel.account = account;
               
        System.assertEquals(null, controller.updateVendorProducts());
                
    }
    
    static TestMethod void existingReviewCompletedSupplemental (){
                
        PageReference ref = Page.ManageVendorProducts;
       
        Account a = new Account();
        a.Name = 'TESTACCOUNT';
        a.Lease_Volume__c = 10000000.00;
        a.BillingState = 'NJ';
        INSERT a;
        
        Reliance_Product__c rp = new Reliance_Product__c();
        rp.Reliance_Level__c = 'Medium';
        rp.Reliance_Sort__c = 1;
        rp.Name = 'TESTRELIANCEPRODUCT';
        INSERT rp;
        
        Account account = [SELECT Id, Lease_Volume__c FROM Account LIMIT 1];
        Reliance_Product__c relianceProduct = [SELECT Id FROM Reliance_Product__c LIMIT 1];
        
        Vendor_Products__c vp = new Vendor_Products__c();
        vp.Account__c = account.Id;
        vp.Reliance_Product__c = relianceProduct.Id;
        INSERT vp;
        
        Review__c review = new Review__c();
        review.Account__c = account.Id;
        review.RecordTypeId = [SELECT Id, sObjectType, Name FROM RecordType WHERE Name = 'Supplemental' AND sObjectType = 'Review__c' LIMIT 1].Id;
        review.Is_Completed__c = TRUE;
        INSERT review;
                
        List<Vendor_Products__c> vendorProduct = [SELECT Id FROM Vendor_Products__c];
        
        Test.setCurrentPage(ref);  
                   
        ref.getParameters().put('retURL', account.Id);     
        ref.getParameters().put('id', account.Id);   
        
        ApexPages.StandardSetController ssc = new ApexPages.StandardSetController(vendorProduct);
        ManageVendorProductsController controller = new ManageVendorProductsController(ssc);
             
        controller.viewModel.products[0].relianceProduct = relianceProduct;
        controller.viewModel.products[0].selected = true;
        controller.viewModel.account = account;
               
        System.assertEquals(null, controller.updateVendorProducts());
                
    }
    
    static TestMethod void existingReviewInProgressSupplemental (){
                
        PageReference ref = Page.ManageVendorProducts;
       
        Account a = new Account();
        a.Name = 'TESTACCOUNT';
        a.Lease_Volume__c = 10000000.00;
        a.BillingState = 'NJ';
        INSERT a;
        
        Reliance_Product__c rp = new Reliance_Product__c();
        rp.Reliance_Level__c = 'Medium';
        rp.Reliance_Sort__c = 1;
        rp.Name = 'TESTRELIANCEPRODUCT';
        INSERT rp;
        
        Account account = [SELECT Id, Lease_Volume__c FROM Account LIMIT 1];
        Reliance_Product__c relianceProduct = [SELECT Id FROM Reliance_Product__c LIMIT 1];
        
        Vendor_Products__c vp = new Vendor_Products__c();
        vp.Account__c = account.Id;
        vp.Reliance_Product__c = relianceProduct.Id;
        INSERT vp;
        
        Review__c review = new Review__c();
        review.Account__c = account.Id;
        review.RecordTypeId = [SELECT Id, sObjectType, Name FROM RecordType WHERE Name = 'Supplemental' AND sObjectType = 'Review__c' LIMIT 1].Id;
        review.In_Progress__c = TRUE;
        INSERT review;
                
        List<Vendor_Products__c> vendorProduct = [SELECT Id FROM Vendor_Products__c];
        
        Test.setCurrentPage(ref);  
                   
        ref.getParameters().put('retURL', account.Id);     
        ref.getParameters().put('id', account.Id);   
        
        ApexPages.StandardSetController ssc = new ApexPages.StandardSetController(vendorProduct);
        ManageVendorProductsController controller = new ManageVendorProductsController(ssc);
             
        controller.viewModel.products[0].relianceProduct = relianceProduct;
        controller.viewModel.products[0].selected = true;
        controller.viewModel.account = account;
               
        System.assertNotEquals(null, controller.updateVendorProducts());
        
        controller.ViewModel.products[0].selected = false;
        
        System.assertNotEquals(null, controller.updateVendorProducts());
        
        controller.ViewModel.products[0].selected = true;
        
        System.assertNotEquals(null, controller.updateVendorProducts());
        
        System.assertNotEquals(null, controller.cancel());
                
    }
    
}
UC InnovationUC Innovation
Hi Jamil,

It looks like you are using AssertNotEquals whan you might want to use AssertEquals. I made some changes and commented your code. Please review this
 
@isTest
private class ManageVendorProductsControllerTest {
    
    static TestMethod void noExistingReviews (){
                
        PageReference ref = Page.ManageVendorProducts;
       
        Account a = new Account();
        a.Name = 'TESTACCOUNT';
        a.Lease_Volume__c = 10000000.00;
        a.BillingState = 'NJ';
        INSERT a;
        
        Reliance_Product__c rp = new Reliance_Product__c();
        rp.Reliance_Level__c = 'Medium';
        rp.Reliance_Sort__c = 1;
        rp.Name = 'TESTRELIANCEPRODUCT';
        INSERT rp;
        
        Account account = [SELECT Id, Lease_Volume__c FROM Account LIMIT 1];
        Reliance_Product__c relianceProduct = [SELECT Id FROM Reliance_Product__c LIMIT 1];
        
        Vendor_Products__c vp = new Vendor_Products__c();
        vp.Account__c = account.Id;
        vp.Reliance_Product__c = relianceProduct.Id;
        INSERT vp;
                
        List<Vendor_Products__c> vendorProduct = [SELECT Id FROM Vendor_Products__c];
        
        Test.setCurrentPage(ref);  
                   
        ref.getParameters().put('retURL', account.Id);     
        ref.getParameters().put('id', account.Id);   
        
        ApexPages.StandardSetController ssc = new ApexPages.StandardSetController(vendorProduct);
        ManageVendorProductsController controller = new ManageVendorProductsController(ssc);
             
        controller.viewModel.products[0].relianceProduct = relianceProduct;
        controller.viewModel.products[0].selected = true;
        controller.viewModel.account = account;
               
        System.assertNotEquals(null, controller.updateVendorProducts());
        
        controller.ViewModel.products[0].selected = false;
        
        System.assertNotEquals(null, controller.updateVendorProducts());
        
        controller.ViewModel.products[0].selected = true;
        
        System.assertNotEquals(null, controller.updateVendorProducts());
        
        System.assertNotEquals(null, controller.cancel());
        
    }
    
    static TestMethod void existingReviewVendorBookInitalApplication (){
                
        PageReference ref = Page.ManageVendorProducts;
       
        Account a = new Account();
        a.Name = 'TESTACCOUNT';
        a.Lease_Volume__c = 10000000.00;
        a.BillingState = 'NJ';
        INSERT a;
        
        Reliance_Product__c rp = new Reliance_Product__c();
        rp.Reliance_Level__c = 'Medium';
        rp.Reliance_Sort__c = 1;
        rp.Name = 'TESTRELIANCEPRODUCT';
        INSERT rp;
        
        Account account = [SELECT Id, Lease_Volume__c FROM Account LIMIT 1];
        Reliance_Product__c relianceProduct = [SELECT Id FROM Reliance_Product__c LIMIT 1];
        
        Vendor_Products__c vp = new Vendor_Products__c();
        vp.Account__c = account.Id;
        vp.Reliance_Product__c = relianceProduct.Id;
        INSERT vp;
        
        Review__c review = new Review__c();
        review.Account__c = account.Id;
        review.RecordTypeId = [SELECT Id, sObjectType, Name FROM RecordType WHERE Name = 'Initial Application' AND sObjectType = 'Review__c' LIMIT 1].Id;
        review.Is_Approved__c = TRUE;
        review.Review_Stat__c = 'Vendor Booked';
        INSERT review;
                
        List<Vendor_Products__c> vendorProduct = [SELECT Id FROM Vendor_Products__c];
        
        Test.setCurrentPage(ref);  
                   
        ref.getParameters().put('retURL', account.Id);     
        ref.getParameters().put('id', account.Id);   
        
        ApexPages.StandardSetController ssc = new ApexPages.StandardSetController(vendorProduct);
        ManageVendorProductsController controller = new ManageVendorProductsController(ssc);
             
        controller.viewModel.products[0].relianceProduct = relianceProduct;
        controller.viewModel.products[0].selected = true;
        controller.viewModel.account = account;
               
        System.assertEquals(null, controller.updateVendorProducts());
                
    }
    
    static TestMethod void existingReviewCompletedSupplemental (){
                
        PageReference ref = Page.ManageVendorProducts;
       
        Account a = new Account();
        a.Name = 'TESTACCOUNT';
        a.Lease_Volume__c = 10000000.00;
        a.BillingState = 'NJ';
        INSERT a;
        
        Reliance_Product__c rp = new Reliance_Product__c();
        rp.Reliance_Level__c = 'Medium';
        rp.Reliance_Sort__c = 1;
        rp.Name = 'TESTRELIANCEPRODUCT';
        INSERT rp;
        
        Account account = [SELECT Id, Lease_Volume__c FROM Account LIMIT 1];
        Reliance_Product__c relianceProduct = [SELECT Id FROM Reliance_Product__c LIMIT 1];
        
        Vendor_Products__c vp = new Vendor_Products__c();
        vp.Account__c = account.Id;
        vp.Reliance_Product__c = relianceProduct.Id;
        INSERT vp;
        
        Review__c review = new Review__c();
        review.Account__c = account.Id;
        review.RecordTypeId = [SELECT Id, sObjectType, Name FROM RecordType WHERE Name = 'Supplemental' AND sObjectType = 'Review__c' LIMIT 1].Id;
        review.Is_Completed__c = TRUE;
        INSERT review;
                
        List<Vendor_Products__c> vendorProduct = [SELECT Id FROM Vendor_Products__c];
        
        Test.setCurrentPage(ref);  
                   
        ref.getParameters().put('retURL', account.Id);     
        ref.getParameters().put('id', account.Id);   
        
        ApexPages.StandardSetController ssc = new ApexPages.StandardSetController(vendorProduct);
        ManageVendorProductsController controller = new ManageVendorProductsController(ssc);
             
        controller.viewModel.products[0].relianceProduct = relianceProduct;
        controller.viewModel.products[0].selected = true;
        controller.viewModel.account = account;
               
        System.assertEquals(null, controller.updateVendorProducts());
                
    }
    
    static TestMethod void existingReviewInProgressSupplemental (){
                
        PageReference ref = Page.ManageVendorProducts;
       
        Account a = new Account();
        a.Name = 'TESTACCOUNT';
        a.Lease_Volume__c = 10000000.00;
        a.BillingState = 'NJ';
        INSERT a;
        
        Reliance_Product__c rp = new Reliance_Product__c();
        rp.Reliance_Level__c = 'Medium';
        rp.Reliance_Sort__c = 1;
        rp.Name = 'TESTRELIANCEPRODUCT';
        INSERT rp;
        
        Account account = [SELECT Id, Lease_Volume__c FROM Account LIMIT 1];
        Reliance_Product__c relianceProduct = [SELECT Id FROM Reliance_Product__c LIMIT 1];
        
        Vendor_Products__c vp = new Vendor_Products__c();
        vp.Account__c = account.Id;
        vp.Reliance_Product__c = relianceProduct.Id;
        INSERT vp;
        
        Review__c review = new Review__c();
        review.Account__c = account.Id;
        review.RecordTypeId = [SELECT Id, sObjectType, Name FROM RecordType WHERE Name = 'Supplemental' AND sObjectType = 'Review__c' LIMIT 1].Id;
        review.In_Progress__c = TRUE;
        INSERT review;
                
        List<Vendor_Products__c> vendorProduct = [SELECT Id FROM Vendor_Products__c];
        
        Test.setCurrentPage(ref);  
                   
        ref.getParameters().put('retURL', account.Id);     
        ref.getParameters().put('id', account.Id);   
        
        ApexPages.StandardSetController ssc = new ApexPages.StandardSetController(vendorProduct);
        ManageVendorProductsController controller = new ManageVendorProductsController(ssc);
             
        controller.viewModel.products[0].relianceProduct = relianceProduct;
        controller.viewModel.products[0].selected = true;
        controller.viewModel.account = account;
        
		// changed		
        System.assertEquals(null, controller.updateVendorProducts());
        
        controller.ViewModel.products[0].selected = false;
        
		// review
        System.assertNotEquals(null, controller.updateVendorProducts());
        
        controller.ViewModel.products[0].selected = true;
        
		// review
        System.assertNotEquals(null, controller.updateVendorProducts());
        
		// review
        System.assertNotEquals(null, controller.cancel());
                
    }
    
}

Hope this helps!

AM