below is my code
Public Class Testmanage{
public Testmanage(ApexPages.StandardController controller) {
}
public pageReference load()
{
if(ApexPages.currentPage().getParameters().get('id')!= '' || ApexPages.currentPage().getParameters().get('id') != null)
{
Id id = ApexPages.currentPage().getParameters().get('id');
List<Test__c>lstTest= [Select Phone__c from Test__c where id=:id LIMIT 1] ;
if(!lstTest.isEmpty())
{
PageReference pageRef = new PageReference('/apex/OppoAgr?id='+lstTest[0].Phone__c);
pageRef.setRedirect(true);
return pageRef;
}
return null;
}
return null;
}
}
Below is my test class
@istest
public class Test_Data1 {static testmethod void Testmeth1(){
Test__c tst=new Test__c(name='test',phone__C='3223233');
insert tst;
ApexPages.StandardController sc = new ApexPages.standardController(tst);
Testmanage cs=new Testmanage(sc);
pagereference pr = page.Demopage;
test.setCurrentPage(pr);
ApexPages.currentPage().getParameters().put('id',tst.id);
cs.loadAction();
}
static testmethod void Testmeth1(){
Test__c tst=new Test__c(name='test',phone__C='3223233');
// insert tst;
ApexPages.StandardController sc = new ApexPages.standardController(tst);
Testmanage cs=new Testmanage(sc);
pagereference pr = page.Demopage;
test.setCurrentPage(pr);
ApexPages.currentPage().getParameters().put('id',null);
cs.load();
}
I am not able to cover last return null statement
return null
is the culprit though