function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
test vijaytest vijay 

Apex test class Issue for AccountShare object

hello Guys,
Greetings,
for (Account a : [SELECT Territories__c, (SELECT UserOrGroupId from Shares WHERE RowCause='Territory'), (SELECT UserId, TeamMemberRole FROM AccountTeamMembers) FROM Account WHERE Id IN :accountIds]) {
            if(!a.Shares.isEmpty()) {
                for(AccountShare s : a.Shares) {
                    //tMap.put(s.UserOrGroupId, null);
                     system.debug('UserOrGroupId===> ' + s.UserOrGroupId);
 system.debug('RowCause===> ' + s.RowCause);                
}
            }
Actually, I have stuck in  this. I want to create a Account Where AccountShare.RowCause='Territory'
Please give me any way how to solve it.
Thanks In advance
 
SwethaSwetha (Salesforce Developers) 
HI Ravi,Are you seeing any errors?

Related:https://salesforce.stackexchange.com/questions/255603/what-is-rowcause-in-share-object
test vijaytest vijay
HI Swetha,
Thnaks for your response,
but I have seen this referance and I want to cover this method from my test class.can you tell me what shouldl I do for it.
Thank you