diff --git a/dlrs/main/classes/RollupCalculateJobTest.cls b/dlrs/main/classes/RollupCalculateJobTest.cls index d125b95c..648a65a4 100644 --- a/dlrs/main/classes/RollupCalculateJobTest.cls +++ b/dlrs/main/classes/RollupCalculateJobTest.cls @@ -261,13 +261,14 @@ private class RollupCalculateJobTest { RollupCalculateJob job = new RollupCalculateJob(rollupCfg.Id, 'Id != NULL'); String jobId; - System.runAs(new User(Id = UserInfo.getUserId())) { - Test.startTest(); - Assert.isTrue(FeatureManagement.checkPermission(permName)); - // go into runAs because we need to get the perms recalculated - jobId = Database.executeBatch(job); - Test.stopTest(); - } + Test.startTest(); + Assert.isTrue( + Utilities.userHasCustomPermission(permName), + 'Expected user to have ' + permName + ); + // go into runAs because we need to get the perms recalculated + jobId = Database.executeBatch(job); + Test.stopTest(); AsyncApexJob asyncJob = [ SELECT Id, Status, JobItemsProcessed, TotalJobItems diff --git a/dlrs/main/classes/RollupJobTest.cls b/dlrs/main/classes/RollupJobTest.cls index a24f730b..7c79ee23 100644 --- a/dlrs/main/classes/RollupJobTest.cls +++ b/dlrs/main/classes/RollupJobTest.cls @@ -251,16 +251,14 @@ private class RollupJobTest { insert items; String jobId; - System.runAs(new User(Id = UserInfo.getUserId())) { - Test.startTest(); - Assert.isTrue( - FeatureManagement.checkPermission(permName), - 'Expected user to have the ' + permName + ' permission set' - ); - // go into runAs because we need to get the perms recalculated - jobId = Database.executeBatch(new RollupJob()); - Test.stopTest(); - } + Test.startTest(); + Assert.isTrue( + Utilities.userHasCustomPermission(permName), + 'Expected user to have ' + permName + ); + // go into runAs because we need to get the perms recalculated + jobId = Database.executeBatch(new RollupJob()); + Test.stopTest(); AsyncApexJob asyncJob = [ SELECT Id, Status, JobItemsProcessed, TotalJobItems diff --git a/dlrs/main/classes/UtilitiesTest.cls b/dlrs/main/classes/UtilitiesTest.cls index 0daf47c0..23be6eba 100644 --- a/dlrs/main/classes/UtilitiesTest.cls +++ b/dlrs/main/classes/UtilitiesTest.cls @@ -44,8 +44,7 @@ public class UtilitiesTest { if (String.isNotBlank(perm.NamespacePrefix)) { permName = perm.NamespacePrefix + '__' + perm.DeveloperName; } - Assert.areEqual( - true, + Assert.isTrue( Utilities.userHasCustomPermission(permName), 'Expected user to have ' + permName );