You need to sign in to do that
Don't have an account?
CB312
Attempt to de-reference a null object
I'm stuck on this test class, I don't think I am consrtucting it correctly as I am incorrectly refrecing the object. This is my first time writing a test class for an extension class.
System.NullPointerException: Attempt to de-reference a null object - Class.testTotalGPbyDiv.testTotalGPbyDiv: line 4, column 1 External entry point
public class testTotalGPbyDiv { static testMethod void testTotalGPbyDiv(){ Division__c div; div.name = 'Hampton Test'; insert div; ApexPages.currentPage().getParameters().put('id', div.Id); ApexPages.StandardController std=new ApexPages.StandardController(div); TotalGPbyDiv controller=new TotalGPbyDiv(std); } }
I'm really lost right now on how to get this to complie. Any thoughts?
_chris
Thanks, knew I was missing something in the test class. However when I moved the code to production. It gives me that same error when rendereing the VF page. Content cannot be displayed: Attempt to de-reference a null object.
However nothing changed in my code from Sandbox to production.The code worked and generated the google viz object in sandbox, but now it throws that error in production.
I am so lost....argh,
VF page:
Controller:
Debug log:
I don't understand what happened between sandbox & production. Its the exact same code on the exact same fields. Grrrrrr
Where are you creating the test opportunity record? Don't see it in the script below?
I as having an issue with the Test class earlier. I've got that solved, and now I am trying to figure out why I get that error in production when the VF component loads. Its the exact same code from sandbox to production.
When Prod fails but Sandbox works, it's usually because there was data in Sandbox making the test succeed that is missing in Live.
The error looks like it is falling over because a date field is null when it is not expecting it to be - that's why I would check that the Opportunity test record is being created correctly...
Agree.
If don't want to put extra code to catch null date, add value in Feature_Date__c