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
dikshant jaindikshant jain 

The 'LeadProcessorTest' test class doesn't appear to be using the 'LeadProcessor' class. I got this error plz help me

dikshant jaindikshant jain
User-added imageUser-added image
Footprints on the MoonFootprints on the Moon
Hi Dikshant,

I ran your code exactly same, but found no issues. Coverage was 100%.
Please refer below codes -

//LeadProcessor.apxc
global class LeadProcessor implements Database.Batchable<Sobject> 
{
    global Database.QueryLocator start(Database.BatchableContext bc) 
    {
        Database.QueryLocator qObj;
        qObj = Database.getQueryLocator('select Id, Name, LeadSource, Rating from Lead');
        return qObj;
    }

    global void execute(Database.BatchableContext bc, List<sObject> records)
    {
        
        List<Lead> leadRecords = (List<Lead>) records;
        List<Lead> updatingLeadList = new List<Lead>();
            for (Lead leadObj : leadRecords) 
            {
                leadObj.LeadSource = 'Dreamforce';
                updatingLeadList.add(leadObj);
            }
        if(!updatingLeadList.isEmpty()){
            update updatingLeadList;
        }
        
    }    

    global void finish(Database.BatchableContext bc){   }    
}

//LeadProcessorTest.apxc
@isTest 
private class LeadProcessorTest 
{
    private static testMethod void LeadProcess() 
    {
        List<Lead> lstLead = new List<Lead>();
        for(Integer i=0 ;i <200;i++)
        {
            lstLead.add(new Lead(LastName ='LastName'+i, Company ='demo'+i, City='New York', Country='US', LeadSource='Phone inquiry'));
        }
        
        insert lstLead;
        
        Test.startTest();

            LeadProcessor obj = new LeadProcessor();
            DataBase.executeBatch(obj); 
            
        Test.stopTest();
    }
}

FYR - https://developer.salesforce.com/forums/?id=906F0000000D9AUIA0

Hope this helps!
dikshant jaindikshant jain
@Footprints on The Moon
But this error continue i write your same code as it is but error continue 
Footprints on the MoonFootprints on the Moon
Hey Dikshant,

Refer this one - https://salesforce-digitalxlien.blogspot.com/2019/09/solving-use-batch-apex-challenge.html
Not sure why you are not able to pass this challenge. Code is just fine!
dikshant jaindikshant jain
hey Footprints on the Moon
this code is successfully run and completed module but what is the mistake in my code that i can't understand
Anyway thank you so much