• priyaforsfdc
  • NEWBIE
  • 0 Points
  • Member since 2013

  • Chatter
    Feed
  • 0
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 1
    Questions
  • 3
    Replies

Calculate how many working and how many weekends in between Start date and End date.

How to override the"Save and New" Button Functionality which is in Standard Edit Page

 

 

 

Thanks ,

Ravali

Calculate how many working and how many weekends in between Start date and End date.

Hi,

 

I have wrote a batch class and now i am writing test class for it but i am getting this error. Argument must be an object that implements Database.Batchable

Batch class

global class CBatchCalculateRatingsHistoricalData 
{
// Persistent variables
global Boolean hasErrors {get; private set;}

// Constructor
global CBatchCalculateRatingsHistoricalData()
{  
    this.hasErrors = false;
}

global Database.QueryLocator start(Database.BatchableContext BC)
{
  system.debug('Processing start method'); 
    // Query string for batch Apex
    String query = ''; 
    query += 'SELECT Id,name,Date_of_First_Order__c,Number_of_Orders__c FROM Account ';
    if(system.Test.isRunningTest())
        query += ' LIMIT 200';
    return Database.getQueryLocator(query);
}

global void execute(Database.BatchableContext BC, List<sObject> objectBatch)
{

}

global void finish(Database.BatchableContext BC)
{

}
}

test class

@isTest(seeAllData = true)
public class scheduledBatchable
{  
 static testMethod void Test_CBatchRatingsHistory()
  {
      System.Test.startTest();
     CBatchCalculateRatingsHistoricalData b = new CBatchCalculateRatingsHistoricalData();
     Database.executeBatch(b, 200);
     System.Test.stopTest();

 }

 }

please tell me what is the issue with this code. If i am wrong then please help me to get it right. 

 

Thanks

Anu