• Geoffrey Nix
  • NEWBIE
  • 0 Points
  • Member since 2017

  • Chatter
    Feed
  • 0
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 16
    Questions
  • 9
    Replies
@isTest
private class NotifyClosingOppsTest {
    @testSetup
    static void setup(){
        Opportunity [] opps = new List <Opportunity>();
        
        for(Integer i=0; i<50; i++) {
           opps.add(new Opportunity(Name ='Tester ' +i,
                     CloseDate = date.newInstance(2020, 1, 1), Stage = 'Needs Analysis'));
        }
        insert opps;
        
        static testmethod void test() {
            Test.startTest();
            NotifyClosingOpps oppTester = new NotifyClosingOpps();
            Id BatchId = Database.executeBatch(oppTester);
            Test.stopTest();
            
            System.assert(Opportunity.CloseDate < 30);
            }
        }
}