You need to sign in to do that
Don't have an account?
newbiewithapex
How to write test class to validate customer order?
I have this class as a controller for the customer order validate component . I need help writing test class for this one. Any kind of help would be much appreciate.
public class CustomerOrderValidateCntrl { @AuraEnabled public static UserNAccountDetails getParamDetails(String accId) { Account acc = getAccountDetails(accId); boolean profilecheckfailed = false; profilecheckfailed = isProfileNotToBeAllowed(); system.debug('Tandem: '+acc.Tandem_Account_Number__c); return new UserNAccountDetails(profilecheckfailed,acc.Tandem_Account_Number__c,acc.Division_Number__c,getUserDetails()); } public static Account getAccountDetails(String accId) { return [SELECT Id, Tandem_Account_Number__c, Division_Number__c FROM Account WHERE Id = :accId LIMIT 1]; } public static String getUserDetails() { User usr = [SELECT Id, Network_Id__c FROM User WHERE Id = :UserInfo.getUserId() LIMIT 1]; return usr.Network_Id__c; } public static boolean isProfileNotToBeAllowed(){ SalesforceIds__c profileIds = SalesforceIds__c.getOrgDefaults(); return (UserInfo.getProfileId().contains(profileIds.Profile_USF_ChefStoreRep__c)); } public class UserNAccountDetails{ @AuraEnabled public Boolean profileCheckFailed {set;get;} @AuraEnabled public String tandemNumber {set;get;} @AuraEnabled public String divisionNumber {set;get;} @AuraEnabled public String networkId {set;get;} public UserNAccountDetails(Boolean profileCheckFailed, String tandemNumber, String divisionNumber, String networkId){ this.profileCheckFailed=profileCheckFailed; this.tandemNumber=tandemNumber; this.divisionNumber=divisionNumber; this.networkId=networkId; } } }
All Answers
Class.CustomerOrderValidateCntrl.isProfileNotToBeAllowed: line 47, column 1
Class.CustomerOrderValidateCntrl.getParamDetails: line 16, column 1
Class.CustomerOrderValidateCntrlTest.validateCustomer: line 30, column 1
MESSAGE
System.NullPointerException: Argument cannot be null.