Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- global class SandboxRefreshScript implements SandboxPostCopy {
- global void runApexClass(SandboxContext context) {
- // Change value of Alias below to the Alias of user who should own the group, ensuring that it is unique among your users
- List<User> groupOwner = [SELECT Id, Username FROM User WHERE Alias = 'TTayl'];
- Id grpOwnerId = groupOwner[0].Id;
- // Change group privacy, description and name as needed for your purposes
- CollaborationGroup newGroup = new CollaborationGroup(
- CollaborationType = 'Public',
- Description = 'Group description text',
- Name = 'Group for mentions',
- OwnerId = grpOwnerId
- );
- insert newGroup;
- }
- }
- /***** In a Separate Apex Class File: *****/
- @isTest
- class TestSandboxRefreshScript {
- @isTest
- static void testMySandboxPrep() {
- Test.startTest();
- Test.testSandboxPostCopyScript(
- new SandboxRefreshScript(), UserInfo.getOrganizationId(),
- UserInfo.getOrganizationId(), UserInfo.getOrganizationName());
- Test.stopTest();
- // Change Name value to the name of your group!
- List<CollaborationGroup> chGroup = [SELECT Id, CollaborationType from CollaborationGroup WHERE Name = 'Group for mentions'];
- System.assertEquals(1, chGroup.size(), 'Chatter Group List size not equal to 1');
- System.assertEquals('Public', chGroup[0].CollaborationType, 'Chatter group is not public');
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement