-
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.
Popular Salesforce Blogs

Learn All About Flows in Salesforce and Its Powers
What is a Flow in Salesforce? In Salesforce, a flow is an application that computes complex business measures. Basically, it gathers information and afterwards accomplishes…

6 Salesforce Books You Need To Check Out
There are so many Salesforce resources online, and if you're looking to get some help in this area, they're a great place to start. For…
Popular Salesforce Videos
Salesforce Diagram | Salesforce Diagramming Framework
Diagrams help drive key project decisions, align delivery teams, and help everyone understand where you’re going and what’s been done. Consistent, easy-to-understand diagrams are a…
Is It Possible To Get 20 Lacs Above Package In Salesforce?
Join this useful group for Salesforce job & career info. Watch this video and join this group to clear all the doubts you have regarding…
How to Learn Salesforce Development | Salesforce learning steps for beginners | Trailhead demo
In this video, we shared the steps to learn salesforce lightning basics, salesforce apex development, CRM in online for free from scratch very quickly. Learn salesforce…
Popular Salesforce Infographics

How Building Apps on Salesforce Has Tremendous ROI
The pressure that businesses today are under to reduce costs, improve agility, and deliver better results is no joke. Couple that with rapidly evolving technology…

5 Advantages of Using Salesforce for Your Business
Salesforce is a customer relationship management (CRM) platform that offers a wide range of features and benefits for businesses of all sizes. Here are five…

How to start your career In Salesforce?
Considering a career in Salesforce is a good choice for IT professionals looking to give a new boost to their career. Salesforce is a new…