<html><head><meta name="color-scheme" content="light dark"></head><body><pre style="word-wrap: break-word; white-space: pre-wrap;">@IsTest
public class AddPrimaryContactTest {
    
    @IsTest
    public static void testing() {
        List&lt;account&gt; acc_lst = new List&lt;account&gt;();
        for (Integer i=0; i&lt;50;i++) {
            account a = new account(name=string.valueOf(i),billingstate='NY');
            system.debug('account a = '+a);
            acc_lst.add(a);
        }
        for (Integer i=0; i&lt;50;i++) {
            account a = new account(name=string.valueOf(50+i),billingstate='CA');
            system.debug('account a = '+a);
            acc_lst.add(a);
        }      
        insert acc_lst;
        Test.startTest();
        contact c = new contact(lastname='alex');
        AddPrimaryContact apc = new AddPrimaryContact(c,'CA');
        system.debug('apc = '+apc);
        System.enqueueJob(apc);
        Test.stopTest();
        List&lt;contact&gt; c_lst = new List&lt;contact&gt;([select id from contact]);
        Integer size = c_lst.size();
        system.assertEquals(50, size);
    }

}</pre></body></html>