You need to sign in to do that
Don't have an account?
Veena Gopal
null object created but not null checked.
In the visualforce workbook the following example is given for constructor testing:
To test the constructor use the below code:-
// test the class constructor
static testMethod void testClassConstructor() {
Test.startTest();
WarehouseUtils utils = new WarehouseUtils(null);
Test.stopTest();
// We expect that utils is not null
System.assert(utils != null);
}
Why system assert has been checked for != null when null was actualy passed for the object?
Please let me know if you need more clarification on the question.
To test the constructor use the below code:-
// test the class constructor
static testMethod void testClassConstructor() {
Test.startTest();
WarehouseUtils utils = new WarehouseUtils(null);
Test.stopTest();
// We expect that utils is not null
System.assert(utils != null);
}
Why system assert has been checked for != null when null was actualy passed for the object?
Please let me know if you need more clarification on the question.
Here we are calling the extension class with the object utils but instead of passing the object of apexpages.standardsetcontroller we are passing a null value , so object will have a value of WarehouseUtils:[] .So you need to check with !=null otherwise the test class will be failed . Please mark this as solved if this answer your query.
the statement we need to check is
public WarehouseUtils(ApexPages.StandardSetController controller) {
}
they have mentioned
// We expect that utils is not null
you have mentioned
"so object will have a value of WarehouseUtils:[]".
But what is the value WarehouseUtils:[]. what does this mean?