I'm scheduling a batchable class that deletes records from a custom object. The test class for my scheduled class saves without errors. However, I'm getting a "Constructor not defined: [deleteEndpointLogs].()" error when saving the test class for the batchable class and am getting stumped on how to resolve it.
Here is the code for the batch class:
global class deleteEndpointLogs implements Database.Batchable<sObject>{
global final String Query;
global deleteEndpointLogs(String q){
Query=q;
}
global Database.QueryLocator start(Database.BatchableContext BC){
return Database.getQueryLocator(query);
}
global void execute(Database.BatchableContext BC,List<Endpoint_Log__c> scope){
delete scope;
}
global void finish(Database.BatchableContext BC){}
}
And here is my test class:
@isTest
public class deleteEndpointLogsTest
{
static testMethod void testMethod1()
{
List<Endpoint_Log__c> logList= new List<Endpoint_Log__c>();
for(Integer i=0 ;i <200;i++)
{
Endpoint_Log__c log = new Endpoint_Log__c();
log.Resource_Name__c ='Test'+i;
logList.add(log);
}
insert logList;
Test.startTest();
deleteEndpointLogs batch = new deleteEndpointLogs();
DataBase.executeBatch(batch);
Test.stopTest();
}
}
The error is on line 18 of the test class. Any help with getting this resolved is greatly appreciated.