You need to sign in to do that
Don't have an account?
Staci
Test utility
Trying to write a Test Utility so I can call it in various test methods. I've got this so far but getting an error
Constructors cannot be static at line 4 column 19
can anyone tell me what I'm doing wrong please?
Constructors cannot be static at line 4 column 19
can anyone tell me what I'm doing wrong please?
@isTest public class CW_DataCreation{ public static CW_userDataCreation(){ //create Tier 2 user Profile p = [SELECT Id FROM Profile WHERE Name='CW Software Support - Tier 2' limit 1]; UserRole r = new UserRole(Name='CW Tier 2'); User u1 = new User(LastName = 'Test Class', Username = 'TestClass@Test.com', UserRole = r, Profile = p, Email = 'Tier2Test@Test.com', Alias = 'tclass', CommunityNickname = 'tclass', TimeZoneSidKey = 'Asia/Kolkata', LocaleSidKey = 'en_US', EmailEncodingKey = 'UTF-8', ProfileId = p.Id, LanguageLocaleKey = 'en_US', License_Owner__c = 'CW'); insert u1; } return u1; }
All Answers
User u1 = CW_DataCreation.CW_userDataCreation();
Works fine in the first method, but the second method its telling me I need to create unique usernames. Is there a way to call it outside the 3 methods and use it in each method? Otherwise I'll just create 3 users in my test utility