You need to sign in to do that
Don't have an account?

How to satisfy these below lines in test class in salesforce?
How to satisfy these below lines in test class in salesforce?
Profile userProfile = [SELECT Id FROM Profile WHERE Name='System Administrator'];
user userRole = [SELECT id, name, UserRole.name FROM User WHERE UserRole.name like '% FAWS Technical Onboarding Manager%'];
if((userProfile.Id != UserInfo.getProfileId())||(userRole.Id != userInfo.getUserRoleId())){
can any one suggest please?
Profile userProfile = [SELECT Id FROM Profile WHERE Name='System Administrator'];
user userRole = [SELECT id, name, UserRole.name FROM User WHERE UserRole.name like '% FAWS Technical Onboarding Manager%'];
if((userProfile.Id != UserInfo.getProfileId())||(userRole.Id != userInfo.getUserRoleId())){
can any one suggest please?
Please insert a dummy user - who is not a sys admin and whose role is not FAWS Technical Onboarding manager........and use System.RunAs(dummyUser) to execute your test method logic.
Hope it helps!!
Use below code to create UserRole and User records. Let me know if it works.
Thanks,
Dhanya