-
Test Coverage for Pagereference method with if statement
I need your assistance to complete test coverage for the following code. How do I add the Pagereference method in my test class and cover the if condition, Thank you!
public Pagereference newPage() {
Id classRecordTypeId = Schema.SObjectType.class__c.getRecordTypeInfosByName().get(‘Staff’).getRecordTypeId();
String url = ‘https://ourcommunity.force.com/staffportal/List?id=’ + classId;
if(classType == classRecordTypeId) {
url += ‘&type=Staff’;
}
return new PageReference(url);
}
Log In to reply.