-
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
Upcoming Salesforce Events and Releases - 2021
Every year Salesforce comes up with an extravagant and magnificent series of events and 2021 is no different. A lot of exciting events and releases…
What is Salesforce Community Cloud?
In today's fast-paced business environment, maintaining strong relationships with clients and partners is crucial for success. Salesforce Community Cloud has emerged as a dynamic solution…
Einstein Prediction Builder: Next Steps to Build an Automated Flow
This article is prepared by our Salesforce Administrator Dzmitry Pimenau. Automation of Actions based on Predictions In the first part of the article we described the…
Popular Salesforce Videos
What is Salesforce Commerce Cloud? | Salesforce Video Tutorial
Do you know what is Salesforce Commerce Cloud? Formerly called Demandware, it is a cloud-based service for unifying the way businesses engage with customers over…
Learn About the Salesforce Products in this Tutorial Video
Salesforce is a top-rated CRM that offers businesses a diverse range of products to enhance their business model and operations. With each Salesforce product specifically…
How you can Increase your Salesforce Efficiency and Productivity
In this video, Brad discusses how to increase your workplace efficiency and productivity using various Google Chrome extensions and techniques. As always, we have linked…
Popular Salesforce Infographics
Infographic: 3 Trends That’ll Transform Small Business Growth in 2018
If you’re hoping to successfully grow your small business this year, you need to stay on top of the newest trends. Not sure where to…
Salesforce and QuickBooks Integration - Transform your Business
Do you know that you can convert 30% of your opportunities into leads when you integrate Salesforce and QuickBooks together? Sounds Interesting right? Our connector eShopSync…
What Can Salesforce’ Non Profit Success Pack Provide You With?
The Nonprofit Success Pack NPSP (formerly known as "Nonprofit Starter Pack) is a set of managed packages developed and maintained by Salesforce.org and made available…