Created data in test class with User but as scope getting different user with Name system. Not the which iI have created in test class
for(user u: scope){
Inventy it= [select ID from Inventy where IRole__c =: u.UserCategory__c LIMIT 1];
}
for(user u: scope){
Inventy it = [select ID from Inventy where IRole__c = :u.UserCategory__c LIMIT 1];
}
Getting error List has no rows for assignment. In test class. Created this user for scope.
Integer RandomId1=Integer.valueOf(Math.rint(Math.random()*1100000));
String uniqueName1=orgId+dateString+RandomId1;
User uu1=new User(firstname = 'ABC',
lastName = 'XYZ',
Isactive = true,
email = uniqueName1 + '@test' + orgId + '.org',
Username = uniqueName1 + '@test' + orgId + '.org',
EmailEncodingKey = 'ISO-8859-1',
Alias = uniqueName1.substring(18, 23),
TimeZoneSidKey = 'America/Los_Angeles',
LocaleSidKey = 'en_US',
LanguageLocaleKey = 'en_US',
ProfileId = pf.Id,
UserCategory__c = 'Junior'
);
List has no rows for assignment In test class. Created this user for scope.
Integer RandomId1 = Integer.valueOf(Math.rint(Math.random()*1100000));
String uniqueName1 = orgId + dateString + RandomId1;
User uu1 = new User(
firstname = 'ABC',
lastName = 'XYZ',
Isactive = true,
email = uniqueName1 + '@test' + orgId + '.org',
Username = uniqueName1 + '@test' + orgId + '.org',
EmailEncodingKey = 'ISO-8859-1',
Alias = uniqueName1.substring(18, 23),
TimeZoneSidKey = 'America/Los_Angeles',
LocaleSidKey = 'en_US',
LanguageLocaleKey = 'en_US',
ProfileId = pf.Id,
UserCategory__c = 'Junior'
);