You need to sign in to do that
Don't have an account?
SKriLL
Why is this null test method code
//Im working with some old code...
Team__c tm = new Team__c(ID = ManID);
// Verified that this ID is valid by pasting it into a URL of object type Team__c
user u = [select id from user LIMIT 1];
update u;
test.starttest();
ApexPages.StandardController stdController = new ApexPages.StandardController(tm);
RegionalEXT extController = new RegionalEXT(stdController);
// The above line returns error "First argument cannot be null"
// Why is stdController null if tm isnt null?
I'd expect this to be an exception arising from the constructor of your extension controller to be honest. Do you have the stack trace?
System.NullPointerException: Argument 1 cannot be null", Failure Stack Trace: "External entry point Class.RegionalEXT.testMyVisualForce1: line 1122, column 1"
Which points to this line
RegionalEXT extController = new RegionalEXT(stdController);
However I when I run test in the sandbox stdController != null and extController != null
Is your ManID the id of an existing record?
Yes I think so.
I debug out the ID. Go to an existing record of the same type. Replace the ID in the URL with the ID from the debug statement, and it brings me to a valid page/record.
I assume if you debug out your standard controller, you don't get null?
Can you post the debug log - it still smacks of something in the constructor to me.
EDIT I pasted the wrong apex code originally... sorry
Text dump incoming
@isTest(SeeAllData=true)
public static void testMyVisualForce1() {
// Create our test data
ID ManID = [Select Regional_Leader__c FROM BD_Performance__c WHERE Regional_Leader__c != null AND Regional_Leader__r.Name <> 'Default Snapshot' LIMIT 1].Regional_Leader__c;
System.debug('***JON*** '+ ManID);
Regional_Snapshot__c tm = new Regional_Snapshot__c(ID = ManID);
if(tm!=null){System.debug('***JON***TM ');}
user u = [select id from user LIMIT 1];
if(u!=null){System.debug('***JON***U ');}
update u;
test.starttest();
// Instantiate and construct the standard controller and extension classes.
ApexPages.StandardController stdController = new ApexPages.StandardController(tm);
if(stdController!=null)
{
System.debug('***JON***STD ' );
System.debug('***JON***STDID ' + stdController.getID());
}
RegionalEXT extController = new RegionalEXT(stdController);
if(extController!=null){System.debug('***JON***EXT');}
if(extController==null){System.debug('***JON***EXT=NULL');}
extController.OppCalcs();
***Debug Log below***
24.0 APEX_CODE,FINE;APEX_PROFILING,FINE;DB,INFO;VALIDATION,INFO;WORKFLOW,FINEST
08:16:13.553 (553859000)|EXECUTION_STARTED
08:16:13.553 (553896000)|CODE_UNIT_STARTED|[EXTERNAL]|01p50000000GnTy|RegionalEXT.testMyVisualForce1
08:16:13.554 (554236000)|METHOD_ENTRY|[1]|01p50000000GnTy|RegionalEXT.RegionalEXT()
08:16:13.554 (554321000)|METHOD_EXIT|[1]|RegionalEXT
08:16:13.554 (554872000)|SOQL_EXECUTE_BEGIN|[1105]|Aggregations:0|select Regional_Leader__c from BD_Performance__c where (Regional_Leader__c != null and Regional_Leader__r.Name != 'Default Snapshot') limit 1
08:16:13.557 (557343000)|SOQL_EXECUTE_END|[1105]|Rows:1
08:16:13.557 (557589000)|USER_DEBUG|[1106]|DEBUG|***JON*** a0eW0000000ChNeIAK
08:16:13.557 (557822000)|USER_DEBUG|[1108]|DEBUG|***JON***TM
08:16:13.557 (557930000)|SOQL_EXECUTE_BEGIN|[1110]|Aggregations:0|select id from user limit 1
08:16:13.560 (560071000)|SOQL_EXECUTE_END|[1110]|Rows:1
08:16:13.560 (560193000)|USER_DEBUG|[1111]|DEBUG|***JON***U
08:16:13.560 (560233000)|DML_BEGIN|[1112]|Op:Update|Type:User|Rows:1
08:16:13.630 (630227000)|DML_END|[1112]
08:16:13.630 (630527000)|USER_DEBUG|[1119]|DEBUG|***JON***STD
08:16:13.630 (630590000)|USER_DEBUG|[1120]|DEBUG|***JON***STDID a0eW0000000ChNe
08:16:13.630 (630719000)|CONSTRUCTOR_ENTRY|[1122]|01p50000000GnTy|<init>(ApexPages.StandardController)
08:16:13.632 (632464000)|METHOD_ENTRY|[39]|01p50000000GnTy|RegionalEXT.__sfdc_ts(Regional_Snapshot__c)
08:16:13.632 (632482000)|METHOD_EXIT|[39]|01p50000000GnTy|RegionalEXT.__sfdc_ts(Regional_Snapshot__c)
08:16:13.632 (632510000)|METHOD_ENTRY|[40]|01p50000000GnTy|RegionalEXT.__sfdc_ts()
08:16:13.632 (632538000)|METHOD_EXIT|[40]|01p50000000GnTy|RegionalEXT.__sfdc_ts()
08:16:13.633 (633033000)|SOQL_EXECUTE_BEGIN|[40]|Aggregations:0|select Name, Regional_Billings__c, Regional_LC_Billings__c, Regional_WS_Billings__c, Regional_Non_CT_Billings__c, Regional_New_Biz__c, Regional_Quota_YTD__c, Regional_Quota_CY__c, Team_Leader__c, Team_Leader__r.FirstName, Team_Leader__r.LastName, Team_Leader__r.Name from Regional_Snapshot__c
08:16:13.658 (658655000)|SOQL_EXECUTE_END|[40]|Rows:1
08:16:13.658 (658843000)|SYSTEM_METHOD_ENTRY|[7]|QueryLocatorIterator.QueryLocatorIterator()
08:16:13.658 (658859000)|SYSTEM_METHOD_EXIT|[7]|QueryLocatorIterator
08:16:13.659 (659162000)|METHOD_ENTRY|[41]|01p50000000GnTy|RegionalEXT.__sfdc_ts(Regional_Snapshot__c)
08:16:13.659 (659196000)|METHOD_EXIT|[41]|01p50000000GnTy|RegionalEXT.__sfdc_ts(Regional_Snapshot__c)
08:16:13.659 (659305000)|METHOD_ENTRY|[47]|01p50000000GnTy|RegionalEXT.__sfdc_LeaderID(String)
08:16:13.659 (659336000)|METHOD_EXIT|[47]|01p50000000GnTy|RegionalEXT.__sfdc_LeaderID(String)
08:16:13.659 (659407000)|METHOD_ENTRY|[48]|01p50000000GnTy|RegionalEXT.__sfdc_LeaderName(String)
08:16:13.659 (659436000)|METHOD_EXIT|[48]|01p50000000GnTy|RegionalEXT.__sfdc_LeaderName(String)
08:16:13.659 (659559000)|METHOD_ENTRY|[54]|01p50000000GnTy|RegionalEXT.__sfdc_ts()
08:16:13.659 (659576000)|METHOD_EXIT|[54]|01p50000000GnTy|RegionalEXT.__sfdc_ts()
08:16:13.659 (659606000)|USER_DEBUG|[54]|DEBUG|INSIDE REGION OUTSIDE FORLOOP : a0eW0000000ChNeIAK
08:16:13.659 (659630000)|METHOD_ENTRY|[55]|01p50000000GnTy|RegionalEXT.__sfdc_ts()
08:16:13.659 (659645000)|METHOD_EXIT|[55]|01p50000000GnTy|RegionalEXT.__sfdc_ts()
08:16:13.659 (659935000)|SOQL_EXECUTE_BEGIN|[55]|Aggregations:0|select Sum_of_Open_Opps_2012__c, BD_Name__c, CY_Pipeline_Value__c, Total_Projection_From_Projection__c, CT_Projection_Total2__c, LC_Projection_Total2__c, Total_WS_Projection2__c, Non_CT_Billings_Currency__c, New_Business_Billings_Currency__c from BD_Performance__c
08:16:13.663 (663479000)|SOQL_EXECUTE_END|[55]|Rows:2
08:16:13.663 (663797000)|USER_DEBUG|[57]|DEBUG|INSIDE REGION FORLOOP
08:16:13.663 (663959000)|USER_DEBUG|[57]|DEBUG|INSIDE REGION FORLOOP
08:16:13.664 (664036000)|METHOD_ENTRY|[63]|01p50000000GnTy|RegionalEXT.__sfdc_YTDGap(Decimal)
08:16:13.664 (664071000)|METHOD_EXIT|[63]|01p50000000GnTy|RegionalEXT.__sfdc_YTDGap(Decimal)
08:16:13.664 (664092000)|METHOD_ENTRY|[64]|01p50000000GnTy|RegionalEXT.__sfdc_CYGap(Decimal)
08:16:13.664 (664117000)|METHOD_EXIT|[64]|01p50000000GnTy|RegionalEXT.__sfdc_CYGap(Decimal)
08:16:13.664 (664395000)|SOQL_EXECUTE_BEGIN|[68]|Aggregations:0|select ID, FirstName, LastName, Jan_Billings__c, Feb_Billings__c, Mar_Billings__c, Apr_Billings__c, May_Billings__c, Jun_Billings__c, Jul_Billings__c, Aug_Billings__c, Sep_Billings__c, Oct_Billings__c, Nov_Billings__c, Dec_Billings__c from user
08:16:13.666 (666551000)|SOQL_EXECUTE_END|[68]|Rows:2
08:16:13.667 (667296000)|CONSTRUCTOR_EXIT|[1122]|01p50000000GnTy|<init>(ApexPages.StandardController)
08:16:13.667 (667326000)|USER_DEBUG|[1123]|DEBUG|***JON***EXT
08:16:13.667 (667383000)|METHOD_ENTRY|[1125]|01p50000000GnTy|RegionalEXT.OppCalcs()
I'm not seeing the error that you refer to in that text dump?
The dump is from the debug log I get after Run Tests on sandbox
The error is get is from deploying to production... I am unaware of any debug logs that are created from this deploying process.
The error shows up in Component Deployment Results
Not seeing the same error in the debug logs from the sandbox is a very big part of my confusion
If you deploy as a change set via the browser you get a log if it fails.
Have you checked that the query to find ManID returns a value in production?
Please tell me how I can find/see this log.
Is there a simple way to just issue a query?
To see log:
In Sandbox go to Deploy / Outbound Change set.
Create new change set
add changes
delpoy to your production org.
In Prod org go to Deply / Inbound change sets
Click on the changes set from Sandbox - these can take some time to arrive
Hit deploy
Wait
It should fail - you will see link for view results.
I have been doing just that except I have been hitting validate.
Its my understanding that the changes wont actually deploy if there are failures, but will this really give me a log file that the validate function does not?
When I validate I get "results" but it is only the one line: Failure Message: "System.NullPointerException: Argument 1 cannot be null", Failure Stack Trace: "External entry point Class.ManagerEXT.testMyVisualForce1: line 1108, column 1" Not the same as a debug log
I always deploy - never used validate.
You can execute the query via the Developer Console. On your production org, go to dropdown link for your name next to 'Help and Training'. If you click that, you'll see Developer Console as one of the options. Select that and the console will open. You'll see an execute button with a 'click here to enter apex code' area next to it. Paste the query in here and check that your query returns an id that is non-null.
I did deploy, it failed, and I still do not see a debug log.
I get the same Component Deployment Results as I get when I validate
The Component Deployment Results only show the one line error message
Failure Message: "System.NullPointerException: Argument 1 cannot be null", Failure Stack Trace: "External entry point Class.ManagerEXT.testMyVisualForce1: line 1111, column 1"
Have you checked that the query to find ManID returns a value in production?
In production the query does return a valid ID
Hmm. Very odd. Can you deploy via the Force.com IDE - that gives you a debug log in the results via a button on the right hand side.