1 个回答
You can use the following code to get started
Let me know if this helps, if it does, please mark this answer as best so that others facing the same issue will find this information useful. Thank you@isTest
private class Task14_Test {
@isTest static void beforeupdateTest() {
mapUserRole = new Map<Id, UserRole>([Select Id, Name, ParentRoleID from UserRole limit 10000]);
Set<ID> currentRoleIds = new Set<ID>();
// get all of the roles underneath the passed roles
for(UserRole userRole :[select Id from UserRole where ParentRoleId]) {
currentRoleIds.add(userRole.Id);
}
// Perform test
Test.startTest();
className.getAllMyParentRoleID(currentRoleIds, mapUserRole)
Test.stopTest();
}
}