You need to sign in to do that
Don't have an account?
JAYESH RATHOR
Can any one help me out that how to cover the code coverage for below catch excpetion in test class.
public pagereference redirectLater(){
pagereference pgRd;
try{
pgRd = new pagereference('/Save_Page?lang='+ApexPages.currentPage().getParameters().get('lang'));
pgRd.setRedirect(true);
}
catch(Exception e){
ApexPages.addmessage(new ApexPages.message(ApexPages.severity.Error, e.getMessage()));
return null;
}
return pgRd;
}
pagereference pgRd;
try{
pgRd = new pagereference('/Save_Page?lang='+ApexPages.currentPage().getParameters().get('lang'));
pgRd.setRedirect(true);
}
catch(Exception e){
ApexPages.addmessage(new ApexPages.message(ApexPages.severity.Error, e.getMessage()));
return null;
}
return pgRd;
}
Assuming your method is in class DummyClass, slightly update your class as in below code
Then below test class should help you cover for exception block.
If this solves your problem, then mark this as an answer to help others.
All Answers
Assuming your method is in class DummyClass, slightly update your class as in below code
Then below test class should help you cover for exception block.
If this solves your problem, then mark this as an answer to help others.