-
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
5 Productivity Tips by Salesforce System Administrators
Salesforce is a highly transformative platform when used correctly. It has all the tools you need to build and optimize processes. But achieving productivity on…
Salesforce Marketing Cloud Hacks You Must Try
For any Marketing Cloud professional, it is important to know the ins and outs of the product so it can be used to its full…
Transform Your Manufacturing Business with Seamless Cloud Solutions
To succeed in a continually shifting and increasingly competitive industrial landscape, organisations will need to adopt smarter and more connected approaches to managing their businesses,…
Popular Salesforce Videos
The Power Of Displaying Salesforce Data in Google Maps
Ever wondered where on earth your Leads are? Or your customers and prospects for that matter? Well here’s the way to find out. Display your…
Add In-App Guidance to Salesforce Lightning Experience
In Lightning Experience, add prompts that appear on-screen to users working in an app. Use prompts to onboard and train users, highlight configuration changes and…
Salesforce Lightning Tutorial | Salesforce Training | Lightning Training Video
This Salesforce Lightning Tutorial will explain the concept of lightning components along with the lightning component capabilities. Lightning includes the Lightning Component Framework and some…
Popular Salesforce Infographics
Top Essential Features of the Salesforce Service Cloud to Improve Customer Service
The Salesforce Service Cloud is a powerful platform that can help businesses of all sizes improve their customer service. It offers a wide range of…
Swith To Salesforce Lightning to Unlock enhanched productivity
Struggling to build responsive Salesforce apps for your enterprise? Switch to Salesforce Lightning today to build next-level custom applications that deliver rich enterprise experiences. Learn…
How to Create a Community of Trust and Gratitude with Salesforce
The businesses that will be remembered positively after COVID-19 are extending empathy and grace to their employees, customers, and communities. We’ve seen so many communities…