-
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
A Step-by-step Guide to Successfully Implement Salesforce
Salesforce is one of the world’s most prevalent and persuasive Customer Relationship Management (CRM) solutions for marketing, sales, and service. Being one of the leading CRM systems in the…
An Introduction To Salesforce Flow Basics
The Power of Automation Over time, most companies set up a set of practices that can meet different business needs. These methods are usually unique…
Salesforce Lightning on Your Mind? Here’s Everything You Need to Know About Migration Process
Sixty-nine percent of users say that it is easier to use their Salesforce instance today than it was 12 months ago. But not everyone is convinced. A…
Popular Salesforce Videos
Use cases Automation UiPath with Salesforce
The following video demonstrates a UiPath Robot automatically populating Salesforce using data read from an Excel spreadsheet....imagine how UiPath Robots could accelerate your Salesforce activities.…
Salesforce QA Interview Guidance Program
Do you want to learn what it takes to clear a Salesforce QA interview? In this video, Bava Dharani Ganesan gives a detailed explanation of…
Web Chats In Salesforce | Service Cloud | Kanika Chauhan
Salesforce Web Chat (previously known as Salesforce Live Agent) is a feature that allows customers to communicate with the company via the web through instant…
Popular Salesforce Infographics
Introduction to The Salesforce Architecture
Have you ever wondered what is so special about Salesforce? How does it manage to accomplish so much in such less time? Well, the secret…
The key takeaways from Salesforce Basecamp 2017
Thousands of Trailblazers have converged on Hong Kong, Auckland, Singapore, Mumbai and Melbourne. They heard from a stellar line-up of industry experts, Salesforce Trailblazers and…
Boost Sales and Marketing with Salesforce Einstein 1
Salesforce Einstein 1 is a suite of artificial intelligence (AI) tools designed to enhance business efficiency and decision-making. Around 80% of customers expect companies to…