You need to sign in to do that
Don't have an account?

please give me tst class for below code
if (selectedAccount == null && ApexPages.currentPage().getParameters().get('id') != null && ApexPages.currentPage().getParameters().get('id') !='') {
ID accId = ApexPages.currentPage().getParameters().get('id');system.debug('>>accid'+accId );
String strQuery = 'SELECT Id,Name,BillingStreet,Phone,BillingCity,BillingState,BillingPostalCode,BillingCountry,BIN__c FROM Account WHERE id='+ '\'' + accId +'\'';
system.debug('>>strQuery'+strQuery);
selectedAccount = Database.query(strQuery);
}
ID accId = ApexPages.currentPage().getParameters().get('id');system.debug('>>accid'+accId );
String strQuery = 'SELECT Id,Name,BillingStreet,Phone,BillingCity,BillingState,BillingPostalCode,BillingCountry,BIN__c FROM Account WHERE id='+ '\'' + accId +'\'';
system.debug('>>strQuery'+strQuery);
selectedAccount = Database.query(strQuery);
}
Thanks,
All Answers
Thanks,
Insert Account inyour test class
then pass that account id to the parameter as below
ApexPages.currentPage().getParameters().put('id',AccountId);
(Instanceofyourcontroller).selectedAccount = null;
And call that method in your test class.
Check the below links
https://developer.salesforce.com/forums/ForumsMain?id=906F000000098ykIAA
https://developer.salesforce.com/forums/ForumsMain?id=906F000000096COIAY
http://salesforce.stackexchange.com/questions/39978/need-help-with-test-class-with-apexpages-currentpage-getparameters-id
Regards,
Bhanu Mahesh