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
notsosmartnotsosmart 

Test Method - System.NullPointerException: Attempt to de-reference a null object

.I'm getting the above referenced error on all methods in my test method..

 

Excerpt from the test method:

/**
* Purpose : This class contains unit tests for the Conversion controller.
*/
@isTest(seeAllData=true)
private class Test_ConvertAccounts_Devt{

private static ApexPages.StandardController ctl;
private static ConvertAccountsDev ext;
private static ApexPages.StandardController ctlWithData;
private static ConvertAccountsDev extWithData;

private static Account a; 

private static Account account;
private static Account myAccount;
private static List<AccountLineItem> ail;

static{

//Build mock data
setupReportWithItem();


//Instantiate and empty controller.
ctl = new ApexPages.StandardController(new Account());


//Instantiate a full controller.
ctlWithData = new ApexPages.StandardController(a);
extWithData = new ConvertAccountsDev(ctlWithData);
extWithData.isDone = false;

//Added....
ext = new ConvertAccountsDev(ctlWithData);

system.debug('**********************************');
system.debug('ctlWithData&colon; ' + ctlWithData);
system.debug('ext: ' + ext);
system.debug('**********************************');

account = new Account();
myaccount = new Account();


} // End

 

/// the page reference call segment:

 

static testMethod void CanTestExit(){

PageReference xit = ext.Exit();

} // End

 

-----------

 

There I get the failure for:

 

System.NullPointerException: Attempt to de-reference a null objectClass.Test_ConvertAccounts_Devt.CanTestExit: line 107, column 1

 

 

Any ideas?  Thanks.