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
shankar sudalaimanishankar sudalaimani 

Test Class For Trigger before delete

Please, give a suggestion for writing the test class for trigger below,i Wrote a test class and it's covered 60% and i don't know covered this trigger because they hardcored the group,profile and user id in the below trigger.
Trigger:
trigger onApprovedDeleteAcct  on B_Account__c (before delete) {
{

for (Integer i = 0; i < Trigger.old.size(); i++)
        {
        B_Account__c newObj = Trigger.old[i];
        if(newObj.KYC__c != null)
        {
              Case  KYCCase = [select OwnerId from Case where Id = :newObj.KYC__c];
              String ownerId = KYCCase.OwnerId;
                if(ownerId.indexOf('00G30000000qjKF')!=-1 /* Approved KYC (Queue)*/ &&
                  (UserInfo.getProfileId().indexOf('00e30000000hdt5') == -1) /* AML Bus Risk */ &&
                  (UserInfo.getProfileId().indexOf('00e30000000fWgj') == -1)/* AML Compliance */  )
                {
                       newObj.addError('An approved KYC may not be changed !');
                } else if((ownerId.indexOf('00G30000000qjAe')!=-1)/* AML & Bus Risk (Queue)*/
                       || (ownerId.indexOf('00G30000000qjAj')!=-1))/* Compliance KYC (Queue)*/
                           if  ((UserInfo.getProfileId().indexOf('00e30000000hdt5') == -1) /* AML Bus Risk */ &&
                                (UserInfo.getProfileId().indexOf('00e30000000fWgj') == -1)/* AML Compliance */  )
                           {
                                 newObj.addError('You may not change a KYC which is with ABR & Compliance for review.');
                           }
        }
        }
        }                     
}
Test Class what i write:
@isTest
public class Test_CommonRelatedFunctionalities {
 
	static testMethod void spgCustomersAndLeads() {
Profile prof = [SELECT Id FROM Profile WHERE Name = 'DB_Standard User_sales'];
  User user = new User(FederationIdentifier = '12313',Alias = 'standt1',Country='India',Email='demo13@db.com',EmailEncodingKey='UTF-8', LastName='Testing', LanguageLocaleKey='en_US',LocaleSidKey='en_US',ProfileId = prof.Id,TimeZoneSidKey='America/Los_Angeles', UserName='EVENTUSER13@db.com');
		insert user;
  Account firstacc=new Account(Name = 'Interactive Ties', Website = 'http://www.interactiveties.com/',OwnerId = user.Id,RecordTypeId= rec1.Id);
        insert firstacc;

       case ca=new case();
       ca.OwnerId=user.Id;
       ca.Type='Customer Call';
       ca.Case_Subject__c='Bill Payment';
       ca.Status='New';
       ca.ContactId=contacts[0].id;
       insert ca;
       
       B_Account__c dbAcc=new B_Account__c();
       dbAcc.Name='IntestOrg';
       dbAcc.KYC__c=ca.Id;
       insert dbAcc;
       delete dbAcc;
}
}

Thanks in Advance
Shankar S